php

PHP Parsing Case Sensitivity

I'm parsing a file that is set up like so: <blah-name name="Turkey"> <blah-city name="Test"/> <CAPS> <type type="5"> <type-two type="6"> </CAPS> At the top of my file, I create $xmlobj, like so: $xmlobj = simplexml_load_file("TEST.XML"); I'm then inserting the values into a table by creating a class that takes all of these as p...

How can I escape an ampersand in php before sending to a db?

Wierd thing is happening when I send data to my database. Anything after the ampersand is dropped as if it were never typed and everything before it is left intact. Can someone please tell me what I should use to preserve this character? REGEX? PHP function? Thanks EDIT: code: // The POST var contains data entered by the user so coul...

curl output to database

curl_setopt($ch, CURLOPT_FILE, $fp) which is used for output to a file. Is any way to set output to database. ...

How to use Wine from Apache/Php? - '/var/www' is not owned by you...

Hi! I need to run a windows command line tool from a php script on my Debian server. For that, I'm trying Wine. Invoking wine and the tool via terminal works fine: "$ wine tool.exe" But when running the same from my php script... exec("wine tool.exe"); ...I get the following in my Apache error log: wine: '/var/www' is not owned by yo...

PHP - Pass Drop Down List option through query string

I have a drop down list that has options that need to be passed through a query string. How would I go about doing this? Also, would anyone be able to list a way to do this both using a button and without using a button? Thank you! ...

PHP check whether Incoming Request is JSON type

Is there anyway to check whether an incoming request is of AJAX JSON type? I tried if(($_SERVER['REQUEST_METHOD']=='JSON')) { } But it didn't work. Any thoughts? ...

Opensource project's php syntax

Hi guys. When working with open source project (like wordpress, drupal, joomla) i always find in the php pages a syntax like (this is an example from drupal): <?php if ($linked_site_logo or $linked_site_name): ?> <?php if ($title): ?> <div class="logo-site-name"><strong> <?php if ($linked_site_logo): ?><span id="logo"><?php...

Image file cheksum as a unique content compare optimalisation

Users are uploading fotos to our php build system. Some of them we are marking as forbidden because of not relevant content. I´m searching for optimalisation of an 'AUTO-COMPARE' algorithm which is skipping these marked as forbidden fotos. Every upload need to be compared to many vorbinden. Possible solutions: 1/ Store forbidden files ...

Is it possible to build a remote file manager in PHP?

Is it possible to do file operations from a script running on a different server than the files being operated on? That is, upload, move, rename, delete, create new, modify, etc. How would I go about doing this? ...

PHP function is_nan() throws a warning for strings

I've been using the is_nan() function (ie: is-not-a-number) to check whether a variable taken from the querystring is a number or not. However, in the case of the variable being a string (in which case is_nan() should return TRUE), the function also throws the following rather annoying warning: Warning: is_nan() expects parameter 1 to b...

Can someone please tell me how to escape an ampersand in PHP?

I have a wysiwyg editor that is changing my ampersand characters from & to &amp; What happens when the data is submitted is that everything after the & is dropped and everything before is left intact. I asked this question a while back but couldn't seem to get an answer. We thought that maybe it was the editor but I verified that the am...

Finding all non-conflicting combinations of values from multiple lists of values

I have the following array which contains arrays of values: $array = array( array('1', '2'), array('a', 'b', 'c'), array('x', 'y'), ); There can be any number of arrays and an array can contain any number of values. I currently have a piece of code which will generate all combinations where one value is taken from each arr...

MySQL update one row when another changes

I have a table with products. artID artName stock order 1 cables *100 0 2 cables *1 75 What should I do to asociate these 2 rows and get the stock in sync. The provider sells the cables in bulks on 100 units, and the retail store sells then as unit. The idea is: when "cables *1" run nearly out of stock set the order row to 1 so...

Drupal Views: difference between Filters and Arguments?

What difference between Filters and Arguments? E.g. if I need to show nodes where event_start is located inside specified month, which one should I use? ...

PHP: setting variables in IF-construct?

Can I set variables inside if-construct? In general, where is it allowed to set variables? function set_login_session ( $passhash ) { $_SESSION['login']['logged_in'] = 1; if ( ERROR ) return false; } // Does it set the Session variable? if ( set_login_session ( $passhash ) === false) return false; ...

PHP mail function not working

hello, I have written a basic script for the mail functionality. I am trying to run this script through WAMP server. <?php phpinfo(); $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From: $from"; $res= mail($to,$subject,$message,$headers); echo " ...

Best way to present a Development and Live version

Like all web projects, when the site goes live you will require an ongoing support and development. We normally setup a BETA site to show our clients what it would look like so they can sign it off. With very large or highly programmed sites does anyone have a good way to deal with development and live site deployments ...

[phpunit] automated test generation?

hi all currently im writing a test for a report function the more functionality the project gets the more reports need to be written in my case reports get a few 'search' paramters and limitations like number of rows or such now my question: anyone knows how to generate test cases automatically for a function which has a well known se...

PHP: session.auto_start

I have two projects in the same server, their settings conflict in the "session.auto_start", related post. Can I have the session.auto_start "ON" despite the other project contains codes such as session_start()? ...

PHP Link problem

Hello, I have a head file which I am using for a few different pages. The problem is when I go into a folder, the links in the head file point to say index.php instead of ../index.php Is there any function to fix this or any work arounds that I'm missing?. Thanks! ~ Kyle G ...