[PHP] Query - Warning: Cannot modify header information
Hi friends, i am currently redesign th x-cart site. ichanged the template files into my concern. i received some warnings like this.. Warning: Cannot modify header information - headers already sent by (output started at /home/gift1/public_html/home.php:2) in /home/gift1/public_html/referer.php on line 61 The images in the database also not displayed.but, i didnot change anything in the image.php. how can i solve this .i need help asap - Yahoo! India Matrimony: Find your partner now.
Re: [PHP] PHP 5 Hosting
This is an interesting one. As someone learning PHP, I am still confused which route I should be going down? Especially as I am looking to take on a dedicated server soon, I don't know if PHP5 will become standard soon or are we going to see PHP6 first??!? Please can some more experienced people let me have their views on this? Many thanks,# Tom On 30/09/05, Joe Wollard [EMAIL PROTECTED] wrote: The first two results both seem pretty good at a glance: http://www.google.com/search?hl=enq=php5+ssh+hostingbtnG=Google+Search On Sep 29, 2005, at 8:29 PM, Ed Lazor wrote: Any recommendations on good host providers for PHP 5? Bonus points if they support SSH access and a PHP compiler like Zend. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Chubb [EMAIL PROTECTED] 07915 053312 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Query - Warning: Cannot modify header information
i checked the line before 61... it sends the image content type this is the code of image.php ?php /*\ +-+ | X-Cart | | Copyright (c) 2001-2005 Ruslan R. Fazliev [EMAIL PROTECTED] | | All rights reserved.| +-+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE COPYRIGHT | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as THE AUTHOR) IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE SOFTWARE). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, YOU) ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOUARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTSPROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2005 | | Ruslan R. Fazliev. All Rights Reserved. | +-+ \*/ # # $Id: image.php,v 1.28.2.1 2005/01/12 07:41:42 svowl Exp $ # # Show image by productid # require ./top.inc.php; require ./config.php; if (empty($productid)) $productid = ; $image_out = ; $image_type = ; $image_path = ; if (!empty($tmp)) { x_session_register(file_upload_data); if (!empty($file_upload_data[file_path]) $file_upload_data[id]==$productid $file_upload_data[imtype]==T) { $image_out = func_file_get($file_upload_data[file_path], true); } } if (empty($image_out)) { if(!empty($variantid)) $result = db_query(SELECT image, image_path, image_type FROM $sql_tbl[thumbnails] WHERE productid='$productid' AND variantid = '$variantid'); if(empty($result)) $result = db_query(SELECT image, image_path, image_type FROM $sql_tbl[thumbnails] WHERE productid='$productid' AND variantid = ''); if (db_num_rows($result)) list($image, $image_path, $image_type) = db_fetch_row($result); else { header(Content-type: image/gif); func_readfile($default_image, true); exit; } db_free_result($result); if ($config[Images][thumbnails_location] == DB) { if (!empty($image)) $image_out = $image; else $no_image_db = true; } if ($config[Images][thumbnails_location] == FS || !empty($no_image_db)) { if (!empty($image_path)) { header(Content-type: $image_type); func_readfile($image_path, true); exit; } } } if (!empty($image_out)) { header(Content-type: $image_type); echo $image_out; } else { header(Content-type: image/gif); func_readfile($default_image, true); } ? plz check it and give some valuable sugguesion to me. thanks.. George Pitcher [EMAIL PROTECTED] wrote: This looks as though you are trying to send header() after something has been output to screen. Check your code before line 61. George -Original Message- From: Suresh Pandian [mailto:[EMAIL PROTECTED] Sent: 30 September 2005 7:47 am To: php-general@lists.php.net Subject: [PHP] Query - Warning: Cannot modify header information Hi friends, i am currently redesign th x-cart site. ichanged the template files into my concern. i received some warnings like this.. Warning: Cannot modify header information - headers already sent by (output started at /home/gift1/public_html/home.php:2) in /home/gift1/public_html/referer.php on line 61 The images in the database also not displayed.but, i didnot change anything in the image.php. how can i solve this
[PHP] Re: File Upload Max Size
On Fri, 30 Sep 2005 01:19:01 -0400, wrote: Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. Don't want to depress you but I've had experience of other problems eg browser timeout -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about Rasmus' 30 second AJAX Tutorial
xfedex wrote: I did the Rasmus' 30 second AJAX Tutorial just for testing and everything works fine, by the way... thanks Rasmus, for this and for all !!. My little script have a single input and for every keystroke (calling the javascript function with onkeyup) the value of the input is parsed by another php script that just return the lenght of the string. So, if I start typing the word hello, when i press the h key it displays 1, for ho it displays 2 and so onvery simple, just for testing. But (theres always a but!!) it seems that only work if I call the function sndReq(); with onkeyup. If I call the function from a onsubmit it returns...nothing!. Then alert('response:'+http.responseText); it's EMPTY. Im absolutely sure that the difference between the two scripts is that the one that works is the onkeyup, and the one that not is the onsubmit. So, anybody knows why this is happening? What do you return from the onsubmit? If the onsubmit code evaluates to true then the form will be submitted causing the page source to change which would cause unpredictable results for the AJAX response depending on several race conditions. Can I suggest you let us see the whole form so we can see exactly what the onsubmit code does. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about Rasmus' 30 second AJAX Tutorial
xfedex wrote: Hi, I did the Rasmus' 30 second AJAX Tutorial just for testing and everything works fine, by the way... thanks Rasmus, for this and for all !!. My little script have a single input and for every keystroke (calling the javascript function with onkeyup) the value of the input is parsed by another php script that just return the lenght of the string. So, if I start typing the word hello, when i press the h key it displays 1, for ho it displays 2 and so onvery simple, just for testing. But (theres always a but!!) it seems that only work if I call the function sndReq(); with onkeyup. If I call the function from a onsubmit it returns...nothing!. Then alert('response:'+http.responseText); it's EMPTY. Im absolutely sure that the difference between the two scripts is that the one that works is the onkeyup, and the one that not is the onsubmit. So, anybody knows why this is happening? I'm guessing that trhe onclick and onsumbit handlers you set are hanging on a 'submit' type input? .. if so the form is submitting - in whcih case the AJAX request will arrive back at your page - and the page won't be there (so to speak). try changing your onsubmit to something like: input type=submit value=submit onclick=myAjaxFunction(); return false;/ the return false tells the browser block form submission.. the same technique is used to validate forms and stop submission in case of errors (in such cases the boolean return is conditional e.g.: input type=submit value=submit onsubmit=return myValidationFunction();/ Sorry about my english (I'm from the third world ;) ) whatever happened to the 'second world'? and since when is it a competition? ;-) Regards, (from Argentina) Federico. I find a lot of this AJAX stuff a bit of a hype. Lots of people have been using similar things long before it became AJAX. And it really isn't as complicated as a lot of people make it out to be. Here is a simple example from one of my apps. First the Javascript: function createRequestObject() { var ro; var browser = navigator.appName; if(browser == Microsoft Internet Explorer){ ro = new ActiveXObject(Microsoft.XMLHTTP); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'rpc.php?action='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } This creates a request object along with a send request and handle response function. So to actually use it, you could include this js in your page. Then to make one of these backend requests you would tie it to something. Like an onclick event or a straight href like this: a href=javascript:sndReq('foo') [foo]/a That means that when someone clicks on that link what actually happens is that a backend request to rpc.php?action=foo will be sent. In rpc.php you might have something like this: switch($_REQUEST['action']) { case 'foo': /* do something */ echo foo|foo done; break; ... } Now, look at handleResponse. It parses the foo|foo done string and splits it on the '|' and uses whatever is before the '|' as the dom element id in your page and the part after as the new innerHTML of that element. That means if you have a div tag like this in your page: div id=foo /div Once you click on that link, that will dynamically be changed to: div id=foo foo done /div That's all there is to it. Everything else is just building on top of this. Replacing my simple response id|text syntax with a richer XML format and makine the request much more complicated as well. Before you blindly install large AJAX libraries, have a go at rolling your own functionality so you know exactly how it works and you only make it as complicated as you need. Often you don't need much more than what I have shown here. Expanding this approach a bit to send multiple parameters in the request, for example, would be really simple. Something like: function sndReqArg(action,arg) { http.open('get', 'rpc.php?action='+action+'arg='+arg); http.onreadystatechange = handleResponse; http.send(null); } And your handleResponse can easily be expanded to do much more interesting things than just replacing the contents of a div. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Auto unzip uploaded file
I know a script (it's a webgallery) where you upload your images.zip with any amount of images in it. After uploading the .zip get unzipped and the images will be placed into the gallery. How did they unzip (or better, how is it possible to unzip) the file with php? and is it possible to extract let's say .rar or any other common format as well? thanks for your suggestions, norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wiki Filesystem integration
Hi Folks Anyone here have any experience with integrating Filesystem documents and Wikis? One of our depts uses a wiki(phpwiki) for docs, whilst the other uses a network drive. Anyone here have any experience in consolodating something like this into one interface? Thanks Rory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto unzip uploaded file
Norbert Wenzel wrote: I know a script (it's a webgallery) where you upload your images.zip with any amount of images in it. After uploading the .zip get unzipped and the images will be placed into the gallery. How did they unzip (or better, how is it possible to unzip) the file might I suggest you take a peek at the 'webgallery's code? ..and read here: http://php.net/manual/en/ref.zlib.php http://php.net/zip http://php.net/manual/en/ref.rar.php http://php.net/manual/en/ref.lzf.php http://php.net/manual/en/ref.bzip2.php with php? and is it possible to extract let's say .rar or any other common format as well? anything is possible. how much money do you have? thanks for your suggestions, norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array within array
Greetings PHP community, I have a CSV text file which I need to use to update existing DB records. So I have the following : $array_file = file(path/to/file); file() creates an array comprising each line of the file, but if each line contains 20 or so CS values, how do I go about reading each line and updating the db. Pseudo code : = $array_file = file(path/to/file); while (explode(',',$file_array)) { do update on db for each line of array } = Any pointers ? -- Chris Blake Cell: 082 775 1492 Work: +27 11 880 2825 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] Immortality -- a fate worse than death. -- Edgar A. Shoaff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto unzip uploaded file
Jochem Maas wrote: Norbert Wenzel wrote: I know a script (it's a webgallery) where you upload your images.zip with any amount of images in it. After uploading the .zip get unzipped and the images will be placed into the gallery. How did they unzip (or better, how is it possible to unzip) the file might I suggest you take a peek at the 'webgallery's code? I would if i could, but they don't want't me to see their code, so I have to rewrite it myself. ..and read here: http://php.net/manual/en/ref.zlib.php http://php.net/zip http://php.net/manual/en/ref.rar.php http://php.net/manual/en/ref.lzf.php http://php.net/manual/en/ref.bzip2.php Thanks, I'll read that. with php? and is it possible to extract let's say .rar or any other common format as well? anything is possible. how much money do you have? Let's say time is money so I guess I'm quite rich... thanks for your suggestions, norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing non GET/POST request methods to php script do not work on RH based linux
no one answered me so i'm answering myself php.ini has a directive called allow_webdav_methods that is by default off. changing this directive do not work on php 4.3.2 as written at http://il.php.net/ini.core (didn't really understood what they ment there by This directive does not exist as of PHP 4.3.2... (new feature / old feature / bug??) so I also updated to php4.4.0 using cheetahweb rpms from http://mirror.cheetaweb.com/redhat/3ES/i386/RPMS.cheeta/ Happy New Year (The Jewish new year starts next week..) --Y Yedidia Klein wrote: I've a simple php script (see below) that write to a file the REQUEST METHOD that was used while calling this script. means that when I use a browser to access this script, it write to the file GET. The problem starts while I try for example to send an OPTIONS request to this script (using a simple perl script that I wrote and is attached) while trying on RH based linuxes the request get to the apache logs but not to the php script (means my script do not write anything to its file but while trying on Debian based linuxes - the script *do* get all requests... I tried to compare the apache conf files and php.ini files w/o success... any idea how to set php (or apache) to pass these requests to my script ?? tnx, --Y the scripts: req.pl #!/usr/bin/perl use HTTP::Headers; use LWP::UserAgent; my $request = new HTTP::Request( 'OPTIONS'=http://cc.jct.ac.il/method/; ); my $ua = new LWP::UserAgent; my $response = $ua-request($request) || return ERROR\t$!; print $response-server; --- method.php ?php $filename = '/var/www/html/method/method.log'; $somecontent = $_SERVER[REQUEST_METHOD].\n; // Let's make sure the file exists and is writable first. #if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo Cannot open file ($filename); exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo Cannot write to file ($filename); exit; } echo Success, wrote ($somecontent) to file ($filename); fclose($handle); ?
[PHP] Re: Passing non GET/POST request methods to php script do not work on RH based linux
could be problem of apache configuration ? is there directives like 'limit' in your apache config file? On 9/30/05, Yedidia Klein [EMAIL PROTECTED] wrote: no one answered me so i'm answering myself php.ini has a directive called allow_webdav_methods that is by default off. changing this directive do not work on php 4.3.2 as written at http://il.php.net/ini.core (didn't really understood what they ment there by This directive does not exist as of PHP 4.3.2... (new feature / old feature / bug??) so I also updated to php4.4.0 using cheetahweb rpms from http://mirror.cheetaweb.com/redhat/3ES/i386/RPMS.cheeta/ Happy New Year (The Jewish new year starts next week..) --Y Yedidia Klein wrote: I've a simple php script (see below) that write to a file the REQUEST METHOD that was used while calling this script. means that when I use a browser to access this script, it write to the file GET. The problem starts while I try for example to send an OPTIONS request to this script (using a simple perl script that I wrote and is attached) while trying on RH based linuxes the request get to the apache logs but not to the php script (means my script do not write anything to its file but while trying on Debian based linuxes - the script *do* get all requests... I tried to compare the apache conf files and php.ini files w/o success... any idea how to set php (or apache) to pass these requests to my script ?? tnx, --Y the scripts: req.pl #!/usr/bin/perl use HTTP::Headers; use LWP::UserAgent; my $request = new HTTP::Request( 'OPTIONS'=http://cc.jct.ac.il/method/; ); my $ua = new LWP::UserAgent; my $response = $ua-request($request) || return ERROR\t$!; print $response-server; --- method.php ?php $filename = '/var/www/html/method/method.log'; $somecontent = $_SERVER[REQUEST_METHOD].\n; // Let's make sure the file exists and is writable first. #if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo Cannot open file ($filename); exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo Cannot write to file ($filename); exit; } echo Success, wrote ($somecontent) to file ($filename); fclose($handle); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server Time Out
Hi, I'm new to this newsgroup and I'm psyched I found it. But, my newsreader (Thunderbird), keeps returning a Connection to server news.php... has timed out when ever I try to dload or refresh the messages. Anyone have a suggestions on what I can do? I'm assuming it's just a setting I need to change? Thanks for your help, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Upload Max Size
Well, I would like to at least be able to upload a 10mb - 15mb file. I don't need it to upload files that are HUGE, just a reasonable size. zzapper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 30 Sep 2005 01:19:01 -0400, wrote: Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. Don't want to depress you but I've had experience of other problems eg browser timeout -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query - Warning: Cannot modify header information
Months ago when I kept encountering that problem, it was due to this. Suresh, in /home/gift1/public_html/home.php, do you have a space, an empty line, etc. ? that file should start with ?PHP NOT ?PHP or ?PHP I put double quotes to emphasize that there should be NOTHING before the PHP script start. -Mk Suresh Pandian wrote: Hi friends, i am currently redesign th x-cart site. ichanged the template files into my concern. i received some warnings like this.. Warning: Cannot modify header information - headers already sent by (output started at /home/gift1/public_html/home.php:2) in /home/gift1/public_html/referer.php on line 61 The images in the database also not displayed.but, i didnot change anything in the image.php. how can i solve this .i need help asap - Yahoo! India Matrimony: Find your partner now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array within array
?php $array_file = file(path/to/file); foreach($array_file as $line) { $e_array = explode(',',$line); { // do update on db for each line of array } } ? Like this? Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server Time Out
?php set_time_limit(0); // the rest of the code... ? That should work! Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query - Warning: Cannot modify header information
You can simply avoid that by buffering the output: ?php ob_start(); // your code // ... ob_end_flush(); ? or (older versions of PHP): ?php ob_start(); // your code // ... echo ob_get_contents(); ? Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array within array
I would do something like $fp = fopen($file_location, 'r'); while (!$fp) { $csv_line = fgetcsv($fp); //insert line into database here after appropriate validation and cleaning } On Fri, 30 Sep 2005 06:29:11 -0400, Chris [EMAIL PROTECTED] wrote: Greetings PHP community, I have a CSV text file which I need to use to update existing DB records. So I have the following : $array_file = file(path/to/file); file() creates an array comprising each line of the file, but if each line contains 20 or so CS values, how do I go about reading each line and updating the db. Pseudo code : = $array_file = file(path/to/file); while (explode(',',$file_array)) { do update on db for each line of array } = Any pointers ? -- Chris Blake Cell: 082 775 1492 Work: +27 11 880 2825 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] Immortality -- a fate worse than death. -- Edgar A. Shoaff -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array within array
On Fri, 2005-09-30 at 15:33, Emil Novak wrote: ?php $array_file = file(path/to/file); foreach($array_file as $line) { $e_array = explode(',',$line); { // do update on db for each line of array } } ? Like this? Hi Emil, That`s exactly how I figured it out eventuallysometimes you just need to step away from the monitor and take a break before the answer slaps you on the forehead... :) Thanks -- Chris Blake Cell: 082 775 1492 Work: +27 11 880 2825 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] If a camel flies, no one laughs if it doesn't get very far. -- Paul White -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server Time Out
Kevin Cloutier wrote: Hi, I'm new to this newsgroup and I'm psyched I found it. But, my newsreader technically this is a mailing list ;-) personally I just subscribe to the list with my email addr and get all the posts sent to me ... I never really got the hang of the newsgroup concept. http://list.php.net and select php-generals (I use Thunderbird also - never used it's newsreader functionality tho) (Thunderbird), keeps returning a Connection to server news.php... has timed out when ever I try to dload or refresh the messages. probably you should not be using news.php.net as your source, try a downstream news server? Anyone have a suggestions on what I can do? I'm assuming it's just a setting I need to change? it usually is - ever noticed how it can take months to find the single (**$($!)ing little switch that you need to toggle to get something up and running again. :-) Thanks for your help, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto unzip uploaded file
On 9/30/05, Norbert Wenzel [EMAIL PROTECTED] wrote: I know a script (it's a webgallery) where you upload your images.zip with any amount of images in it. After uploading the .zip get unzipped and the images will be placed into the gallery. How did they unzip (or better, how is it possible to unzip) the file with php? and is it possible to extract let's say .rar or any other common format as well? thanks for your suggestions, norbert You might like to take a look at this: http://www.phpconcept.net/pclzip/index.en.php I've had great success with it - both extracting files and creating zips.
Re: [PHP] Question about Rasmus' 30 second AJAX Tutorial
On 9/30/05, Jochem Maas [EMAIL PROTECTED] wrote: I'm guessing that trhe onclick and onsumbit handlers you set are hanging on a 'submit' type input? .. if so the form is submitting - in whcih case the AJAX request will arrive back at your page - and the page won't be there (so to speak). try changing your onsubmit to something like: input type=submit value=submit onclick=myAjaxFunction(); return false;/ the return false tells the browser block form submission.. the same technique is used to validate forms and stop submission in case of errors (in such cases the boolean return is conditional e.g.: input type=submit value=submit onsubmit=return myValidationFunction();/ Sorry about my english (I'm from the third world ;) ) whatever happened to the 'second world'? and since when is it a competition? ;-) Ok, its working now... input type=submit value=submit onclick=myAjaxFunction(); return false;/ There was the form submision that was making troubles. Thank you all!! Regards, Fede.
[PHP] php.ini magic quotes
Everyday I scratch my head. In php.ini in the C:\WINNT it is said; ; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = Off ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off In phpinfo() it is said; magic_quotes_gpc On On magic_quotes_runtime Off Off [note the disparity] and get_magic_quotes_gpc() returns a 1 (for 'on') I am having a helluva time escaping single quotes for use with MSSQL because it throws the following error SELECT EPC, Owner, Location, Application, Process, Product, Purchased, Comments FROM intranet.dbo.CustomerRelations WHERE Purchased = '1990\'\'s' ORDER BY EPC DESC Filter=PurchasedFilterKey=1990\'\'s --$_SERVER['QUERY_STRING'] 1 --get_magic_quotes_gpc Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'., SQL state 37000 in SQLExecDirect in E:\fubar\iamscrewed\windowsblows\index.php on line 51 [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'. Slashes are being inserted during the post, but i cannot get them to go away...stripslashes doesn;t work.can anyone help me get rid of the slashes? Or should I just go for a nice motorcycle ride in the Hill Country? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] decrypting query string back into $_GET['var']
So is this the best/safest way within reason ? //-- // 'Sending' PHP script: require_once(/home/includes/encryption.inc); $str =encrypt(urlencode(movie=mymovie.movmask=mask.gifdrag=drag.gif)); $urlString = $pathtoReceivingScript.$str ; //-- // 'Receiving' PHP script: require_once(/home/includes/encryption.inc); $str =$_SERVER['QUERY_STRING']; parse_str(urldecode(decrypt($str)),$getVarArray); $movie = $getVarArray['movie']; $mask = $getVarArray['mask']; $drag = $getVarArray['drag']; //echo $movie,$mask,$drag; //-- // Encryption.inc // Encrypt function encrypt($encrypt) { $key = 6r9qEJg6; srand((double) microtime() * 100); //for sake of MCRYPT_RAND $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt, MCRYPT_MODE_ECB, $iv); $encode = base64_encode($passcrypt); return $encode; } // Decrypt function decrypt($decrypt) { global $key; $key = 6r9qEJg6; $decoded = base64_decode($decrypt); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $decoded, MCRYPT_MODE_ECB, $iv); return $decrypted; } On Sep 29, 2005, at 9:33 AM, Jochem Maas wrote: Graham Anderson wrote: What is the best way to decrypt a query string back into variables ? $root = http://www.myserver.com/script.php;; $queryString = ?test=mytestcolor=red; myEncrypt($queryString); //add mCrypt encryption $finalURL = $root.$encryptedQueryString; what is the proper what to decrypt the GET variables on the other side ? Do you need to decrypt the query string first ? yes - if you have a query string like 4509134534068953534875104584437043134081743 or whatever then php won't turn it into a $_GET var. although your query string could contain 's and/or ?'s and/or ='s in which case you might have cruft in the $_GET array which you would want to clean out before extracting your decrypted string into $_GET .. decrypt($_SERVER['QUERY_STRING']); Once you have decrypted it, can you pass it along to a $_GET as you would with an unencrypted query string ? $test = $_GET['test']; Or, do you need to parse the string to extract variables? yes you do, but this being php - there is a function that will do it for you :-) http://php.net/parse_str many thanks g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini magic quotes
Jay Blanchard wrote: Everyday I scratch my head. In php.ini in the C:\WINNT it is said; ; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = Off ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off In phpinfo() it is said; where does it say it read the ini file from? is there a .htaccess equivelant setting somewhere in the ISS server [your new job in a windows shop] turning magic_quotes_gpc on (for the given 'vhost')? (I use apache terminology - I trust your savvy enough to translate them to ISSspeak :-) magic_quotes_gpc On On magic_quotes_runtime Off Off [note the disparity] and get_magic_quotes_gpc() returns a 1 (for 'on') I am having a helluva time escaping single quotes for use with MSSQL because it throws the following error SELECT EPC, Owner, Location, Application, Process, Product, Purchased, Comments FROM intranet.dbo.CustomerRelations WHERE Purchased = '1990\'\'s' ORDER BY EPC DESC Filter=PurchasedFilterKey=1990\'\'s --$_SERVER['QUERY_STRING'] 1 --get_magic_quotes_gpc Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'., SQL state 37000 in SQLExecDirect in E:\fubar\iamscrewed\windowsblows\index.php on line 51 [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'. Slashes are being inserted during the post, but i cannot get them to go can you so a hack with 'magic_quotes_sybase' ini setting? (turn it on) see here: http://nl2.php.net/sybase away...stripslashes doesn;t work.can anyone help me get rid of the what exactly isn't working? something like this does do it for you?: /** * array_stripslashes() * * stripsslashes from each value found in the given array, * and recurses if a value is itself an array. * this function is used to 'transform' request superglobals into * 'form' that is consistent regardless of server settings. (magic quotes, etc) * * @return array() */ function array_stripslashes($array) { if(!is_array($array)); while (list($key) = @each($array)) { if (is_array($array[$key])) { array_stripslashes($array[$key]); } else { $array[$key] = stripslashes($array[$key]); } } } /* setup the env the way we like it. */ set_magic_quotes_runtime(0);// Disable magic_quotes_runtime if (get_magic_quotes_gpc()) { // stripslashes if they were auto added array_stripslashes( $_POST ); array_stripslashes( $_GET ); array_stripslashes( $_REQUEST ); array_stripslashes( $_COOKIES ); array_stripslashes( $_HTTP_POST_VARS); array_stripslashes( $_HTTP_GET_VARS ); array_stripslashes( $_HTTP_COOKIES_VARS ); } slashes? Or should I just go for a nice motorcycle ride in the Hill Country? If you have hills I'd say take an mtb. :-) I like mtb'ing - but I live in a country -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing for an empty array (with null values)
Hi, I can use if (count($somearray) 0) to test for an empty array. It is possible to have an array with null values which is effectively empty but fails the above as it's count (I belive is greater than 0). Any ideas -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Upload Max Size
On Fri, 30 Sep 2005 08:42:28 -0400, wrote: Well, I would like to at least be able to upload a 10mb - 15mb file. I don't need it to upload files that are HUGE, just a reasonable size. zzapper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 30 Sep 2005 01:19:01 -0400, wrote: Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. In php,ini ; Maximum allowed size for uploaded files. upload_max_filesize = 2M -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Testing for an empty array (with null values)
Better use is empty(), which supports array as parameter: $test = array(); if(empty($test)) // true { // code... } else // false { } Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array: If i'm in the child array then how I tell the parent's key name..
Suppose that I'm in a child array and I wanna know how do I tell what key is the parent's level, one level up... For example, --snip-- $arr['ABC']['DEF']; --snip-- Let's say the child is DEF then the key name one level up would be ABC. How do I determine the one level up? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array: If i'm in the child array then how I tell the parent's key name..
Let me reply with a question first :) how do you get *to* the child? ;) post some code so we know. In 99.99% of the cases, the way you get to the child includes a way to find out the parent key (usually you foreach() to it, or something similair). - tul Scott Fletcher wrote: Suppose that I'm in a child array and I wanna know how do I tell what key is the parent's level, one level up... For example, --snip-- $arr['ABC']['DEF']; --snip-- Let's say the child is DEF then the key name one level up would be ABC. How do I determine the one level up? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5, $_SESSION, DOM XML objects not returning value
I'm trying to store an array of DOM XML objects (http://www.php.net/manual/en/ref.dom.php) in a PHP5.0.3 $_SESSION array, but when I load the session back (and yes, I've declared my class before the session_start()), I get these errors: Warning: XMLRule::getValue() [function.getValue]: Invalid State Error in /lockdown/includes/classes/rule_xml.class.php on line 74 Or Warning: XMLRule::getValue() [function.getValue]: Invalid State Error in /lockdown/includes/classes/rule_xml.class.php on line 81 And all the VALUES are empty, however *my* XMLRule class array seems right otherwise. It's like PHP didn't serialize all of it's own DOM XML objects (which are built in objects!!!) Here are the pertinent parts of the classes and other code snippets. # class XMLRule { // for example 'is_username' XML tag would set $name = 'Username' protected $name = null; // The reference pointer to the DOMNode, this is a wealth of information in itself. // look at the DOMNode class @ http://www.php.net/manual/en/ref.dom.php protected $DOMNode = null; protected function __construct($DOMNode, $name, $id = null) { $this-DOMNode = $DOMNode; $this-name = $name; $this-id = $id; } //__construct() function getValue() { //check for multiple values, such as a list of names perhaps [#74] if ($this-DOMNode-childNodes-length 1) { foreach ($this-DOMNode-childNodes as $tmpNode) $tmpArray[] = $tmpNode-nodeValue; return $tmpArray; } else [#81] return $this-DOMNode-nodeValue; } } class is_username extends XMLRule { function __construct($DOMNode, $id = null) { parent::__construct($DOMNode, 'Username', $id); } } class is_day extends XMLRule { function __construct($DOMNode, $id = null) { parent::__construct($DOMNode, 'Day', $id); } } ...etc... # // IMPORTANT: You *MUST* declare the class *BEFORE* you call session_start(). // If you run session_start() before the definition of the class, // the session variables of the objects will be corrupted. // http://www.zend.com/phorum/read.php?num=3id=36854thread=36847 require_once('classes/rule_xml.class.php'); if (!isset($_SESSION['ruleArray'])) { $XMLDOC = new DOMDocument(); $XMLDOC-loadXML($xmlstring); $ruleArray = array(); $i = 1; $or = 1; foreach($XMLDOC-firstChild-childNodes as $myNode) { if ($myNode-nodeName == 'and_conditions') { foreach($myNode-childNodes as $cNode) { $key = (string)($cNode-nodeName); //make a new instance of the node name'd class $ruleArray[$or][$i] = new $key($cNode, $i); $i++; } $or++; //begin new OR block } //if and_conditions } //foreach $myNode $_SESSION['ruleArray'] = serialize($ruleArray); } else $ruleArray = unserialize($_SESSION['ruleArray']); I've tried this with the un/serialize and without. PHP5 is supposed to handle that for me, but just in case, I tried it anyways. If I don't use the $SESSION, then things work fine and I have my values. I also tried to do this: $_SESSION['ruleArray'] = $ruleArray; $ruleArray = $_SESSION['ruleArray']; And surprisingly that works (although it doesn't solve my problem). # Upon loading this back, this is what the array looks like in either case (working or not) Array ( [1] = Array ( [1] = is_username Object ( [name:protected] = Username [DOMNode:protected] = DOMElement Object ( ) [id:protected] = 1 ) [2] = is_day Object ( [name:protected] = Day [DOMNode:protected] = DOMElement Object ( ) [id:protected] = 2 ) ...etc... # PHP Version 5.0.3 This program makes use of the Zend Scripting Language Engine: Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.6, Copyright (c) 2003-2004, by Zend Technologies with Zend
RE: [PHP] PHP5, $_SESSION, DOM XML objects not returning value
Are you f'ing kidding me?! http://www.php.net/manual/en/ref.session.php Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object). L A M E !!! This is absurd. There shouldn't be any reason I can't send a reference to another object -- Especially a built in type! UGH. -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Friday, September 30, 2005 3:02 PM To: php-general@lists.php.net Subject: [PHP] PHP5, $_SESSION, DOM XML objects not returning value I'm trying to store an array of DOM XML objects (http://www.php.net/manual/en/ref.dom.php) in a PHP5.0.3 $_SESSION array, but when I load the session back (and yes, I've declared my class before the session_start()), I get these errors: Warning: XMLRule::getValue() [function.getValue]: Invalid State Error in /lockdown/includes/classes/rule_xml.class.php on line 74 Or Warning: XMLRule::getValue() [function.getValue]: Invalid State Error in /lockdown/includes/classes/rule_xml.class.php on line 81 And all the VALUES are empty, however *my* XMLRule class array seems right otherwise. It's like PHP didn't serialize all of it's own DOM XML objects (which are built in objects!!!) Here are the pertinent parts of the classes and other code snippets. ## ## # class XMLRule { // for example 'is_username' XML tag would set $name = 'Username' protected $name = null; // The reference pointer to the DOMNode, this is a wealth of information in itself. // look at the DOMNode class @ http://www.php.net/manual/en/ref.dom.php protected $DOMNode = null; protected function __construct($DOMNode, $name, $id = null) { $this-DOMNode = $DOMNode; $this-name = $name; $this-id = $id; } //__construct() function getValue() { //check for multiple values, such as a list of names perhaps [#74] if ($this-DOMNode-childNodes-length 1) { foreach ($this-DOMNode-childNodes as $tmpNode) $tmpArray[] = $tmpNode-nodeValue; return $tmpArray; } else [#81] return $this-DOMNode-nodeValue; } } class is_username extends XMLRule { function __construct($DOMNode, $id = null) { parent::__construct($DOMNode, 'Username', $id); } } class is_day extends XMLRule { function __construct($DOMNode, $id = null) { parent::__construct($DOMNode, 'Day', $id); } } ...etc... ## ## # // IMPORTANT: You *MUST* declare the class *BEFORE* you call session_start(). // If you run session_start() before the definition of the class, // the session variables of the objects will be corrupted. // http://www.zend.com/phorum/read.php?num=3id=36854thread=36847 require_once('classes/rule_xml.class.php'); if (!isset($_SESSION['ruleArray'])) { $XMLDOC = new DOMDocument(); $XMLDOC-loadXML($xmlstring); $ruleArray = array(); $i = 1; $or = 1; foreach($XMLDOC-firstChild-childNodes as $myNode) { if ($myNode-nodeName == 'and_conditions') { foreach($myNode-childNodes as $cNode) { $key = (string)($cNode-nodeName); //make a new instance of the node name'd class $ruleArray[$or][$i] = new $key($cNode, $i); $i++; } $or++; //begin new OR block } //if and_conditions } //foreach $myNode $_SESSION['ruleArray'] = serialize($ruleArray); } else $ruleArray = unserialize($_SESSION['ruleArray']); I've tried this with the un/serialize and without. PHP5 is supposed to handle that for me, but just in case, I tried it anyways. If I don't use the $SESSION, then things work fine and I have my values. I also tried to do this: $_SESSION['ruleArray'] = $ruleArray; $ruleArray = $_SESSION['ruleArray']; And surprisingly that works (although it doesn't solve my problem). ## ## # Upon loading this back, this is what the array looks like in either case (working or not) Array ( [1] = Array ( [1] = is_username Object ( [name:protected] = Username [DOMNode:protected] = DOMElement Object
Re: [PHP] Re: File Upload Max Size
if you don't have access to php.ini then use ini_set(upload_max_filesize,10M). At 06:29 p.m. 30/09/2005 +0100, zzapper wrote: On Fri, 30 Sep 2005 08:42:28 -0400, wrote: Well, I would like to at least be able to upload a 10mb - 15mb file. I don't need it to upload files that are HUGE, just a reasonable size. zzapper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 30 Sep 2005 01:19:01 -0400, wrote: Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. In php,ini ; Maximum allowed size for uploaded files. upload_max_filesize = 2M -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php