php

Web Proxy (PHP & curl), AJAX and Multidimensional associative $_POST Array or $_SERVER['QUERY_STRING']?

I've got an html form that submits via AJAX (jquery Form Plugin) to a PHP Web Proxy on my server. The web proxy uses curl to POST to a third party script. My html form has inputs with names like p[fname], p[lname], c[name], p[loc], p[loc][email], p[loc][email][detail]. The names are specified by the third party application. When I use ...

How to fix auto newline PHP

$LINE = $User.",".$data[$k][10]; echo $LINE; $str=implode("",file('Friends.php')); $fp=fopen('Friends.php','w+'); $str=str_replace($User,$LINE,$str); fwrite($fp,$str,strlen($str)); OK, this code is a bit weird but it just appends to a string of my choice. Out should come: H4cKL0rD,9,1,2,3,4 but when it writes it it outputs into t...

Codeigniter JQuery Ajax

Hello, I'm a heavy Codeignitor user and currently I have to build a page with extensive AJAX bits and pieces. I have been using JQuery all along the website and it's AJAX handling was perfect up until now. There is something that just doesn't feel right when i use a MVC with JQuery. For example: in Jquery I setup the callback URL easily...

How to send email with attachment using PHP?

hi all, I am using following code for sending email with attachment but the proper file is not getting attach with mail. $UnidID = $_COOKIE['UniqueID']; $guid = $_COOKIE['guid']; $target_path = "userdata/".$UniqueID."/".$iGuid."/Outputs"; $fname = getpathmail($UnidID,$guid); $target_path = $target_path.$filname; $fileatt_type = "a...

How do I use multiple sources in one index in Sphinx?

The Sphinx config file hints to it supporting multiple sources for one index, how do I actually specify it? Here's the snippet from the config file: # document source(s) to index # multi-value, mandatory # document IDs must be globally unique across all sources source = src1 I've tried setting it in the following for...

Finding exact requirements for a php application

Hi, I am developing a php application which my customers will download and install on their own servers. I know the base requirements for my application (like min. php version) but is there a way to generate a list of requirements that needed to run my application on windows or unix systems? Thanks. ...

foreach php statment

I need to combine two foreach statement into one for example foreach ($categories_stack as $category) foreach ($page_name as $value) I need to add these into the same foreach statement Is this possible if so how? thanks ...

hide ID mod_rewrite

is there a way to hide IDs using only .htaccess and without changing my php code? htt://www.domain.com/show.php?categoryID=2&cname=electronic&productid=21&name=laptops to htt://www.domain.com/electronics/laptops thanks in advance. ...

.htaccess mod rewriterule and ampersands

I've been struggling with this for two days right now. At the moment I have the following rewrite rule: RewriteRule ^(.*)$ index.php?u=$1 [NC,L] Which ports everything behind example.com/ to index.php as the GET variable u. Which is being processed in index.php with an explode to define te different arguments being: the city (betwee...

What does this statement mean?

While $w is an Array ( [0] => 4, [1] => 6 ) what does this statement mean: $day == $w[0] || $day == $w[1] || $day < ((7 + $w[1] - $w[0]) % 7); Please help. I have not seen the || operator inside other than an if or while statement. Thank you. EDIT 01: This is the original function where it is used to find the number of a particul...

filesize function is crashing the Apache server

Hi all, On using filesize is PHP is crashing the apache server. No error is seen in the log file but window event viewer shows Faulting application Apache.exe, version 2.0.63.200, faulting module php_iisfunc.dll, version 5.2.7.7, fault address 0x00001085. regards Hemant ...

How to calculate NPV

Hi All i want to calculate the NPV ( Net Present Value ) using PHP. Below is the detail which i have. discount rate : 15% Cash Flow Values per Year: Year 1: 110000 Year 2: 122000 Year 3: 135200 Year 4: 149720 Year 5: 157706 Year 6: 166091 NPV Formula which i am using. NPV = sum of all years( (Ci...

Checking filetypes when uploading, and browser dependency issues

I'm building a php file uploader and I've some issues with security. For example I don't want to allow ".php" file uploads. As I know the only way to check the file type is with $_FILES['file']['type'] and the value of it is browser dependent. I check with multiple browsers and found that when selecting a regular .php file different bro...

Simple shopping cart problem using session in PHP

Hi, i made simple PHP shoppingcart based on session. from bock "Build your own database driven web site using php & Mysql" its contain 3 files: the controller index.php, and the two template files catalog.html.php, cart.html.php the problem is when i click on "View your cart" link, the session will end and $_session['cart'] will unset ...

Cucumber response object -- PHP environment

Hi, I'm using Cucumber to test a PHP application, and while most everything works without issue, I haven't yet figured out how to retrieve a response object for a request -- I'm looking to test whether a response is successful (code 200) and also to perform some Hpricot parsings of the response body. Right now my env.rb file is pretty ...

Customer attribute on email order confirmation?

I have created a custom attribute called "leave_out" that I have added to the customer register form and it works fine - saves to db and I can retrieve through the customer info tab in the admin. I want to include the value of this attribute on the order confirmation email though - how? ...

pChart problem with some data values

Hi Guys, I am using pChart PHP component for chart drawing. What is happening is that for some values it just hangs and doesn't draw the chart. Here is my code: $DataSet = new pData; $DataSet->AddPoint(array(111220, 180496, 103366, 110603, 107354, 100896, 103335, 101180, 102134, 102682, 99938, 96807, 95746, 100057, 95694, 97747, 95919,...

wordress plugin options dosent show the new values after form submit

Hi guys, I've written another plug-in for wordpress, On my main options page i have 3 tabs, after i click save, it updates my options, but when the page re-loads im on tab 1 of 3, were 3 = options page. the options are still showing the old values, until i either refresh the page or click on another page and come back.. all i need...

JSON string outputs a float value

Hello, I am parsing a JSON response (twitter api - cursor value) and what should be a string value seems to be a double value when I output it with PHP. Any idea how I get the real string value? ...

Magento Checkbox for bundle products needs qty

With a bundled product in magento you can select various types of options - drop down for example adds a Qty box so you may choose the quantity of items from the drop down. I am using Checkboxes instead as i need many choices and need a Qty box associated - how is this possible? I've spent hours trying to code this. ...