php

IIS 7 Virtual Directory running PHP problem?

I have recently setup a site on IIS 7 Windows 2008 Server, with PHP FastCGI. This site was run previously on IIS 6 Windows 2003 server, and it ran without any problems, now however PHP pages within the virtual directory I get a 500 - Internal server error. Within the Virtual directory html pages come up no problem. PhP pages outside of t...

How do I allow a user to upload a file temporarily?

I am working on a csv import option on my php page. Is there any way to allow the user to upload a csv for processing and then destroy the file when it is complete? I have seen plenty of tutorials for uploading files, but none seem to mention something like this. ...

PHP: How to send REST requests with XML data

Hi! I need to make a request to an API, using REST (POST method) in PHP. But the data needs to be in XML format. How can I send REST requests with XML data? Thank you! ...

jQuery.post(), PHP and redirects

THIS PROBLEM IS NOW SOLVED. THANK YOU TO EVERYONE WHO REPLIED. Hello, I am trying to solve a problem that I may have approached from the wrong direction, so maybe someone could suggest a better solution. I am writing a little web app for work, that has a search function. When user submits a search string, form gets posted to a CodeIgn...

How can I make a radio button control all of this?

When visitors register on my site, they will do so as the founding member of a group or as a person joining an existing group. Nobody is "group-less." I have a single registration page with the following fields: first name, last name, (radio buttons to choose group type: New or Existing), group name, group password, email, pass, confirm...

Accessing text in a field placed by JS, via PHP

In PHP, in a particular CMS I am using a custom field, which works like google suggest. As in, for each letter I type an SQL query is performed and matching records are displayed. When clicking on a record it fills the field with that record. I am fairly certain this is all done with JavaScript. I need to know how I can access the res...

Apache not loading PHP oracle dll

on win 64, I installed apache, php etc. Everything works fine, except the oracle part. I can connect to oracle from sql developer which means my tnsnames.ora file is correct. When apache starts, there are no errors in the logs. But when I try to connect to oracle from my database, oracle module php_oci8.dll is not loaded. What am I ...

SQL join with Kohana ORM

I'm using Kohana 3.0.6 with ORM. I have a model named "truck" and in his table there's a column with the id of his maker ("maker"). Then I have the "maker" model with the id and the name in his table. I'm trying to do a simple LEFT-JOIN when I display the listing of the trucks so I can get directly the names of their maker. Here is my...

Mysql select order by acts like a string, not a number

How do you order by number if your number can fall below and be bigger than 0? Example Mysql table: |Name|Karma| __________ |Me | -8 | |Bill| 5 | |Tom | 2 | |Saly| 0 | |San.| -3 | Example select query $sql="SELECT karma FROM table ORDER BY karma DESC"; The result I get is this (separated by comma): 5,2,0,-8,-3. Shouldn't...

cache problem jquery

I have a fancybox, and for some reason it gets cached. My current problem is layout this way. I have main index page, where I have a link. Clicking on the link open the jquery fancybox. The fancybox is actually opening the page called data.php. That page has a drop down that is populated through the database column. So when I change some...

PHP script can't open a file when called from a perl script.

I have an interesting situation where I have a perl watcher script (using Linux::Inotify2) watch for files to be dropped in a certain directory, then hand them off to a PHP script for processing. The watched directory and the files in it are not owned by the user the watcher script is running under, but the entire directory tree the fil...

PHP: Values returned by ref from functions seems to get copied on multiple assignments

When a value being returned from a function by ref is assigned to multiple variables, assignments after the first one seems to copy the value. The code I used to test it is: root@kelso:/tmp# php -r 'function &bar() {static $x; if (NULL === $x) {$x=range(1,99999);}; return $x;}; var_dump(memory_get_usage()); bar(); var_dump(memory_get_...

MySQL regex replace?

I've got a table with blob text fields. This blob has a lot of html in it. One of the pieces of html is an h2. I would like to find all instances of a word in the h2 tag, and replace it with another word (while leaving other words the same). For example, I would like to replace the h2 "wiggles" with "bumbles" in the following: Before: ...

How can I properly replace a cached item using APC?

I have a setup that uses a method called update in a cache class. It simply creates an array using a key-value pair. For example, if I do $cache->update('cache_key', 'array_key', 'array_value');, that will result in an array a key as array_key with a value of array_value. If I then issue another update using the same cache key, but a dif...

Using single 'smart quote' in my JSON data is breaking PHP script

Hi folks, I've got a PHP script that is reading in some JSON data provided by a client. The JSON data provided had a single 'smart quote' in it. Example: { "title" : "Lorem Ipsum’s Dolar" } In my script I'm using a small function to get the json data: public function getJson($url) { $filePath = $url; $fh = fopen...

Cookie not setting in PHP

Thought this was super easy, but I've spent the last half hour trying to figure it out to no avail. $unique_id = uniqid(microtime(),1); if (is_null($_COOKIE['client_id'])) { setcookie("client_id", $unique_id); } But when I go to check the cookie through $_COOKIE['client_id'], I get a null value. Any ideas whats going on? ...

PHP Captcha code problem?

It was working great yesterday,.. and now. .. it isn't.. ??? <?php session_start(); if(isset($_POST["captcha"])) { if(($_SESSION['captcha_code'] == $_POST['captcha']) && (!empty($_SESSION['captcha_code'])) ) { //Passed! $captcha_msg="Thank you"; }else{ // Not passed 8-( $captcha_msg="*** invalid image code, please put the righ...

How to handle a dynamic table with dojo.query()

Hi, This is going to be a meaty question because I am not sure the best way to handle this. I have a page that contains a number of dojo inline editors, to allow users to change values, when one entry had been changes a save button will appear to prompt the user to save the information. The page has a number of rows, contained within ...

Does md5_file have a memory limit/timeout for remote files?

I've been trying to hash the contents of some zip files from a remote source using PHP's md5_file function: md5_file($url); I'm having a problem with a couple of URLs; I'm getting the following error: Warning: md5_file($url): failed to open stream: HTTP request failed! I think it's because the zip files are quite large in those cas...

How do I prevent site scraping?

I have a fairly large music website with a large artist database. I've been noticing other music sites scraping our site's data (I enter dummy Artist names here and there and then do google searches for them). How can I prevent screen scraping? Is it even possible? ...