php

PHP: illegal session id

Possible Duplicate: Session hijacking or attack? Lately I am receiving following error on my site PHP Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' This error occurs on this line session_start() does anybody have idea why its happening? Tha...

Forced download stopped working

I have a php script that I have used for years to force downloads from my website. But sometime in the last month or so, it stopped working and is triggering file not found errors. The weird thing is that in firefox, if I do view source on the error page, it is the file I was trying to download. And doing File > Save from there give you ...

jQuery submit ajax form with 2 submit buttons

im trying to achieve the following, in php i have a form like this: <form method="post" id="form_1" action="php.php"> <input type="submit" value="add" name="sub"/> <input type="submit" value="envoi" name="sub"/> </form> the form action file is: <?php if( $_POST["sub"]=="add"){ ?> <script> alert("") </script> <?php echo "ZZZZZ...

url routing from root with index.php and htaccess in sub-directory

I'd like to know if it is possible to do this: To keep the root clean of all files, I want to put everything under a sub-directory (index.php, .htaccess,...). Is it possible to configure a rule in .htaccess which resides in this sub-directory to redirect from root directory to index.php which also resides in the sub-directory ? Then wh...

what is the fastest method to check if given array has array or non-array or both values?

We gave a given array which can be in 4 states. array has values that are: only arrays only non-arrays both array and non array array has no values ...

Is there a way to put this PHP into an array and simplify it?

Hi, The following code loads all .php files found in the specified folder (defined separately). Is there a way to put this into an array to simplify the code? Only a couple of variables change but essentially the code repeats several times. // The General Files $the_general = opendir(FRAMEWORK_GENERAL); while (($the_general_files = ...

How to %-sign in php string

Hi i need to remove % sign from file or image name in directory which string i use $oldfile = "../wallpapers/temp-uploaded/".$file ; $newfile = "../wallpapers/temp-uploaded/". trim( str_replace('%', '', $file)); rename("$oldfile","$newfile"); But its not work reply me which string i use ( trim, str_replace not work preg_replace ho...

Magento images not displaying in front end

Hi, I can see images in the back end. On the front end of the catalog, no images appear for products, just the default "Image Not Found" icon. Images definitely exist, e.g. media/catalog/product/f/o/foo.jpg They also appear to be correct in MySQL: | 4 | 77 | 248 | /f/o/foo.jpg | I've cleared all...

Non-threadsafe source for PHP?

How I get the non-threadsafe source for PHP? The only download link I found on windows.php.net/download was http://windows.php.net/downloads/releases/php-5.3.2-src.zip and that appears to be the threadsafe code --- or is there some way of telling the source that it's actually non-threadsafe? I have tried putting --disable-zts on the com...

Exploding UpperCasedCamelCase to Upper Cased Camel Case in PHP

The title says it all. Right now, I am implementing this with a split, slice, and implosion: $exploded = implode(' ',array_slice(preg_split('/(?=[A-Z])/','ThisIsATest'),1)); //$exploded = "This Is A Test" Prettier version: $capital_split = preg_split('/(?=[A-Z])/','ThisIsATest'); $blank_first_ignored = array_slice($capital_split,1);...

how to force preg_match preg_match_all to return only named parts of regex expression

example: <?php $string = "This is some text written on 2010-07-18."; preg_match('|(?<date>\d\d\d\d-\d\d-\d\d)|i',$string,$arr_result); print_r($arr_result); ?> returns: Array ( [0] => 2010-07-18 [date] => 2010-07-18 [1] => 2010-07-18 ) but I want it to be: Array ( [date] => 2010-07-18 ) in php's pdo object there ...

Symfony installation problems

I'm trying to set up Symfony on my 64-bit Vista laptop that's using Zend Server CE for an all-in-one PHP stack. I'm trying to configure it with Netbeans as the IDE but I keep getting an error when I try to create a Symfony project; I've pointed it to my PHP.exe file located in C:\Program Files (x86)\Zend\ZendServer\bin\php.exe and my sy...

which database type are good for arrays ?

i want my database to support one company haveing many users how can i do that? exampleusers table(UID,username,password)company table(CID,companyname,usersthatistheownerofthecompany) how can i do that? what should i do ? should i make an array in php like 1241,423,4123 *uid's that will be inserted on usersthatistheownerofthecompany row ...

How do I mark current option as selected?

I have pages like index.php?key=toplist&list=magic So if om on that page for example, i want the Magic option to be marked as selected in the select menu <select name="skill" onchange="window.location.href=this.form.skill.options[this.form.skill.selectedIndex].value"> <option value="index.php?<?=QUERY_STRING?>&list=experience">Experi...

Tokens/points-based access

I was considering using drupal to solve this problem, but not sure if it can be done with drupal. I'm trying to implement access to content through points. If the user does not have sufficient points, they should not be able to access the content and as they access content, points get removed from their existing points Can this be ...

Symfony doctrine data-load segmentation fault

Hi guys, I'm working through the Symfony Jobeet tutorial and am getting a segmentation fault when trying to load data from my fixtures files. PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli), S symfony version 1.4.5 I'm using the Doctrine plugin. My fixtures below: /data/fixtures/categories.yml JobeetCategory: design: name:...

How to dynamically change data in the HTML textarea or text field with php?

I will have a web-application which will use a few complex forms. One form will have examples field on the top and field for user on the bottom. There will be approximately 10 examples. It will be great if i can change text and images without reloading full HTML page. Form will be based on HTML. Php will do all logic processes. I haven'...

Help converting PHP functions to c#?

Hi, I have been using the encryption class of codeigniter (PHP framework) for a while and need to convert these functions in PHP to C#. This is so that my c# application can decrypt the data on my website database and vise versa. The problem is that I have recently started with c# so dont really know the function names that would do t...

Execute Python program using PHP

Hi, Can I simply execute Python program using PHP like this? (in a browser) exec("python myProgram /Applications/MAMP/htdocs/somefile.xml"); or like this: exec("/path/to/python path/to/myProgram /Applications/MAMP/htdocs/somefile.xml"); Is any of this method correct? If not, what should be the right way to do it? Thanks ...

Does PHP flush work with jQuerys ajax?

Hi I have created a page in which I use the PHP function flush(), to output data to the browser the second the data is echoed. I'm also calling this page using jQuery's ajax function. It works, but jQuery doesn't output anything until the entire page has executed, which kind of removes the functionality of flush(). How can I fix this? ...