Re: [PHP] RegExp
WeberSites LTD wrote: I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[א-תA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { ^^ ^-- no need for the space given you already have '\s' ^^ ^^--- these brackets need escaping avoid sticking your regexps in double quotes strings - you just end up giving yourself an escaping headache. what is exactly is the goal of the 'limit' you are imposing - wouldn't something like strip_tags() be much easier? } It works well but I'm having problems with the (double quote). If there is a double quote () it fails. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] learning classes not sure how to do this correctly
Macha wrote: I'm not sure if it matters or not, but this is happening on the page that you are sent to from hitting the submit button from the other page...test.php is a form that sends you to test2.php after hitting the submit button and its test2.php page that is having this issue with the $keclass. with that on test2.php if i use var_dump($keclass) i get *'Notice*: Undefined variable: keclass' and *'Fatal error*: Call to a member function on a non-object' on any $keclass - function call witch makes since, but if i try to declare the class in test2.php with var_dump($keclass) i get object(keclass)(0) but i get *Fatal error*: Cannot redeclare class keclass. so i guess that information changes the question down to why is it saying that i am redeclaring $keclass when it hasnt been declared in that page before? is it something do to with test.php when u hit submit and being redirected to test2.php? If this dosnt really make any sense let me know..i have been told serveal times in the past i dont really explain my self well hehe I got as far as determining it was english you were using - then I gave up. seems to sound like you have no idea what an object is, or maybe no idea what the difference between a variable and a class definition - this may be incorrect, but like I said I gave up trying to figure out what you were talking about. why don't you send the code from test2.php Richard Lynch wrote: var_dump($keclass); It's not an object... On Thu, December 14, 2006 9:16 am, [EMAIL PROTECTED] wrote: just starting to get used to classes, trying to figure out what i am doing wrong, i know its going to be something stupid on my part, probably really shouldn't be using a if statement or something heh just doing a basic email verification to make sure its looks like email addy so i take the post to a var PHP Code: $email_address = $_POST['email_address']; run it through this function in my class PHP Code: function check_email($address){ if (ereg('[EMAIL PROTECTED]', $address)) return true; else return false; } and then if true i want it to continue on with the script or error out and quit back to the other page and display the error. so i have tried something like this and stuff similar but get a error Fatal error: Call to a member function on a non-object in PHP Code: if (!$keclass-check_email($email_address)) { $keclass-seterr(555); include('test.php'); exit(); } $keclass-seterr(000); include('test.php'); exit(); the seterr is just a simple thing that takes the number and puts in a session var for latter display... -- 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] google video like site
Robert Cummings wrote: On Thu, 2006-12-14 at 23:40 +0100, Jochem Maas wrote: [EMAIL PROTECTED] wrote: Hi, I applogize if this isn't really related to php-programming, but it's related to php. I'm wondering if anyone knows what program sites like google video or break.com use? is it a software like php-nuke, or phpBB or drupal? They all look pretty much the same, so I'm guessing it's a package they use. Anyone know what it is? or are they all really writing everything from scratch? google video - running on php-nuke - no I don't think so. they write from scratch, with the odd billion dollars lying around they can afford to :-) (also note that youtube was bought by google for something like 1.3 billion dollars - I doubt they were stupid enough to shell out that kind of cash to on a php-nuke install, Why not? It's not the code they want, it's the traffic. You can have the best code in the world and if 0 people visit it, it's pretty worthless to anyone but you. you are right - I was implicitly thinking along the lines that there is no way in hell a php-nuke install could stand up to amount of requests/processing youtube must cope with. there is a good reason that properties like Yahoo (which uses php of course) stick all the heavy lifting code in php extensions written in C. then there is the issue of differentiation - would *you* settle for some generic POS piece of software if you had billions of dollar to invest in build a custom, killer app? okay, sure, everything in software land is eventually comoditized and available as open source eventually, but right now there are no google-video type applications out there that can handle the amount of traffic the mentioned sites handle. there is also the premise that youtube wouldn't be youtube if it were running on php-nuke, for the simple fact it would have been hacked to death. no? oh well time for some work ;-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] google video like site
On Fri, 2006-12-15 at 09:30 +0100, Jochem Maas wrote: Robert Cummings wrote: On Thu, 2006-12-14 at 23:40 +0100, Jochem Maas wrote: I doubt they were stupid enough to shell out that kind of cash to on a php-nuke install, Why not? It's not the code they want, it's the traffic. You can have the best code in the world and if 0 people visit it, it's pretty worthless to anyone but you. you are right - I was implicitly thinking along the lines that there is no way in hell a php-nuke install could stand up to amount of requests/processing youtube must cope with. Definitely not on one computer, but if you offload to say 30 servers, you can probably process 100 million hits per day. Servers are probably cheap compared to their bandwidth costs. there is a good reason that properties like Yahoo (which uses php of course) stick all the heavy lifting code in php extensions written in C. True, but nothing stopping a site like youtube from taking a shoddy app and moving some of the heavy lifting into extensions themselves. then there is the issue of differentiation - would *you* settle for some generic POS piece of software if you had billions of dollar to invest in build a custom, killer app? Probably not, but I know that millions of people everyday settle for Microsoft ;) Some of these people probably have a few spare billion dollars... not me though :| okay, sure, everything in software land is eventually comoditized and available as open source eventually, but right now there are no google-video type applications out there that can handle the amount of traffic the mentioned sites handle. Id on't think the code is the bottleneck, I think the bottle neck is the 200 to 400 terabytes of data youtube transfers everyday. there is also the premise that youtube wouldn't be youtube if it were running on php-nuke, for the simple fact it would have been hacked to death. no? Well, that's definitely a valid point, no argument from me there heheh. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How php works?
On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 13, 2006 12:15 am, Kai Xiang wrote: 1. I heard there is a zend engine inside PHP playing the role as a virtual machine, and PHP excution have 2 step, first compile to opcode and then excute the opcode, so is that means the php are compiled only once per file? or still need to recompile when another request issued to the server? also I heard about the caching extention about php, is it talking about caching the opcode? is't caching the opcode or excute results? how it shares between the requests? There is a Zend Engine inside the guts of PHP, and it does compile to opcode and execute. You can buy or find opcode cache software that will cache the compiled opcode and run that on the next request. Note that the BIG win there is not the compilation, but the hard drive not getting hit to load in the PHP script. Oh, that's interesting to know, is that from certain test of design goals? I suspect this for I thought the most time-consuming work in PHP should be compiling. Refer to the early descussion, because all the thread share the same opcode, so it could save memory usage at the same time, is that true? say if there is a lot of requests at the same time, that could be a lot of memories. is that the design goal? or why not just implement a PHP file cache. 2. Is there some alternative choise except zend engineen, why need a zend engine? for performance advantage or just easy for porting to different platform? The original PHP guts were a hand-crafted parser by Rasmus Lerdorf, who, and this is NOT meant to be pejorative, had no idea what he was doing :-) He didn't know that there were tools out there to write new computer languages, and didn't use them. So his parser was, well, kinda buggy, actually. Ze'ev and Andi gutted the system with a shiny new parser using the pro tools for homework, and ended up being Core PHP Developers by accident. :-) So, that became the Zend Engine, as Ze'ev and Andi's idea of a Good Time is not building PHP websites, but building cool tools to improve the guts of PHP, which is also why they started Zend ( http://zend.com) to sell high-end tools to high-end customers, like the Zend Cache. :) PHP change it's gut to make it more fresh. 3. Take linux apache for example, if compiled as a apache module, and using prefork threading model, for example, if I have 100 process, is that means I have 100 copy of PHP library local data(I assume only one reentrant excutable image) in each process? compare to a worker model, like 10 process and 10 threads in each one process, should it make a difference that we only have 10 copy of PHP library local data ? Yes, but if you don't use prefork, you have some serious thread safety Risks, particularly in the extensions, and most especially in any extensions that aren't getting heavy use already by people trying to push into the threaded environment... Stick with pre-fork unless your testing budget is 10 X your dev budget. I'm not sure if this is the right place to talk about this, anyway, if you know a better place, help me out :) This is probably about as on-topic a post as one can get, though much of the info is out there if you can sift through the junk to find it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
RE: [PHP] Having problem sending XML over HTTP
Hello! Thanx for reminding me that I can use a regular POST as well rather then sending XML over HTTP directly :). Perhaps I was quite tired by then. Anyways I tried that. Unfortunately, it seems POST data is not getting through at all. I sent the same query with GET and it is returned fine. But var_dump on both $_POST and $HTTP_RAW_POST_DATA return empty strings even with a regular POST with Curl. Yes the data is urlencoded. My server is RHEL4 with Plesk 8.x. I got PHP upgraded to PHP 5 yesterday. I know POST requests are working fine through browser. I have tried Opera and IE and both work just fine. So my guess is; it is probably curl causing the problem. Can someone point me to some resource or documentation on this issue? Regards, Nauman Akbar Concise Solutions -Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Friday, December 15, 2006 2:16 AM To: php-general@lists.php.net Subject: RE: [PHP] Having problem sending XML over HTTP -Original Message- From: Nauman Akbar [mailto:[EMAIL PROTECTED] On Behalf Of Nauman Akbar Sent: Thursday, December 14, 2006 3:32 PM To: php-general@lists.php.net Subject: [PHP] Having problem sending XML over HTTP Hello! I picked up an example from Curl section on php.net. I am able to access the remote page fine with a custom header. Unfortunately, I am not able to retrieve the XML I am sending at the remote end. I have tried both $HTTP_RAW_POST_DATA and php://input but neither of them returns anything. I am putting my code below just in case anyone can point out the problem in there. $xmlstr = XML query usernamefff-/username passwordalphanumeric/password functionGetPackageVersion/function /query XML; $header[] = MIME-Version: 1.0 \r\n; $header[] = Content-type: multipart/mixed; boundary=doc \r\n; //$header[] = Accept: text/xml \r\n; $header[] = Content-length: .strlen($xmlstr). \r\n; $header[] = Cache-Control: no-cache; $header[] = Connection: close \r\n\r\n; $header[] = $xmlstr; print(setting urlBR); $request = curl_init(http://mrcod.concisehosting.com/index.php;); print(setting optionsBR); curl_setopt($request, CURLOPT_RETURNTRANSFER, true); curl_setopt($request, CURLOPT_TIMEOUT, 4); curl_setopt($request, CURLOPT_HTTPHEADER, $header); curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'POST'); print(connecting...BR); $response = curl_exec($request); //curl_exec($request); curl_close($request); print($response); I have checked the ini file. Memory reserved for POST is 8M. Moreover, I even tried turning 'always_populate_http_raw_post_data' but it doesn't work. Any one any ideas, I am in real need for help on this. Regards Nauman Akbar Concise Solutions Try this: The code for the sending script: ?php $xmlstr = queryusernamefff-/usernamepasswordalphanumeric/passwordfunct ionGetPackageVersion/function/query; $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, http://example.com/your-accepting-page.php;); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, xmlstr=.urlencode($xmlstr)); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $buffer = curl_exec($ch); curl_close($ch); print_r($buffer); ? -- The code for the receiving script: ?php if(!empty($_POST)) { echo You sent me some data... here is what I received:\n; print_r($_POST); } ? Then open a browser and surf to the sending script. It should print the response from the receiving page. Here is the output: You sent me some data... here is what I received: Array ( [xmlstr] = queryusernamefff-/usernamepasswordalphanumeric/passwordfuncti onGetPackageVersion/function/query ) I tested this and its working (at least on my server). Sorry I don't have the time to tell you what is wrong with your code but it's easier for me to just provide something that works. I hope that helps you, Brad -- 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] Having problem sending XML over HTTP (disregard last message)
Hello again! Please disregard my last message. Thank you Brad for reminding me to use regular POST. I still wish I was able to send a 'text/xml' content type. But this will do and is working great. Regards Nauman Akbar Concise Solutions -Original Message- From: Nauman Akbar [mailto:[EMAIL PROTECTED] On Behalf Of Nauman Akbar Sent: Friday, December 15, 2006 5:25 PM To: 'Brad Fuller'; php-general@lists.php.net Subject: RE: [PHP] Having problem sending XML over HTTP Hello! Thanx for reminding me that I can use a regular POST as well rather then sending XML over HTTP directly :). Perhaps I was quite tired by then. Anyways I tried that. Unfortunately, it seems POST data is not getting through at all. I sent the same query with GET and it is returned fine. But var_dump on both $_POST and $HTTP_RAW_POST_DATA return empty strings even with a regular POST with Curl. Yes the data is urlencoded. My server is RHEL4 with Plesk 8.x. I got PHP upgraded to PHP 5 yesterday. I know POST requests are working fine through browser. I have tried Opera and IE and both work just fine. So my guess is; it is probably curl causing the problem. Can someone point me to some resource or documentation on this issue? Regards, Nauman Akbar Concise Solutions -Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Friday, December 15, 2006 2:16 AM To: php-general@lists.php.net Subject: RE: [PHP] Having problem sending XML over HTTP -Original Message- From: Nauman Akbar [mailto:[EMAIL PROTECTED] On Behalf Of Nauman Akbar Sent: Thursday, December 14, 2006 3:32 PM To: php-general@lists.php.net Subject: [PHP] Having problem sending XML over HTTP Hello! I picked up an example from Curl section on php.net. I am able to access the remote page fine with a custom header. Unfortunately, I am not able to retrieve the XML I am sending at the remote end. I have tried both $HTTP_RAW_POST_DATA and php://input but neither of them returns anything. I am putting my code below just in case anyone can point out the problem in there. $xmlstr = XML query usernamefff-/username passwordalphanumeric/password functionGetPackageVersion/function /query XML; $header[] = MIME-Version: 1.0 \r\n; $header[] = Content-type: multipart/mixed; boundary=doc \r\n; //$header[] = Accept: text/xml \r\n; $header[] = Content-length: .strlen($xmlstr). \r\n; $header[] = Cache-Control: no-cache; $header[] = Connection: close \r\n\r\n; $header[] = $xmlstr; print(setting urlBR); $request = curl_init(http://mrcod.concisehosting.com/index.php;); print(setting optionsBR); curl_setopt($request, CURLOPT_RETURNTRANSFER, true); curl_setopt($request, CURLOPT_TIMEOUT, 4); curl_setopt($request, CURLOPT_HTTPHEADER, $header); curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'POST'); print(connecting...BR); $response = curl_exec($request); //curl_exec($request); curl_close($request); print($response); I have checked the ini file. Memory reserved for POST is 8M. Moreover, I even tried turning 'always_populate_http_raw_post_data' but it doesn't work. Any one any ideas, I am in real need for help on this. Regards Nauman Akbar Concise Solutions Try this: The code for the sending script: ?php $xmlstr = queryusernamefff-/usernamepasswordalphanumeric/passwordfunct ionGetPackageVersion/function/query; $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, http://example.com/your-accepting-page.php;); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, xmlstr=.urlencode($xmlstr)); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $buffer = curl_exec($ch); curl_close($ch); print_r($buffer); ? -- The code for the receiving script: ?php if(!empty($_POST)) { echo You sent me some data... here is what I received:\n; print_r($_POST); } ? Then open a browser and surf to the sending script. It should print the response from the receiving page. Here is the output: You sent me some data... here is what I received: Array ( [xmlstr] = queryusernamefff-/usernamepasswordalphanumeric/passwordfuncti onGetPackageVersion/function/query ) I tested this and its working (at least on my server). Sorry I don't have the time to tell you what is wrong with your code but it's easier for me to just provide something that works. I hope that helps you, Brad -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDO::prepare deallocate PDOStatement::closeCursor()
Hi all, I got 2 questions about PDO: 1. Let's say that I create the following prepared statement: $PDOStatement = $DB_Conn-prepare(INSERT INTO test (name) values (?)); And after 50,000 inserts (with $PDOStatement-execute(array('somevalue'));) I want the database to analyze, compile and optimize it's plan again so it will be more efficient for it's next inserts (actually is that true at all?!?), does repeating the same command will deallocate the prepared statement at the database replace it with the new prepared statement? (new plan). If not, how can I deallocate it then? 2. At the PHP manual of PDOStatement::closeCursor it's written that This method is useful for database drivers that do not support executing a PDOStatement object when a previously executed PDOStatement object still has unfetched rows. If your database driver suffers from this limitation, the problem may manifest itself in an out-of-sequence error.. Anyone know if the PostgreSQL suffer from this problem or not? Thanks a lot in advance, Ben-Nes Yonatan
Re: [PHP] Re: date() and timezone
Hello, But like i said i have lots of scripts inside this folder, is there a way to set something on .htaccess to change the timezone? why? ;-) Because i can't set the timezone for every single script. Inside this folder and subfolders i guess there are about 10,000 scripts. What you were pointed to before + http://us3.php.net/manual/de/ini.php#ini.list ah, now you've gone and made it easy for him :-) Actually i don't have access to php.ini file. Are there any other ways to do this? -- Blog: http://blog.forumdebian.com.br/fernando Contato: http://www.forumdebian.com.br/fernando/contato.php
[PHP] Curl and cookies
Hello, I have just started using curl and i have some question about cookies. The website i'm logging in controls everything using cookies (from login to the actions inside it). Is there a way to store the cookie values into a php session variable ($_SESSION['cookie'])? How do i make curl receive the cookie and store in this variable? How do i make curl send it? Thanks, Fernando. -- Blog: http://blog.forumdebian.com.br/fernando Contato: http://www.forumdebian.com.br/fernando/contato.php
Re: [PHP] Re: date() and timezone
Fernando M. M. wrote: Hello, But like i said i have lots of scripts inside this folder, is there a way to set something on .htaccess to change the timezone? why? ;-) Because i can't set the timezone for every single script. Inside this folder and subfolders i guess there are about 10,000 scripts. that will teach not to use global include files to init your apps. even if you we stuck with editing 10,000 scripts (btw it sounds very fishy to 10,000 scripts with date() calls in them - can anyone say 'code reuse'?) exactly how hard would it be to write something that would go through all those php files and add a single line ( ini_set('date.timezone', 'Europe/Amsterdam'); ) to the top of the script (i.e. just after the first '?php' | '?') ? What you were pointed to before + http://us3.php.net/manual/de/ini.php#ini.list ah, now you've gone and made it easy for him :-) Actually i don't have access to php.ini file. if you RTFM (and I mean actually READ) then you would know that you can set the relevant date related ini settings in a .htaccess file here is the relevant link again: http://php.net/manual/en/ref.datetime.php#ini.date.timezone Are there any other ways to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Curl and cookies
I don't know if you can do what you are asking for, but you could get around it a little bit. In the curl request you specify the cookie file and the cookie jar file. Once you have made your requests, you could read them with file_get_contents() and put that into a $_SESSION variable. You could then put that information back into the cookie file(s) with file_put_contents() [PHP5] -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -Original Message- From: Fernando M. M. [mailto:[EMAIL PROTECTED] Sent: Friday, December 15, 2006 8:07 AM To: php-general@lists.php.net Subject: [PHP] Curl and cookies Hello, I have just started using curl and i have some question about cookies. The website i'm logging in controls everything using cookies (from login to the actions inside it). Is there a way to store the cookie values into a php session variable ($_SESSION['cookie'])? How do i make curl receive the cookie and store in this variable? How do i make curl send it? Thanks, Fernando. -- Blog: http://blog.forumdebian.com.br/fernando Contato: http://www.forumdebian.com.br/fernando/contato.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: date() and timezone
that will teach not to use global include files to init your apps. even if you we stuck with editing 10,000 scripts (btw it sounds very fishy to 10,000 scripts with date() calls in them - can anyone say 'code reuse'?) exactly how hard would it be to write something that would go through all those php files and add a single line ( ini_set('date.timezone', 'Europe/Amsterdam'); ) to the top of the script (i.e. just after the first '?php' | '?') ? Those scripts are uploaded by a lot of people. Unfortunately i can't make all of them change this conf. But now i know that i can change this on .htaccess if you RTFM (and I mean actually READ) then you would know that you can set the relevant date related ini settings in a .htaccess file here is the relevant link again: http://php.net/manual/en/ref.datetime.php#ini.date.timezone Sorry, i have read it but i was reading the portuguese version and it seens like it is not completely translated. Just changed to the english version and NOW i can read it :) Thanks, Fernando. -- Blog: http://blog.forumdebian.com.br/fernando Contato: http://www.forumdebian.com.br/fernando/contato.php
RE: [PHP] Curl and cookies
1. Set option HEADER true for the login part in Curl 2. Take the output of login page, you will notice Set-cookie: name=cookie_value; parametres returned from the header. 3. Preg match or use (explode,str_replace etc) to get those names and values. Prepare them for the next Curl fetch 4. Make a new call to a new page, using the cookies with curl option COOKIE. --aras -Original Message- From: Fernando M. M. [mailto:[EMAIL PROTECTED] Sent: Friday, December 15, 2006 4:07 PM To: php-general@lists.php.net Subject: [PHP] Curl and cookies Hello, I have just started using curl and i have some question about cookies. The website i'm logging in controls everything using cookies (from login to the actions inside it). Is there a way to store the cookie values into a php session variable ($_SESSION['cookie'])? How do i make curl receive the cookie and store in this variable? How do i make curl send it? Thanks, Fernando. -- Blog: http://blog.forumdebian.com.br/fernando Contato: http://www.forumdebian.com.br/fernando/contato.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: date() and timezone
Fernando M. M. wrote: that will teach not to use global include files to init your apps. even if you we stuck with editing 10,000 scripts (btw it sounds very fishy to 10,000 scripts with date() calls in them - can anyone say 'code reuse'?) exactly how hard would it be to write something that would go through all those php files and add a single line ( ini_set('date.timezone', 'Europe/Amsterdam'); ) to the top of the script (i.e. just after the first '?php' | '?') ? Those scripts are uploaded by a lot of people. Unfortunately i can't make all of them change this conf. I was suggesting you write a script to programmatically hack all the files in question, but its a moot point you've seen that there is a sane way of tackling the issue. But now i know that i can change this on .htaccess if you RTFM (and I mean actually READ) then you would know that you can set the relevant date related ini settings in a .htaccess file here is the relevant link again: http://php.net/manual/en/ref.datetime.php#ini.date.timezone Sorry, i have read it but i was reading the portuguese version and it seens like it is not completely translated. Just changed to the english version and NOW i can read it :) ah that explains alot - my advice is always use the english version of the manual if you can, no disrespect to the many hard-working translators out there but there is almost no chance any translation team can keep up the number and frequency of updates to the docs. for the same reason I recommend never using an offline version of the manual unless you have no other choice. Thanks, Fernando. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and connection to mail account
If you want to go the route of inbound mail being processed as it arrives, man smrsh made it simple enough for even me to figure out. On Wed, December 13, 2006 8:17 am, Angelo Zanetti wrote: Dear All. Do u know if its possible with PHP to receive a mail or connect to a mail box and do something with an incomming email ? I see there is that imap_open() but also there are sockets. Basically I need to connect to a mailbox and then when a mail is received it must take that mail and do something with the attachment which I know how to do and is not important to this question. Please maybe advise as to what the best way is and also if you have experienced difficulties with a certain way. Thanks in advance. -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] google video like site
Quoting Robert Cummings [EMAIL PROTECTED]: On Fri, 2006-12-15 at 09:30 +0100, Jochem Maas wrote: Robert Cummings wrote: On Thu, 2006-12-14 at 23:40 +0100, Jochem Maas wrote: I doubt they were stupid enough to shell out that kind of cash to on a php-nuke install, Why not? It's not the code they want, it's the traffic. You can have the best code in the world and if 0 people visit it, it's pretty worthless to anyone but you. you are right - I was implicitly thinking along the lines that there is no way in hell a php-nuke install could stand up to amount of requests/processing youtube must cope with. Definitely not on one computer, but if you offload to say 30 servers, you can probably process 100 million hits per day. Servers are probably cheap compared to their bandwidth costs. there is a good reason that properties like Yahoo (which uses php of course) stick all the heavy lifting code in php extensions written in C. True, but nothing stopping a site like youtube from taking a shoddy app and moving some of the heavy lifting into extensions themselves. then there is the issue of differentiation - would *you* settle for some generic POS piece of software if you had billions of dollar to invest in build a custom, killer app? Probably not, but I know that millions of people everyday settle for Microsoft ;) Some of these people probably have a few spare billion dollars... not me though :| okay, sure, everything in software land is eventually comoditized and available as open source eventually, but right now there are no google-video type applications out there that can handle the amount of traffic the mentioned sites handle. Id on't think the code is the bottleneck, I think the bottle neck is the 200 to 400 terabytes of data youtube transfers everyday. there is also the premise that youtube wouldn't be youtube if it were running on php-nuke, for the simple fact it would have been hacked to death. no? Well, that's definitely a valid point, no argument from me there heheh. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks everyone. By the way I wasn't implying that any of these sites are being run on php-nuke, I was wondering if they're however running on something similar to php-nuke. Just because you tube, google video, break.com and a few other sites all basically look the same and function the same way, so I thought they might be using the same backend code. I'm making a small site for a community that wants the same idea, I was wondering if it's as easy as installing a software, or that I have to write it all from scratch. Thanks again for all your responses. Siavash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] google video like site
siavish... to write a site that handles a few 100 hits/day and has functionality to upload/download/view videos isn't that hard to do. (not including the look/feel, and not including the testing aspect) just throwing a site together isn't that hard. however, if you really want to have a robust/scalable/secure app, capable of handling serious traffic, as well as all the monitoring functionality you want to admin/run the site, and to move/track your data/videos.. .then it's not a simple upload of an app/modify the app for a few weeks.. there is a skill to well designed/implemented sites that stand up to traffic. peace -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, December 15, 2006 11:49 AM To: php-general@lists.php.net Subject: Re: [PHP] google video like site Quoting Robert Cummings [EMAIL PROTECTED]: On Fri, 2006-12-15 at 09:30 +0100, Jochem Maas wrote: Robert Cummings wrote: On Thu, 2006-12-14 at 23:40 +0100, Jochem Maas wrote: I doubt they were stupid enough to shell out that kind of cash to on a php-nuke install, Why not? It's not the code they want, it's the traffic. You can have the best code in the world and if 0 people visit it, it's pretty worthless to anyone but you. you are right - I was implicitly thinking along the lines that there is no way in hell a php-nuke install could stand up to amount of requests/processing youtube must cope with. Definitely not on one computer, but if you offload to say 30 servers, you can probably process 100 million hits per day. Servers are probably cheap compared to their bandwidth costs. there is a good reason that properties like Yahoo (which uses php of course) stick all the heavy lifting code in php extensions written in C. True, but nothing stopping a site like youtube from taking a shoddy app and moving some of the heavy lifting into extensions themselves. then there is the issue of differentiation - would *you* settle for some generic POS piece of software if you had billions of dollar to invest in build a custom, killer app? Probably not, but I know that millions of people everyday settle for Microsoft ;) Some of these people probably have a few spare billion dollars... not me though :| okay, sure, everything in software land is eventually comoditized and available as open source eventually, but right now there are no google-video type applications out there that can handle the amount of traffic the mentioned sites handle. Id on't think the code is the bottleneck, I think the bottle neck is the 200 to 400 terabytes of data youtube transfers everyday. there is also the premise that youtube wouldn't be youtube if it were running on php-nuke, for the simple fact it would have been hacked to death. no? Well, that's definitely a valid point, no argument from me there heheh. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks everyone. By the way I wasn't implying that any of these sites are being run on php-nuke, I was wondering if they're however running on something similar to php-nuke. Just because you tube, google video, break.com and a few other sites all basically look the same and function the same way, so I thought they might be using the same backend code. I'm making a small site for a community that wants the same idea, I was wondering if it's as easy as installing a software, or that I have to write it all from scratch. Thanks again for all your responses. Siavash -- 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
[PHP] imap_open('/path/to/mbox', '', '')
I'm having trouble with Windows imap_open. I have the exact same mbox on a Linux box, with the exact same PHP code opening it just fine. I FTP (binary) to the Windows box (and a second time to be sure it wasn't an FTP flake-out). Opening the mbox in Windows yields a message like: PHP Notice: Unknown: C:\\data\\mbox.excerpt (file C:\\data\\mbox.excerpt) is not in valid mailbox format (errflg=2) I can fopen and fread the same file just fine. I've tried copying out just ONE email from the mbox. I've been searching and reading quite a bit, but virtually all the docs and examples are all about problems with connection to live IMAP server, and very few even mention that one can open a local file mbox. There is a User Contributed note at http://php.net/imap_open that says: ...This specifies a mailbox in the default format (usually Berkeley format for most default library builds)... I now have 2 theories: 1. Windows IMAP is expecting a different newline in headers and/or body of the mbox email. :-( 2. Windows build is not using Berkeley format, whatever that is, and I need to convert the mbox to Berkeley format or convince the DLL to use whatever format it is that I have, which I have no idea what it is... Far as I can tell, the format of the mbox is just one raw email message after another, with a blank line in between. It was actually converted from MS Exchange .pst to mbox using the (gasp) pst2mbox converter commonly known as readpst: http://alioth.debian.org/projects/libpst/ Note that the resulting mbox works fine under Linux, so it seems unlikely that the mbox itself is at fault. So now to some questions: There does not seem to be any choice with imap_open. Is that because it can allegedly open *any* mailbox format, including Berkeley format and mbox and whatever it is that I have? Or is that because only an idiot like me would FTP an mbox from Un*x to Windows and expect to open it, and I have to do something else to it? Is the mailbox format hard-wired into the PHP compilation? I see no settings in php.ini for an [IMAP] section to change anything. Would converting Un*x newlines to Windows on the entire mbox help? Seems to me that the RFC is quite specific about the newlines of headers and body, and converting the mbox in toto is unlikely to be useful. Guess I can try it on my tiny sample and find out, but even if it worked, it would seem more like a bug than a feature, so I'm wanting some input on this topic no matter how it pans out. Can somebody point me to anything that would de-mystify (errflg = 2) in the error message? Obviously that '2' has SOME kind of meaning, but is that from PHP, IMAP, Windows OS, File System, ...? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST in Apache server
Hi all, I'm new in the php world and I have a problem. I want to invoke a php scr= ipt from a web page hosted on an Apache server. The php script writes and= deletes a file but, to be able to do that, I have to make the user to be= myself and not the Apache server. In order to do that below is the code = I use in the html to invoke the php script: form action=3Dhttp://www.aa.dd.cc/cgi-bin/cgiwrap/user/script.php; meth= od=3Dpost value1 *: input type=3Dtext name=3Dval1br value2 *: input type=3Dtext name =3D val2br /form where script.php is placed inside ~/user/public_html/cgi-bin The problem is that when the script is launched, as soon as the html in v= isited, I get this error: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/script.php on line 16 In other words, the POST issued inside the html seems not to work because= the values val1 and val2 are not found. If instead I do the following in the html code: form action=3Dscript.php method=3Dpost value1 *: input type=3Dtext name=3Dval1br value2 *: input type=3Dtext name =3D val2br /form having placed script.php in the same directory where the html is, the POS= T succeeds but of course the script is not able to delete the file it is = supposed to work on because the owner becomes the apache server. I need the first method (script.php inside cgi-bin) to work. Does anybody know the way to solve the problem? Any help will be appreciated, thanks, -emiliano -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Curl and cookies
On Fri, December 15, 2006 8:06 am, Fernando M. M. wrote: I have just started using curl and i have some question about cookies. The website i'm logging in controls everything using cookies (from login to the actions inside it). Is there a way to store the cookie values into a php session variable ($_SESSION['cookie'])? How do i make curl receive the cookie and store in this variable? How do i make curl send it? Option #1. Use the HEADER option in curl to get all the headers, and you can see the cookies, parse them, send them back with more header options. Option #2. Use the COOKIE_FILE and COOKIE_JAR option and let curl accept/send the cookies for you, automatically. Last time I tried it, these were mutually exclusive. You could automate the cookies and get no headers, or you could get headers and do all the cookies for yourself, but not get the headers and have curl handle the cookies while you did something interesting with the other headers. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST in Apache server
Hi all, I'm new in the php world and I have a problem. I want to invoke a php script from a web page hosted on an Apache server. The php script writes and deletes a file but, to be able to do that, I have to make the user to be myself and not the Apache server. In order to do that below is the code I use in the html to invoke the php script: form action=http://www.aa.dd.cc/cgi-bin/cgiwrap/user/script.php; method=post value1 *: input type=text name=val1br value2 *: input type=text name =val2br /form where script.php is placed inside ~/user/public_html/cgi-bin The problem is that when the script is launched, as soon as the html in visited, I get this error: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/script.php on line 16 In other words, the POST issued inside the html seems not to work because the values val1 and val2 are not found. If instead I do the following in the html code: form action=script.php method=post value1 *: input type=text name=val1br value2 *: input type=text name=val2br /form having placed script.php in the same directory where the html is, the POST succeeds but of course the script is not able to delete the file it is supposed to work on because the owner becomes the apache server. I need the first method (script.php inside cgi-bin) to work. Does anybody know the way to solve the problem? Any help will be appreciated, thanks, -emiliano -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO::prepare deallocate PDOStatement::closeCursor()
On Fri, December 15, 2006 7:49 am, Yonatan Ben-Nes wrote: 1. Let's say that I create the following prepared statement: $PDOStatement = $DB_Conn-prepare(INSERT INTO test (name) values (?)); And after 50,000 inserts (with $PDOStatement-execute(array('somevalue'));) I want the database to analyze, compile and optimize it's plan again so it will be more efficient for it's next inserts (actually is that true at all?!?), does repeating the same command will deallocate the prepared statement at the database replace it with the new prepared statement? (new plan). If not, how can I deallocate it then? I *think* you will find that the change in plan for an insert will not change drastically as you insert -- Rather, the change in plan will change for a SELECT if you optimize/analyze/etc. Based on the $PDOStatement being a result object, I would *expect* it to survive an analysis query on the same connection, but you'll have to test to be sure. 2. At the PHP manual of PDOStatement::closeCursor it's written that This method is useful for database drivers that do not support executing a PDOStatement object when a previously executed PDOStatement object still has unfetched rows. If your database driver suffers from this limitation, the problem may manifest itself in an out-of-sequence error.. Anyone know if the PostgreSQL suffer from this problem or not? The PostgreSQL developers will probably answer this one way more faster. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegExp
On Thu, December 14, 2006 11:47 pm, WeberSites LTD wrote: I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { } It works well but I'm having problems with the (double quote). If there is a double quote () it fails. Fails in what way? Are you sure you are remembering to do http://php.net/htmlentities on the data you send out for the TEXTAREA to pre-populate it? Does PCRE need escaped inside the [] bit? I think not, but I suppose \\ instead of \ couldn't hurt. You may also want to move the - to the end of [] character set and lose the \, just to keep it simpler. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] learning classes not sure how to do this correctly
I think you are assuming that the stuff you do in test.php carries over to test2.php It doesn't. The ONLY stuff connected between test.php and test2.php is the POST data being sent by the FORM submission. Your $keclass needs to be re-built from scratch in test2.php, somehow. You can cram it into a $_SESSION or just re-build it, but it won't magically transfer. On Thu, December 14, 2006 7:26 pm, Macha wrote: I'm not sure if it matters or not, but this is happening on the page that you are sent to from hitting the submit button from the other page...test.php is a form that sends you to test2.php after hitting the submit button and its test2.php page that is having this issue with the $keclass. with that on test2.php if i use var_dump($keclass) i get *'Notice*: Undefined variable: keclass' and *'Fatal error*: Call to a member function on a non-object' on any $keclass - function call witch makes since, but if i try to declare the class in test2.php with var_dump($keclass) i get object(keclass)(0) but i get *Fatal error*: Cannot redeclare class keclass. so i guess that information changes the question down to why is it saying that i am redeclaring $keclass when it hasnt been declared in that page before? is it something do to with test.php when u hit submit and being redirected to test2.php? If this dosnt really make any sense let me know..i have been told serveal times in the past i dont really explain my self well hehe Richard Lynch wrote: var_dump($keclass); It's not an object... On Thu, December 14, 2006 9:16 am, [EMAIL PROTECTED] wrote: just starting to get used to classes, trying to figure out what i am doing wrong, i know its going to be something stupid on my part, probably really shouldn't be using a if statement or something heh just doing a basic email verification to make sure its looks like email addy so i take the post to a var PHP Code: $email_address = $_POST['email_address']; run it through this function in my class PHP Code: function check_email($address){ if (ereg('[EMAIL PROTECTED]', $address)) return true; else return false; } and then if true i want it to continue on with the script or error out and quit back to the other page and display the error. so i have tried something like this and stuff similar but get a error Fatal error: Call to a member function on a non-object in PHP Code: if (!$keclass-check_email($email_address)) { $keclass-seterr(555); include('test.php'); exit(); } $keclass-seterr(000); include('test.php'); exit(); the seterr is just a simple thing that takes the number and puts in a session var for latter display... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/script.php on line 16 http://php.net/isset -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Hi Richard, sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? -e On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/script.php on line 16 http://php.net/isset -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Having problem sending XML over HTTP
Hello, on 12/14/2006 06:32 PM Nauman Akbar said the following: I picked up an example from Curl section on php.net. I am able to access the remote page fine with a custom header. Unfortunately, I am not able to retrieve the XML I am sending at the remote end. I have tried both $HTTP_RAW_POST_DATA and php://input but neither of them returns anything. I am putting my code below just in case anyone can point out the problem in there. I don't think you need to wrap your XML in a multipart/mixed container. Just send it as text/xml. That is how SOAP and other protocols work and PHP can handle it. You can also emulate submission of a form with files. That is more complicated but works better with PHP as you do not need to tweak php.ini . I use this HTTP client class that has either an example of sending a XML document like your want or using form submission emulation. Take a look in particular at examples test_http_post.php and test_http_soap.php . http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How php works?
On Fri, December 15, 2006 3:32 am, Kai Xiang wrote: Oh, that's interesting to know, is that from certain test of design goals? I suspect this for I thought the most time-consuming work in PHP should be compiling. The most time consuming work in PHP isn't in PHP at all. :-) It's in the database, the file system, the network congestion... It's true, that for the core of PHP, for what little time is spent by PHP doing anything at all, compiling the code to opcode takes longer than ripping through those opcodes and dispatching the function call to some external library, not counting the time spent outside of PHP core actually executing whatever that extension library does. That still doesn't mean that the actual process of converting PHP echo to opcode #42 takes any large chunk of time. It's very tiny. Refer to the early descussion, because all the thread share the same opcode, so it could save memory usage at the same time, is that true? say if there is a lot of requests at the same time, that could be a lot of memories. is that the design goal? or why not just implement a PHP file cache. Because if you just did the file cache, it would be an equal amount of work to doing the opcode cache, so you might as well go ahead and cache the opcode, and save that extra 1% performance. Caching the parser output as opcodes instead of raw PHP input is like free gravy. :-) It's a question of inserting your cache calls in line 1470 or line 1530, and you either cache the PHP source at 1470, or the opcode output at 1530. So you do it at 1530 and save those lines of code in between that do the opcode translation. [line numbers used for illustrative purposes, and are not actual line numbers, nor even realistic range between them] 2. Is there some alternative choise except zend engineen, why need a zend engine? for performance advantage or just easy for porting to different platform? You could, in theory, take PHP, rip out its guts (aka the Zend Engine) and replace it with some other compiler/parser/engine that did much the same thing, if you had nothing better to do with your life for the next several years... The Zend Engine is what translates: if (...){ myfunction(...); } into something that the computer can actually execute. That's pretty much all it is. Note that the Zend Engine is OPEN SOURCE and it will always be OPEN SOURCE and it will never not be OPEN SOURCE and it is FREE and it will always be FREE and it will never not be FREE (*) for PHP. But, sure, if you feel strongly enough about it, go ahead and fork the PHP project to rip out the Zend Engine and write your own. [shrug] That's why it's Open Source, to give you the freedom to do that. Seems like an awful lot of work to no real purpose to this naive reader, but to each their own. (*) Actually, if somebody wants to embed the ZE inside of something other than PHP, then I think Zend expects to get paid for that. I do know they had a deal or two on the table when I worked for them, back in 2000 or so, but I dunno if they came to fruition or not. ZE may well be embedded in some telecom gear somewhere, as it would be a good fit for a simple scripting language that is small enough (without extensions) to fit in that niche market. And the telco industry can afford whatever Zend charged them for that, most likely. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Varying session behavior between 2 nearly identical Apache/PHP setups
Just to be sure... You've double-checked that page setup code isn't somehow triggering an ini_set('session.use_trans_id') or other session parameters, right? I'd also examine any kind of code that is supposed to do something different for the dev/production environment. Inevitably, there ends up being *SOME* kind of #ifdef in there that does some configuration thing in dev server to connect to different db or whatever... On Tue, December 12, 2006 3:17 pm, Matthew North wrote: Hello All, I have an odd situation that I wonder if someone might have some insight on. The scenario is this: - Two FreeBSD systems running Apache+mod_php+others. We use one for development and the other for testing. - Each system is running PHP 5.2.0 with identical php.ini files. - On each system we have identical PHP code (confirmed to be identical by comparing cksum output) that looks essentially like this: === snip === ?php . . [page setup code] . trigger_error('['.session_id().']'); if (needSession !session_id()) session_start(); trigger_error('['.session_id().']'); . . [page output code] . ? === snip === Errors are logged to file rather than the page, so the trigger_error() calls above result in entries similar to: [08-Dec-2006 16:59:23] PHP Notice: [] in /path/to/file.php on line 178 [08-Dec-2006 16:59:23] PHP Notice: [GmQidWwShpRpHCGDiQrBr-Lk4ib] in /path/to/file.php on line 181 So it appears a session is started. However, on the test system a session cookie is never sent back to the browser so the session cannot be restored, while on the development system everything works as it should (session cookie is set and session is therefore restored on each page load). Using 'wget -S', here are the response headers sent by the development system: $ wget -S http://dev/ajax/shopping_list.php\?action=add\SKU=ABC --15:48:41-- http://dev/ajax/shopping_list.php?action=addSKU=ABC = `shopping_list.php?action=addSKU=ABC.1' Resolving dev... 192.168.0.30 Connecting to dev|192.168.0.30|:80... connected. HTTP/1.1 200 OK Date: Mon, 11 Dec 2006 23:48:41 GMT Server: Apache/2.2.3 (FreeBSD) mod_ssl/2.2.3 OpenSSL/0.9.7e-p1 DAV/2 PHP/5.2.0 with Suhosin-Patch mod_ruby/1.2.5 Ruby/1.8.5(2006-08-25) SVN/1.4.2 mod_jk/1.2.15 X-Powered-By: PHP/5.2.0 Set-Cookie: PHPSESSID=WJ33PpO,nphiPAVxrbrWrQEnO5a; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 103 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: application/xml Length: 103 [application/xml] And on the live server: $ wget -S http://test/ajax/shopping_list.php\?action=add\SKU=ABC --15:48:26-- http://test/ajax/shopping_list.php?action=addSKU=ABC = `shopping_list.php?action=addSKU=ABC' Resolving test... 192.168.0.31 Connecting to test|192.168.0.31|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Mon, 11 Dec 2006 23:48:26 GMT Server: Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.7e-p1 SVN/1.3.2 PHP/5.2.0 DAV/2 X-Powered-By: PHP/5.2.0 Content-Length: 103 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: application/xml Length: 103 [application/xml] No session cookie! Note that the bodies of these two responses are identical as determined using diff. Also note that we have other sets of code on the test system which call session_start(), and a session cookie _is_ set, as it should be, and everything works fine. So it's not simply that the session module is broken or mis-configured on the test machine. Under most circumstances sessions work fine on both systems. This implies that there is something specific about the code that is running in the [page setup code] and/or [page output code] (refer to snippet above) that is causing session_start() to behave unusually. But again, the PHP code is identical, so it must be the code *in combination with* some other external difference between the two systems. The only differences between the two systems that could conceivably make sense (to my mind) in terms of this differing behavior are: Apache 2.0.59 and no Suhosin patch on the test machine, vs Apache 2.2.3 _with_ Suhosin patch on the development system (and I mention Suhosin only because it makes some cookie-related changes). There are other differences, but none that would appear that they should have this effect. Here are the configure commands used for each system: test system: === './configure' '--with-mysql=/usr/local/mysql' '--with-pgsql=/usr/local/pgsql' '--with-gettext' '--with-xml' '--with-imap' '--with-imap-ssl' '--with-pspell' '--with-zlib' '--with-zlib-dir=/usr' '--with-bz2' '--with-ndbm' '--enable-dba' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local'
Re: [PHP] Whitespace in Emails
On Tue, December 12, 2006 2:23 pm, [EMAIL PROTECTED] wrote: I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content, but always toward the end pointing to a possible character count issue. See below for examples of how the space wanders and is random: 1- Th ere are several things being discussed in this email. 2- There are se veral things being discussed in this email. 3- There are severa l things being discussed in this email. This whitepace issue happens after the email is sent. Anybody have any ideas? If you have confirmed that it's happening AFTER php sends the email, then you can be pretty sure it's not PHP doing it... Also, sending html enhanced (cough, cough) email is probably the First Problem. :-) :-) :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php redirection..
The old school HTTP-EQUIV of a refresh with a time and URL would probably be suitable for this. YMMV And it's still not PHP. :-) On Thu, December 14, 2006 11:08 am, bruce wrote: all these are solid posts... however, the original posting, was not to do a redirect on the page being presented. the original post, was to display some content rolling down the page, wait some time, and 'then' redirect the user to another page. i wanted to be able to accomplish this without having the user hitting some 'submit' button. thanks! -Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Thursday, December 14, 2006 8:40 AM To: 'PHP General List' Subject: RE: [PHP] php redirection.. Better to do this on the client side with JS html head titleRedirect Test/title script language=JavaScript function redirect() { location.href='http://www.google.com/'; } /script /head body onLoad=setTimeout('redirect()', 3000); pYou will be redirected in 3 seconds.../p /body /html -Original Message- From: Youri LACAN-BARTLEY [mailto:[EMAIL PROTECTED] Sent: Thursday, December 14, 2006 10:44 AM To: PHP General List Subject: Re: [PHP] php redirection.. Budi Setiawan wrote: basically: cat.php -echo test contentbr -echo more test contentbr //redirect user echo script location.href='foo.php'; /script ; Hi , im a new too.. but you can try with this to delay your script running for some seconds : echo test contentbr echo more test contentbr // you can add : sleep(2); // this will cause your script delayed for 2 seconds //redirect user echo script location.href='foo.php'; /script ; This would work providing you don't use output buffering, otherwise the user won't see any data whatsoever that has been sent prior to the sleep() call. // hhaha.. // im just trying to help... // -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retransmiting post variables
On Tue, December 12, 2006 9:45 am, Fernando M. M. wrote: I have a script called redir.php that is used only for redirecting using the following code: header('Location: ', $_GET['url']); So, you have a one-line script do accomplish a one-line task? Okay. But now i need to redirect post varibles too. Example: If someone access redir.php?url=my_page.php and post: a=1b=2 I need to send this post string (as post) to my_page.php. If you need to re-post data from PHP, you can Google for Rasmus Lerdorf posttohost function and do that, or you can use http://php.net/curl or you can use any of a few hundred functions similar to the one Rasmus wrote a dozen years ago, or... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies page refresh
A cookie is sent BACK to the server after the server sends it to the browser. Period. It's kind of like when you go to a movie, and you buy your ticket from one person, and then you hand it to another, and they hand it back, and then you have to be prepared to show it to prove you aren't sitting through a second movie. Walking back out front to the ticket sales window, you don't show them your ticket again... Maybe that's not such a good analogy... Anyway, when you hit the back button, back to the first page, there is no cookie, because there was no cookie in that request, because you hadn't sent it. If you reload, you get back the cookie, because the browser has it, so it can send it now. On Tue, December 12, 2006 9:28 am, William Stokes wrote: Hello, I have a page that uses session cookies for deciding what content to show to a visitor. User also has 2 form objecks to apply filters to the content SQL queries. So at the beginning of the script I set 2 cookies based on user selections(or defaults) and after that make DB query based on user selections. I wanted to use cookies because there also back - up - forward links for pagination. Problem is that in order to get the cookie based system to work the page needs a refresh to read the cookies and display content corretly. Is this because the page loads faster than the server set's the cookies to client browser? If so what's the corrert / best way to implement the filters and page navigation if there's 2 form select lists and 3 links to navigate the page. Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php redirection..
On Tue, December 12, 2006 12:51 pm, Stut wrote: bruce wrote: hey stut... Please don't reply to me directly, always include the mailing list. thanks for the reply... i did get some output... i also have a question as to why i couldn't get it to work when i used 'header (foo.php)' 1) The correct way to redirect using the header function is header('Location: http://domain.com/foo.php'); Note the absolute URL. 2) Using header will definitely not display any output from the page. You actually need to put in an exit; if you want to guarantee that PHP won't send more data, and that the browser won't process it and show it before doing the re-direct... *MOST* of the time the Location: header gets processed so fast, you don't see any following data, but if you pound on it enough, you'll see that the browser *can* show the data after the re-direct, if it feels particularly Orange at that moment in time. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php redirection..
On Wed, December 13, 2006 9:41 pm, Casey Chu wrote: Search Engines don't like the META tag. Use scriptlocation.href='foobar.php';/scripta href='foobar.php'Foo Bar/a If the search engine authors are not smart enough to make the META tag and this JS snippet the same in their evaluation of the page, maybe that search engine is a pretty bad one... I don't *KNOW* but I suspect that the search engines care equally about the META re-direct and a JS re-direct, if the search engines are any good at what they do. We already have enough mis-information, mostly just out-dated information, about search engines. Let's either provide references or be clear that we are only guessing. I'm only guessing. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice needed: implementing custom fields in tables
On Tue, December 12, 2006 8:23 am, Denis Gerasimov wrote: I am in a need of implementing custom/used-defined fields mechanism. What I need is adding new fileds to a db table on-the-fly. There are 2 possible options I know: 1. Add a fixed set of text columns named custom_01, custom_02, etc. 2. Alter db tables dynamically by adding/dropping a column of appropriate type and creating/dropping helper tables if needed (e.g. values for select lists) The usual answer is to create a single table of user-defined fields, and put the field_name - field_data relationship into that. You have an extra table to JOIN to all your queries, but it works tolerably well for most usage. You may want to find out if there is a Joomla approved approach or something as well, by posting in a Joomla forum. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php redirection..
Actually... Search engines don't have a JavaScript interpreter. On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, December 12, 2006 12:51 pm, Stut wrote: bruce wrote: hey stut... Please don't reply to me directly, always include the mailing list. thanks for the reply... i did get some output... i also have a question as to why i couldn't get it to work when i used 'header (foo.php)' 1) The correct way to redirect using the header function is header('Location: http://domain.com/foo.php'); Note the absolute URL. 2) Using header will definitely not display any output from the page. You actually need to put in an exit; if you want to guarantee that PHP won't send more data, and that the browser won't process it and show it before doing the re-direct... *MOST* of the time the Location: header gets processed so fast, you don't see any following data, but if you pound on it enough, you'll see that the browser *can* show the data after the re-direct, if it feels particularly Orange at that moment in time. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] POST in Apache server
On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Did you add a submit button to the page? On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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 redirection..
On Fri, December 15, 2006 10:28 pm, Casey Chu wrote: Actually... Search engines don't have a JavaScript interpreter. Actually... You don't know for sure that Google isn't using Perl's javascript interpreter. Unless you work for Google, have just told us something they would consider double-secret proprietary, and are about to get fired. :-) :-) :-) It would not be Rocket Science for a search engine to execute the javascript on a page in a sandbox, to analyze it for abuses, viruses, and other things they wanted to take away points for. I know I could almost manage that with a ton of work. And I figure the Google engineers are probably a heck of a lot smarter than I am, and for sure they are way more experienced. So I'm going to assume that any dodge in JS I could come up with to game their system, will be detected and defeated as soon as they want to bother doing that. But, hey, feel free to get Google to issue a statement that they do not now nor ever will check the JS on sites as they index them, and point to it as a reference. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
oh ok, I understand that. However, my problem is different: I need those values that instead are not found. The question is: why the POST in the chunck of code inside the html doesn't work? Why is the php script not finding the values posted in the html? Thanks, -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with Zip+IE6
On Tue, December 12, 2006 4:34 am, Javier Ruiz wrote: damn! that's a pretty good article, thanks a lot. unfortunatelly, it's not mentioning about zip files concretely, I didn't find a solution for my problem with them. I tried playing a bit with the Content-type, but it seems that Internet Explorer doesn't really care about Content-type... it uses the extention of the file to determine the type (microsoft's way...) so it doesn't matter if I use application/octet-stream or even application/force-download or application/makethisdownload-or-ikillyou :-D as long as I name the file whatever.zip, IE6 shows the open with dialog and if I use open with an application, it fails :( It does matter on real browsers... Use the correct content type for a download: application/octet-stream thanks again Richard for the answer and for the article :) anybody with a miracle for the ZIP+IE problem?? You're going to HAVE to open the Zip file with some kind of unzip application such as WinZip, pkunzip, or, possibly, that goofball Windows unzip thingie that lets you pretend zip archives are directories, even though they aren't, but only up to a certain point, as you can't do some things with files in the zip archive that you can do with normal files, so it's just a very confusing Human Interface... Sort of like Windows in a microcosm. If you were hoping that somehow IE would magically unzip the item, and then let you open the contents within the zip file with a chosen application... Even MS Windows isn't THAT stupid. Yet. What if there are 2 things in the zip archive? For that matter, if there aren't 2 things, why is it even zipped? 1 - To change the mimetype (when writting http headers) from application/zip that I used before to application/x-zip-compressed 2 - To not use MOD_DEFLATE in apache2 (I was not using it really...) I now am beginning to wonder if you are trying to send your HTML as gzip'ed data for the browser to surf to your site, to save on bandwidth... If so, none of the above has any bearing on this at all... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with Zip+IE6
On Tue, December 12, 2006 11:04 am, Frank M. Kromann wrote: if you use: header(Content-Type: application/zip); header(Content-Disposition: attachment; filename=\somefile.zip\); That works for me with IE 6/7 and other browsers. Argh. Please read this: http://richardlynch.blogspot.com/ Go test with MORE browsers and MORE OSes, because you haven't yet hit the ones where your Content-Disposition does not work, and they are out there somewhere. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php redirection..
Well... They skip all !-- --'s, so they skip script!-- //--/script's. On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, December 15, 2006 10:28 pm, Casey Chu wrote: Actually... Search engines don't have a JavaScript interpreter. Actually... You don't know for sure that Google isn't using Perl's javascript interpreter. Unless you work for Google, have just told us something they would consider double-secret proprietary, and are about to get fired. :-) :-) :-) It would not be Rocket Science for a search engine to execute the javascript on a page in a sandbox, to analyze it for abuses, viruses, and other things they wanted to take away points for. I know I could almost manage that with a ton of work. And I figure the Google engineers are probably a heck of a lot smarter than I am, and for sure they are way more experienced. So I'm going to assume that any dodge in JS I could come up with to game their system, will be detected and defeated as soon as they want to bother doing that. But, hey, feel free to get Google to issue a statement that they do not now nor ever will check the JS on sites as they index them, and point to it as a reference. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] POST in Apache server
On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- 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] POST in Apache server
On Fri, December 15, 2006 10:48 pm, Emiliano wrote: oh ok, I understand that. However, my problem is different: I need those values that instead are not found. The question is: why the POST in the chunck of code inside the html doesn't work? Why is the php script not finding the values posted in the html? It's hard to say without surfing to your site and trying it, and looking at the PHP source and HTML source. The most common answers, in order of usage, are: #1 You spelled the name=val1 and the $_POST['val1'] differently. Spelling counts. :-) #2 You don't understand the HTTP interaction, and are expecting it to do things in a way it just plain does not work. This is the hardest one to diganose and treat, as it's difficult to figure out what beginners THINK the web is doing, much less convince them that they're wrong. :-) The best solution here is to get Firefox, install the LiveHTTPHeaders extension to Firefox turn it on, visit a few simple/example sites that do what your site does to see how they work, and then visit your site to see what it does. #3 A distant third, but possible, cause, is various PHP settings such as GPC order and register_globals and that one about populating the long names can be different than one expects. Review your php.ini settings and search for GPC register_globals and, errr, long_name or long_var_name or something like that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filedownload and output buffering
An HTTP response can only do ONE of these two things: output HTML start a download If you see sites such as SourceForge that *seem* to do this in one page, and analyze their HTML and their headers, you will find that they are using a META refresh tag or some JavaScript to cause the original HTML to re-direct to another URL, which then does the download. So, really, you are visiting the HTML output page, and then in that page, some browser-side hack is forcing the download. I personally find this annoying rather than useful, frankly, but there it is. It obviously works for SourceForge and they have a lot of users, so I must be the exceptional surfer who is annoyed by this. [Just gimme the download link -- don't make me surf to a page to get to the page that gives me the page to get the download. Sheesh!] On Tue, December 12, 2006 3:37 am, viraj wrote: hi all, i have a small script which shows some information inside a html table and then pushes a file to save on to users desktop. but with the following code it download the file and stay without outputting the html table to browser. i tried with out put buffering functions, but still no luck (it seems i'm not clear about those functions yet..). could somebody please help me on this? many thanks ~viraj ?php function my_callback($content) { header('Content-type: application/binary; charset=iso-8859-1'); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0,pre-check=0); header(Pragma: public); header(Content-Disposition: attachment; filename=\Test.url\); $content .= [InternetShortcut]\r\n . URL=http://192.168.1.71/\r\n; . IDList= . IconFile=http://192.168.1.71/favicon.ico\r\n; . IconIndex=1\r\n . [{000214A0---C000-0046}]\r\n . Prop3=19,2\r\n; return $content; } ob_start('my_callback'); getBody(); ob_end_flush(); function getBody() { ? html head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / /head body table cellspacing=0 cellpadding=0 width=780 align=center border=1 tbody tr td class=outerBorder valign=top width=780Some information goes here../td /tr /tbody /table /body /html ?php } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Automating PHP email
On Tue, December 12, 2006 3:02 am, clr wrote: I am creating a PHP/mySQL site that enables members to set criteria for email notification As my site changes and clients criteria are met they need to be notified. I can generate a list of email address and info quite simply using mySQL My question is how to trigger or initiate this process as I am a bit weary of using cron Can anyone suggest how I can automate this using PHP ? If you mean wary then all I can tell you is that cron is the correct solution, so read: man 5 crontab and play around with a mini system with your own email in all the trigges. If you actually mean weary as in you've done cron a lot and are tired of it, I really don't know what to say, as cron is the only answer I'd recommend for what you describe... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $POST Q
On Tue, December 12, 2006 2:14 am, William Stokes wrote: Can someone tell me what wrong or to how to manage this? //default $limitorig = 10; echo select name=\USRlimitorig\; echo option selected value=$limitorig/option; echo option10/option; echo option20/option; echo option30/option; echo input type=\submit\ name=\resetlimit\ value=\GO\; ?php $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10; $limit = (int) $limit; //crude filtering of input, but effective ? select name=USERlimitorig ?php for ($l = 10; $l = 30; $l += 10){ $selected = $l == $limit ? 'selected=selected' : ''; echo option value=\$l\ $selected$l/option\n; } ? /select input type=submit name=resetlimit value=GO / The value=x *is* optional, but you'll never convince the people who tell you it isn't, unless you force them to read the RFCs and W3C recommendations [*], so it's easier to include it than to argue with them. :-) YMMV NAIAA * W3C may have changed their minds on this since last week when we visited their site after this same topic came up in this very forum... But I doubt it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download adds ^M to beginning of file
On Tue, December 12, 2006 9:12 am, [EMAIL PROTECTED] wrote: Based on your subject line, I'd suggest looking for an included PHP script that has a stray newline (a Windows newline, actually) before the ?php or after the ? Using the below code to force download works fine on most servers and with most browsers. However it does crash Firefox when I download a specific file, IE works like beauty. File content starts with: #!/sbin/_joor_perl_use Filter::decrypt.. If you are using Perl, why are you posting it here?... This is the code to force the download: header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=\$file\); header(Content-Transfer-Encoding: binary); header(Content-Length: $size); I know I've posted this twice today, but here we are again: http://richardlynch.blogspot.com/ $file = fopen($completePath, 'r'); while(ob_get_level()) { ob_end_flush(); } while(!feof($file)) { echo fread($file, 2048); } fclose($file); Where can I start? Could it be server config? Or could it have to do with flush? If I remove the ob_end_flush() it does not crash Firefox. Why do you have the ob_end_flush() in there anyway? Is this code on your server that you control? Then you shouldn't have any ob_start() calls in your way in the first place. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download adds ^M to beginning of file
On Tue, December 12, 2006 9:27 am, Jochem Maas wrote: Using the below code to force download works fine on most servers and with most browsers. However it does crash Firefox when I download a specific file, IE works like beauty. File content starts with: #!/sbin/_joor_perl_use Filter::decrypt.. This is the code to force the download: header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=\$file\); header(Content-Transfer-Encoding: binary); header(Content-Length: $size); Oh yeah. Where did $size come from? I see it nowhere... $file = fopen($completePath, 'r'); // no need to fopen/fclose if you decide to use readfile()... readfile is great for small files. Not so much for monster downloads, where the browser times out while PHP tries to suck the whole file into RAM, in *some* versions of PHP. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Havn't been on the list in a while
On Mon, December 11, 2006 9:30 pm, Jim Lucas wrote: Seems like this list has slowed down alot. Anybody else notice this, or am I just missing something? I got a new job, so was busy. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
ok, this is what I get: preArray ( ) /pre PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/mail.php on line 18 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/mail.php on line 20 -emiliano On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] flash/php file uploader
On Mon, December 11, 2006 4:35 pm, Brad Fuller wrote: I have also seen custom PHP extensions that add the callback method, but they require you to recompile PHP and in the end we decided to go with the CGI solution as it was pretty much plug and play. One of those custom extensions made it into PHP 6. Okay, *maybe* it made it into PHP 5.2.x, but I won't swear to that... Rasmus pushed it in, I think, and he's the one who has a nifty example online somewhere. Search the internals mailing list archives for Rasmus Lerdfor progress meter and it oughta turn up without too much noise. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with RegEx
preg_match_all('|status([^]*)/status|msU', $xml, $matches); var_dump($matches); YMMV Download and play with The Regex Coach On Mon, December 11, 2006 9:29 am, Brad Fuller wrote: The example provided didn't work for me. It gave me the same string without anything modified. I am also looking for this solution to strip out text from some XML response I get from posting data to a remote server. I can do it using substring functions but I'd like something more compact and portable. (A one-liner that I could modify for other uses as well) Example 1: someXMLtags status16664 Rejected: Invalid LTV/status /someXMLtags Example 2: someXMLtags statusUnable to Post, Invalid Information/status /someXMLtags I want what is inside the status tags. Does anyone have a working solution how we can get the text from inside these tags using regex? Much appreciated, B -Original Message- From: Michael [mailto:[EMAIL PROTECTED] Sent: Monday, December 11, 2006 6:59 AM To: Anthony Papillion Cc: php-general@lists.php.net Subject: Re: [PHP] Need help with RegEx At 01:02 AM 12/11/2006 , Anthony Papillion wrote: Hello Everyone, I am having a bit of problems wrapping my head around regular expressions. I thought I had a good grip on them but, for some reason, the expression I've created below simply doesn't work! Basically, I need to retreive all of the text between two unique and specific tags but I don't need the tag text. So let's say that the tag is tag lang='ttt'THIS IS A TEST/tag I would need to retreive THIS IS A TEST only and nothing else. Now, a bit more information: I am using cURL to retreive the entire contents of a webpage into a variable. I am then trying to perform the following regular expression on the retreived text: $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/); Using the tags you describe here, and assuming the source html is in the variable $source_html, try this: $trans_text = preg_replace(/(.*?)(div id=result_box dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html); how this breaks down is: opening quote for first parameter (your MATCH pattern). open regex match pattern= / first atom (.*?) = any or no leading text before div id=result_box dir=ltr, the ? makes it non-greedy so that it stops after finding the first match. second atom (div id=result_box dir=ltr) = the opening tag you are looking for. third atom (.*?) = the text you want to strip out, all text even if nothing is there, between the 2nd and 4th atoms. fourth atom (\/div) = the closing tag of the div tag pair. fifth atom (.*?) = all of the rest of the source html after the closing tag up to the end of the line ^,even if there is nothing there. close regex match pattern= /s in order for this to work on html that may contain newlines, you must specify that the . can represent newline characters, this is done by adding the letter 's' after your regex closing /, so the last thing in your regex match pattern would be /s. end of string ^ (this matches the end of the string you are matching/replacing , $source_html) closing quote for first parameter. The second parameter of the preg_replace is the atom # which contains the text you want to replace the text matched by the regex match pattern in the first parameter, in this case the text we want is in the third atom so this parameter would be $3 (this is the PHP way of back-referencing, if we wanted the text before the tag we would use atom 1, or $1, if we want the tag itself we use $2, etc basically a $ followed by the atom # that holds what we want to replace the $source_html into $trans_text). The third parameter of the preg_replace is the source you wish to match and replace from, in this case your source html in $source_html. after this executes, $trans_text should contain the innerText of the div id=result_box dir=ltr/div tag pair from $source_html, if there is nothing between the opening and closing tags, $trans_text will == , if there is only a newline between the tags, $trans_text will == \n. IMPORTANT: if the text between the tags contains a newline, $trans_text will also contain that newline character because we told . to match newlines. I am no regex expert by far, but this worked for me (assuming I copied it correctly here heh) There are doubtless many other ways to do this, and I am sure others on the list here will correct me if my way is wrong or inefficient. I hope this works for you and that I haven't horribly embarassed myself here. Good luck :) The problem is that when I echo the value of $trans_text variable, I end up with the entire HTML of the page. Can anyone clue me in to what I am doing wrong? Thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List
Re: [PHP] POST in Apache server
Hmmm... there's something wrong with the form sending its values. Try echo pre; print_r($GLOBALS); echo /pre; On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: ok, this is what I get: preArray ( ) /pre PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/mail.php on line 18 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/mail.php on line 20 -emiliano On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to compile Delphi SC ?
On Sun, December 10, 2006 3:48 pm, eqla3.com eqla3.com wrote: Hi I know these is PHP mail list but also most active group i know is these :) the Q is How to compile Delphi from source code in bothe linux or windows ? If it's not this, we don't know: ./configure make make install That's how you compile PHP in Linux. In Windows, you pretty much have to be a VC++ 6 guru, last time I checked... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php