[PHP] IRC & SOCKETS
I am trying to implement a chat to my page. Using reloading is out of the question. I was indicated this technology, iFrame, wich i am liking (does anyone knows better?). But my problem is: how do i manage that everyone sees what user X just wrote and sent? I was checking socket functions, but i am a litle lost in here. Could anyone help me? Thanks a lot!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC & SOCKETS
Paulo Nunes wrote: I am trying to implement a chat to my page. Using reloading is out of the question. I was indicated this technology, iFrame, wich i am liking (does anyone knows better?). But my problem is: how do i manage that everyone sees what user X just wrote and sent? I was checking socket functions, but i am a litle lost in here. Could anyone help me? Thanks a lot!!! This was asked and answered a few days ago. Do a search on the list archives. -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] -OT- Software Fashion
helo guys , where i get a private names server , for my domain name , in internet , where i registered and how much ?? Roy Daniel , ST , IT Application Support & Development Engineer PT BERCA COMPUTEL - http://www.ilmukomputer.com/populer/roy-webservices.php [EMAIL PROTECTED]// [EMAIL PROTECTED] , [EMAIL PROTECTED] + Palm M100 + ICQ : # 103507581 / Handphone : +62-8161192832 / yahoo_messeger : roy_daniel91 andu <[EMAIL PROTECTED] To: [EMAIL PROTECTED] rix.com> cc: Subject: [PHP] -OT- Software Fashion 10/07/2003 11:27 AM I'm sure many of you read this on /. but in case you didn't here it is: http://www.softwarereality.com/soapbox/softwarefashion.jsp Regards, Andu Novac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php THIS E-MAIL IS CERTIFIED VIRUS FREE BY SYMANTEC ANTIVIRUS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Name server question (was:[PHP] -OT- Software Fashion)
Hello, [EMAIL PROTECTED] wrote > helo guys , where i get a private names server , for my domain name , > in internet , where i registered and how much ?? What do you mean with private name servers? Most of the time everything is just fine if you are hosted by a companny. They will set the DNS server and the proper linking. Polleke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] -OT- Software Fashion
You need to get an additional IP address from your hosting provider (if you use one) and then configure the box to act as a nameserver. I did just this for becomingdigital.com, but strangely it had nothing to do with PHP. I'm not sure how it does in your case, either. ;) Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: <[EMAIL PROTECTED]> To: "andu" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, 07 October, 2003 04:04 Subject: Re: [PHP] -OT- Software Fashion helo guys , where i get a private names server , for my domain name , in internet , where i registered and how much ?? Roy Daniel , ST , IT Application Support & Development Engineer PT BERCA COMPUTEL - http://www.ilmukomputer.com/populer/roy-webservices.php [EMAIL PROTECTED]// [EMAIL PROTECTED] , [EMAIL PROTECTED] + Palm M100 + ICQ : # 103507581 / Handphone : +62-8161192832 / yahoo_messeger : roy_daniel91 andu <[EMAIL PROTECTED] To: [EMAIL PROTECTED] rix.com> cc: Subject: [PHP] -OT- Software Fashion 10/07/2003 11:27 AM I'm sure many of you read this on /. but in case you didn't here it is: http://www.softwarereality.com/soapbox/softwarefashion.jsp Regards, Andu Novac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php THIS E-MAIL IS CERTIFIED VIRUS FREE BY SYMANTEC ANTIVIRUS -- 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] (native) linux-php-editor with some advanced features?
Hey folks, I know this topic comes up again and again but I couldn't find any usefull php-editor for linux which is NOT written in java AND has some advanced features like a "file navigation" (listing all functions in a file with direct jump to them) or tooltips with the function definition or similar. I liked the features of the Zend IDE but its just to aching slow on linux (don't know why, but its much faster on windows), while other native editors are not made for php or just contain its syntax-highlightning without any further special features. Did I miss one of the available editors which provides these features? Thanks, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IRC & SOCKETS
Investigate about the pear module Net_SmartIRC, its easy to make things like you said. Javier Tacón. -Mensaje original- De: Paulo Nunes [mailto:[EMAIL PROTECTED] Enviado el: martes, 07 de octubre de 2003 9:19 Para: [EMAIL PROTECTED] Asunto: [PHP] IRC & SOCKETS Importancia: Baja I am trying to implement a chat to my page. Using reloading is out of the question. I was indicated this technology, iFrame, wich i am liking (does anyone knows better?). But my problem is: how do i manage that everyone sees what user X just wrote and sent? I was checking socket functions, but i am a litle lost in here. Could anyone help me? Thanks a lot!!! -- 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] [Newbie Guide] For the benefit of new members
= This message is for the benefit of new subscribers and those new to PHP. Those who do not want to be bothered just filter out the [Newbie Guide] mails. Please feel free to add more points and send to the list. == 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. 2. If you can not get answer here try http://www.google.com next. Try searching for "php YOUR QUERY" and you may be lucky to get an answer within the first 10 results. 3. Glancing through the list archive at http://marc.theaimsgroup.com/?l=php-general , you can find many of the common topics discussed repeatedly and can get your answer from those discussions. 4. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 & 3) and ask for help. 5. Provide a clear descriptive subject line. Avoid general subjects like "Help!!", "A Question" etc. Especially avoid blank subjects. 6. When you want to start a new topic, open a new mail and enter the mailing list address [EMAIL PROTECTED] instead of replying to an existing thread and replacing the subject and body with your message. 7. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access the users' computer related information (OS, screen size etc) using PHP. You need to go for JavaScript and ask the question in a JavaScript list. 8. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person (please refer #3 above) with the same question. [contribued by Chris W Parker] 9. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) Hope you have a good time programming with PHP. Best regards, -- Integrated Management Tools for leather industry -- http://www.leatherlink.net Ma Siva Kumar, BSG LeatherLink, No 21, First Main Road, Jai Nagar, Arumbakkam, Chennai - 600106 Tel : +91 44 55191757 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess - Still asking for login information although already sent through address bar
On Tuesday 07 October 2003 03:44, PHP Webmaster wrote: [snip] > $redirect_url = "https://"; . $username . ":" . $password . "@" . $domain . > ":2083/frontend/x/index.html"; > header("Location: $redirect_url"); The code looks OK. FWIW I've tried something like: http://someone:[EMAIL PROTECTED]/"); ?> and it works for me. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I'm having a tax-deductible experience! I need an energy crunch!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remove spaces using php function
Hello, Is there any function which will remove extra spaces between each words..?? for example if the user typed asked his friend.. is there any function to remove the extra space between his and asked except one space ?? Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] remove spaces using php function
Well, you can make your own function to to that: Javier Tacón -Mensaje original- De: Uma Shankari T. [mailto:[EMAIL PROTECTED] Enviado el: martes, 07 de octubre de 2003 11:15 Para: PHP Asunto: [PHP] remove spaces using php function Importancia: Baja Hello, Is there any function which will remove extra spaces between each words..?? for example if the user typed asked his friend.. is there any function to remove the extra space between his and asked except one space ?? Regards, Uma -- 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] remove spaces using php function
Or this one works too :) Javier Tacón. -Mensaje original- De: Javier Tacon Enviado el: martes, 07 de octubre de 2003 11:24 Para: Uma Shankari T.; PHP Asunto: RE: [PHP] remove spaces using php function Importancia: Baja Well, you can make your own function to to that: Javier Tacón -Mensaje original- De: Uma Shankari T. [mailto:[EMAIL PROTECTED] Enviado el: martes, 07 de octubre de 2003 11:15 Para: PHP Asunto: [PHP] remove spaces using php function Importancia: Baja Hello, Is there any function which will remove extra spaces between each words..?? for example if the user typed asked his friend.. is there any function to remove the extra space between his and asked except one space ?? Regards, Uma -- 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
Re: [PHP] remove spaces using php function
You mean something like ereg_replace(' +', ' ', 'asked his friend..'); or perhaps preg_replace('/ +/', ' ', 'asked his friend..'); ? Of course, if you're getting this data from a luser, those may not be spaces. They could be obscure, non-printing characters. Take a look at bin2hex to find out. On Tuesday 07 October 2003 02:15 am, Uma Shankari T. wrote: > Hello, > > Is there any function which will remove extra spaces between each > words..?? > for example if the user typed > > asked his friend.. > > is there any function to remove the extra space between his and asked > except one space ?? > > Regards, > Uma -- Evan Nemerson [EMAIL PROTECTED] -- "Truth, like gold, is to be obtained not by its growth, but by washing away from it all that is not gold. " -Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remove spaces using php function
FYI, preg_replace /should/ be the fastest of all these methods (including Javier's). On Tuesday 07 October 2003 02:25 am, Evan Nemerson wrote: > You mean something like > > ereg_replace(' +', ' ', 'asked his friend..'); > > or perhaps > > preg_replace('/ +/', ' ', 'asked his friend..'); > > ? > > Of course, if you're getting this data from a luser, those may not be > spaces. They could be obscure, non-printing characters. Take a look at > bin2hex to find out. > > On Tuesday 07 October 2003 02:15 am, Uma Shankari T. wrote: > > Hello, > > > > Is there any function which will remove extra spaces between each > > words..?? > > for example if the user typed > > > > asked his friend.. > > > > is there any function to remove the extra space between his and asked > > except one space ?? > > > > Regards, > > Uma -- Evan Nemerson [EMAIL PROTECTED] -- "If anyone can show me, and prove to me, that I am wrong in thought or deed, I will gladly change. I seek the truth, which never yet hurt anybody. It is only persistence in self-delusion and ignorance which does harm." -Marcus Aurelius -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (native) linux-php-editor with some advanced features?
ActiveState Komodo is available for Linux. I only tried it briefly so I can't comment on how well it runs, but I'm quite happy with the Windows version. You can download a free evaluation from ActiveState and renew it as many times as you'd like. A link has been provided for you. :) http://www.activestate.com/Products/Komodo/ Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: "Thomas Seifert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, 07 October, 2003 06:54 Subject: [PHP] (native) linux-php-editor with some advanced features? Hey folks, I know this topic comes up again and again but I couldn't find any usefull php-editor for linux which is NOT written in java AND has some advanced features like a "file navigation" (listing all functions in a file with direct jump to them) or tooltips with the function definition or similar. I liked the features of the Zend IDE but its just to aching slow on linux (don't know why, but its much faster on windows), while other native editors are not made for php or just contain its syntax-highlightning without any further special features. Did I miss one of the available editors which provides these features? Thanks, Thomas -- 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] Get an attached file from a POP3 mail
Hi, Anyone knows how to get an attached file from a POP3 mail? I can logon, read the headers and body with Net_POP3 pear module, but I don't know how to process the mail to extract attached files .. Exists libraries that can do that? Javier Tacón - Developer Private Media Group, Inc. www.prvt.com (Nasdaq: PRVT) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get an attached file from a POP3 mail
It might interest you to know that the php imap library works with pop as well. can't figure out for the life of me why people use pop3 though :-)) all the best Javier Tacon wrote: Hi, Anyone knows how to get an attached file from a POP3 mail? I can logon, read the headers and body with Net_POP3 pear module, but I don't know how to process the mail to extract attached files .. Exists libraries that can do that? Javier Tacón - Developer Private Media Group, Inc. www.prvt.com (Nasdaq: PRVT) -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (native) linux-php-editor with some advanced features?
Quanta is not an IDE but it has excellent support for php. Thomas Seifert wrote: Hey folks, I know this topic comes up again and again but I couldn't find any usefull php-editor for linux which is NOT written in java AND has some advanced features like a "file navigation" (listing all functions in a file with direct jump to them) or tooltips with the function definition or similar. I liked the features of the Zend IDE but its just to aching slow on linux (don't know why, but its much faster on windows), while other native editors are not made for php or just contain its syntax-highlightning without any further special features. Did I miss one of the available editors which provides these features? Thanks, Thomas -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Newbie Guide] For the benefit of new members
[EMAIL PROTECTED] wrote: Please feel free to add more points and send to the list. 2 ideas come to my mind. 1. Add a link to the PHP FAQ in newbie guide item 1 http://www.php.net/manual/faq.php Yes, it's part of the manual, but a frequent answer is "Read the FAQ" or less polite ones ;-) A FAQ link seems appropriate to me 2. Add some hints with "FFAQ" like "which PHP editor": To get rid of the 'which PHP editor' question, why not add the link [1] submited by Nico Berg (October 03, 2003 12:38), as suggested by Christ W. Parker (oct 03 2003 20:38)? It lists many (107) editors, and allow users comments: Perhaps with a comment like "the best editor is yours", or something like that [1] PHP Editors by Keith Edmunds, [EMAIL PROTECTED] http://phpeditors.linuxbackup.co.uk/ Strangely enough, I didnt see the editor question in the PHP FAQ -- perhaps I did look too rapidly... [OT] Sometime I dream of a 2-level FAQ, a first short one, a FFAQ, which refers to a second std one, a FAQ... Christophe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (native) linux-php-editor with some advanced features?
Thomas Seifert wrote: Hey folks, I know this topic comes up again and again but I couldn't find any usefull php-editor for linux which is NOT written in java AND has some advanced features like a "file navigation" (listing all functions in a file with direct jump to them) or tooltips with the function definition or similar. Try SciTE ;) - Free - Syntax highlighting - Function/block folding - "Intellisense"-like function lookups - Built-in save as PDF support (a big plus for me) - Doesn't need java - Runs very fast (on Windows atleast) I'll let you hunt for the URL. -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] set_time_limit() on Mac
i gotta wierd one, maybe it's just me being daft... i'm under the impression that max execution time / set_time_limit() is server specific, and completely independant of what computer is being served the pages? my server is apache 1.3 running php 4.3 on win 2k... when i run the script from a windows machine, it runs fine. my line that does a set_time_limit(10) works and the script happily runs for about 2 minutes while a loop does some file copying (across the network to the server, and independant of whatever machine called the script). however, if i run the same script from my little iMac (shudders) then it'll give me a script timeout saying it's gone over the max execution time of 10. now i know that set_time_limit(10) is being run, as the server default is 30. it just doesn't seem to be resetting this value in the PHP loop. but surely that's impossible, as it should be all server side? secondly, i have a timer that (using javascript) writes to the html page how long the script has been running, and an estimate of how long is left to run. again, perfect timing on the PC, but when run from the Mac, the timer counts 1 second roughly every 2 seconds. again, surely this is impossible as time functions are run from the server??? the other strange thing, if i have the script running off a PC, and the Mac then also runs it, it'll time perfectly... it'll still time out, but it'll atleast count proper seconds... here's a rough idea of the code... i've cut out most of the crap that it does to give you an idea of what's happening, ignore any syntax errors, as the script does work... the flush() works nicely to update my form fields with javascript so i can see the live results of the script working... and see the problems with how mac seems to be handling it. anyway, any ideas would be very appreciated, as i don't want to have to fudge it and stick set_time_limit(1000) at the beginning of the page :( ---code--- Imposition Uploader function name(label) { document.all.currentName.value=label; } function add(name) { document.all[name].value++; } function time(estimate,taken) { document.all.timeEstimate.value=estimate; document.all.timeTaken.value=taken; } "; echo"total files read: "; echo"total files copied: "; echo"total errors: "; echo"total edits: "; echo"db records deleted: "; echo"db records updated: "; echo"new db records: "; echo""; echo"estimated time: "; echo"time taken: "; flush(); //read in a csv file line by line foreach($csv as $record) { $counter++; set_time_limit(10); //this doesn't work for mac!! if(file_exists($file)) { //do some file copying across the network. $file is located on NFS and copied to the server... //also run some extra functions to update our form counters with JS } $estimate = round(($sofar/$counter)*$rows); $sofar = round(getmicrotime($start)); echo "time('$estimate','$sofar');"; echo ""; flush(); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function call before declaration
Hi! I got a problem with functions which I call before they're defined. I get the error message: Fatal error: Call to undefined function: view() in /daten/www/midgard/cache/62.php on line 470 The code snippet: 8<- switch($argv[0]) { case 'view': view((int)$argv[1]); break; default: view(); break; } // function view($mgd_eid = 0) { global $self, $eventtypes; if($mgd_eid) { if(!$event = mgd_get_event($mgd_eid)) die("Ungültige Event-ID"); $start = date(" ... 8<- It worked before (Suse 7.2 php 4.2.0) and now it won't (Debian Woody php 4.1.2) I reckon it should work since php4. Perhaps a misconfiguration? The functions are not conditionally defined! Any Ideas? Thanks in advance! M. Hochstraßer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] set_time_limit() on Mac
[snip] i'm under the impression that max execution time / set_time_limit() is server specific, and completely independant of what computer is being served the pages? [/snip] Not server specific and overrides whatever you have set in php.ini and httpd.conf for the page in which the set_time_limit is contained. set_time_limit(10) limits the script to 10 seconds. [quote] When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out. [/quote] So your script is running for a certain length of time, then it hits the set_time_limit function and quits after 10 more seconds. Set your time limit up and see if it completes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie:form problem
Hi, Is this is the way to write a form which insert data into a mysql DB ? Please note where I am keeping the mysql code. The problem with this code is that whenever I am issues a refresh, a row is inserted into the DB with previous field values! Even when the form field is empty. Pls help. function verifyIt(form) { var sName = form.first_name.value, sEMID = form.e_mail.value; if ( sName == "" ) { .. return false; } $sFName = $_POST['first_name']; $sLName = $_POST['last_name']; $sEMail = $_POST['e_mail']; $sComments = $_POST['comments']; mysql_connect( "localhost", "usr", "pwd" ) or die( "Failure" ); mysql_select_db( "sessions" ); $query = "INSERT INTO users( fname, lname, email, comments ) VALUES ( '$sFName', '$sLName', '$sEMail', '$sComments' )"; $result = mysql_query( $query ) or die ( "Unable to insert user.." ); mysql_close( "sessions" ); ?> return true; } . . Thank you Sudheer _ The heat is on! Catch the latest action. http://server1.msn.co.in/sp03/formula2003/ Speed along with F1! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions
Hi! I started to use the php own session functions today. Now I am getting such lines in the address bar: /pages/news.php?option=1015&PHPSESSID=PHPSESSID=d117dba208d4b205cd4e521f606b b44e#result Why do I get "PHPSESSID=PHPSESSID=" ? Thank you. Webmaster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New to PHP form attributes
Hi, I am new to PHP and am more used to JSP. My question is - if I submit a form to a php3 page using action=="" for some processing all is well I can see that form data. After the processing the page is redisplayed - but the data originally sent persits (in the request) this can be a pain if the user was to hit the refresh button then the data is submitted to the server again and if for example the php page does an insert into a database then a new row would be created etc... Is this normal behaviour of php and jsp ? I am not sure but I am noticing it now with php ? Should I be clearing the data from the request somehow after I have done my processing? Thanks Matt _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using pear packages, trouble with formbuilder.php
Hello folks, i am newbie at this whole php thing :) Maybe this is not to place to ask this, if i am at the wrong place, please forgive me. I got an assignment that i have to do, i am stuck somewhere, and cant find out what the problem is, i have an idea, but dont know for sure. This is what i have done. I downloaded all the packages needed from php.net, i placed them all in one map, read the documentation and placed what depends and requires each file in one root map. I changed some map names and i also edited some .php files, i added 'set_include_path' in some .php files. When i open test.php i see that it reads the ini file, and it also reads the forumbuilder.php, but it stops here (used print function): // Initialize array with default values $formValues = $this->_do->toArray(); What could be the reason that it stops at the above line or in the called method. The debug = 5 and it does not show any error or info. Enis Yoldas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php&javascript live-clock
hello, is it possible to show the live-clock from the server machine, using php and javascript, without having to make refresh of that page? there are scripts in javascript to display a clock, but it's the clock from client machine, not from server... php can obtain the live clock of the server, but how can I keep this information realtime...? thanks, alex Have a nice day ! (And I'm sure that tomorrow will be better than today!) Alex Ciurea Greets You www.netonwave.com Have a nice day ! (And I'm sure that tomorrow will be better than today!) Alex Ciurea Greets You www.netonwave.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP form attributes
You should use post method for forms that change state on the server, that way the user gets a warning. And you should redirect after processing the form to another page. if($_GET['action']=='submit') { INSERT INTO table VALUES (NULL, '$_GET[input]' header('Location: ...'); } else { } Matthew Oatham wrote: Hi, I am new to PHP and am more used to JSP. My question is - if I submit a form to a php3 page using action=="" for some processing all is well I can see that form data. After the processing the page is redisplayed - but the data originally sent persits (in the request) this can be a pain if the user was to hit the refresh button then the data is submitted to the server again and if for example the php page does an insert into a database then a new row would be created etc... Is this normal behaviour of php and jsp ? I am not sure but I am noticing it now with php ? Should I be clearing the data from the request somehow after I have done my processing? Thanks Matt _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Going crazy-db3
I have been trying for over a week to write to the sendmail aliases db3 file and have been unable to do so regardless of how I configure the arguments with the dba_open statement. It keeps telling me "Invalid argument". It works fine within BerkeleyDB. I can read the file just fine but cannot open it in write mode. Also, phpinfo and dba_handlers both show that db3 is available as would be expected if I can read the file. When I do a db3_verify and db3_stat from a shell on the test db they both come back just fine. Any help would be great as I don't want to rewrite everything in perl. -Bob Here are the warnings I keep getting: PHP Warning: dba_open(aliases5.db,w): Driver initialization failed for handler: db3: Invalid argument in /usr/local/www/data/maillists/test2.php on line 2 Here is my test code, it always displays "dba_open failed" and if I take out the check for an open handle it obviously bombs. I have tried it with "wl" and many other combos. No luck: Key: " . $key . "->Value: " . dba_fetch ( $key, $id); $key = dba_nextkey ($id); } */ dba_close ($id); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php&javascript live-clock
At 15:48 7-10-03, you wrote: hello, is it possible to show the live-clock from the server machine, using php and javascript, without having to make refresh of that page? That would be a 99% javascript job. Find an existing javascript that works. When the page is loaded let PHP feed the javascript with the current servertime. In javascript immediately read the time on the usersystem. Option 1) Compare times and recalculate Calculate the time difference and remember that. At every time the time has to be displayed again, use the calculate time difference to adjust the time you read on the PC to servertime. Option 2) trust counters I'm sure there are time counters in javascript. Start one when the page is loaded and to display time add them up. For both options you will need functions to add times, this is tricky at the end of the hour and at the end of the day. (and keep in mind the time difference can be positive as well as negative. good luck. Chris PS maybe the script is already out there somewhere. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Modifying OPTIONS header response
Hello all, I'm working on a php/dav server and I'm having a problem. When the client sends an OPTIONS request to see what methods are allowed, they only get "Allow: GET, HEAD, POST, OPTIONS, TRACE" back from apache. This seems to me a problem since it does not include PROPFIND, COPY, MOVE, LOCK, etc. and some clients don't even try to lock the file and open it read only, I guess because they don't see LOCK, etc. as allowed. My question is, how can I modify the OPTIONS response or at least the Allowed methods?. I can capture/handle HEADs, GETs and everything fine but OPTIONS does not seem to work. Any hints?. Apache/2.0.43 PHP 4.3.0 Thanks. - O. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php&javascript live-clock
On Tue, Oct 07, 2003 at 03:48:27PM +0200, Alex Ciurea wrote: : : is it possible to show the live-clock from the server machine, using : php and javascript, without having to make refresh of that page? AFAIK, no. PHP scripts get their time information from the server. JavaScript can get its time from the server or the client, but it counts the time on the client side. If your web browser counts time a bit more slowly or quickly than the server, the time drift would result in your JavaScript clock to become more inaccurate over time. Then you would have to refresh the PHP page and re-sync your JavaScript clock with the server. This is not be a big problem if your time drift is "minimal" and your intervals between page refreshes is "reasonable". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Modifying OPTIONS header response
Just a wild guess, but try this in apache config: Script OPTIONS /options.php Oscar F wrote: Hello all, I'm working on a php/dav server and I'm having a problem. When the client sends an OPTIONS request to see what methods are allowed, they only get "Allow: GET, HEAD, POST, OPTIONS, TRACE" back from apache. This seems to me a problem since it does not include PROPFIND, COPY, MOVE, LOCK, etc. and some clients don't even try to lock the file and open it read only, I guess because they don't see LOCK, etc. as allowed. My question is, how can I modify the OPTIONS response or at least the Allowed methods?. I can capture/handle HEADs, GETs and everything fine but OPTIONS does not seem to work. Any hints?. Apache/2.0.43 PHP 4.3.0 Thanks. - O. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Modifying OPTIONS header response
Hey Marek, Thanks for the reply. Nope, doesn't do anything... O. On Tue, 2003-10-07 at 09:19, Marek Kilimajer wrote: > Just a wild guess, but try this in apache config: > Script OPTIONS /options.php > > Oscar F wrote: > > > Hello all, > > > > I'm working on a php/dav server and I'm having a problem. When the > > client sends an OPTIONS request to see what methods are allowed, they > > only get "Allow: GET, HEAD, POST, OPTIONS, TRACE" back from apache. This > > seems to me a problem since it does not include PROPFIND, COPY, MOVE, > > LOCK, etc. and some clients don't even try to lock the file and open it > > read only, I guess because they don't see LOCK, etc. as allowed. > > > > My question is, how can I modify the OPTIONS response or at least the > > Allowed methods?. I can capture/handle HEADs, GETs and everything fine > > but OPTIONS does not seem to work. Any hints?. > > > > Apache/2.0.43 > > PHP 4.3.0 > > > > Thanks. > > - O. > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions
Hello, [EMAIL PROTECTED] (Webmaster) wrote > Now I am getting such lines in the address bar: > > /pages/news.php?option=1015&PHPSESSID=PHPSESSID=d117dba208d4b205cd4e521 > f606b b44e#result Do you set them manual, does the server auto start a session? What are the settings for session in your ino file? Polleke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Modifying OPTIONS header response
Did you restart apache? It works for me. Before: Allow: GET, HEAD, OPTIONS, TRACE After: Allow: GET, HEAD, POST, OPTIONS, TRACE, PROPFIND, COPY, MOVE, LOCK options.php: header('Allow: GET, HEAD, POST, OPTIONS, TRACE, PROPFIND, COPY, MOVE, LOCK'); ?> Oscar F wrote: Hey Marek, Thanks for the reply. Nope, doesn't do anything... O. On Tue, 2003-10-07 at 09:19, Marek Kilimajer wrote: Just a wild guess, but try this in apache config: Script OPTIONS /options.php Oscar F wrote: Hello all, I'm working on a php/dav server and I'm having a problem. When the client sends an OPTIONS request to see what methods are allowed, they only get "Allow: GET, HEAD, POST, OPTIONS, TRACE" back from apache. This seems to me a problem since it does not include PROPFIND, COPY, MOVE, LOCK, etc. and some clients don't even try to lock the file and open it read only, I guess because they don't see LOCK, etc. as allowed. My question is, how can I modify the OPTIONS response or at least the Allowed methods?. I can capture/handle HEADs, GETs and everything fine but OPTIONS does not seem to work. Any hints?. Apache/2.0.43 PHP 4.3.0 Thanks. - O. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] allowing access to php page by IP
Hello, I want to allow access to a php page but am not sure how I should verify the IP once I get it. I want to allow 10.8.4.* and 10.8.5.* to access a certain webpage and keep everyone else out. I have written code to figure out what someone's IP is, but am not sure about how I should verify whether the IP is in the range of 10.8.4.* or 10.8.5.*. Any suggestions? I was thinking of either using a regex (but I dunno regex so I'd have to learn it) to stip off the .* octect and then compare the rest of the IP and see if its either 10.8.4 or 10.8.5, or create a for loop and loop through 1-254 and cat it to the end of 10.8.4. and 10.8.5. and compare it to the IP they are coming from. Any suggestions on how I should do it? Here is the code I have to get the IP: if (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("REMOTE_ADDR")) { $ip = getenv("REMOTE_ADDR"); } else $ip = "UNKNOWN"; Thanks, Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] allowing access to php page by IP
Hi, Wednesday, October 8, 2003, 12:23:16 AM, you wrote: AW> Hello, AW> I want to allow access to a php page but am not sure how I should verify AW> the IP once I get it. I want to allow 10.8.4.* and 10.8.5.* to access a AW> certain webpage and keep everyone else out. I have written code to figure AW> out what someone's IP is, but am not sure about how I should verify AW> whether the IP is in the range of 10.8.4.* or 10.8.5.*. Any suggestions? AW> I was thinking of either using a regex (but I dunno regex so I'd have to AW> learn it) to stip off the .* octect and then compare the rest of the IP AW> and see if its either 10.8.4 or 10.8.5, or create a for loop and loop AW> through 1-254 and cat it to the end of 10.8.4. and 10.8.5. and compare it AW> to the IP they are coming from. Any suggestions on how I should do it? AW> Here is the code I have to get the IP: AW> if (getenv("HTTP_CLIENT_IP")) AW> { AW> $ip = getenv("HTTP_CLIENT_IP"); AW> } AW> elseif (getenv("HTTP_X_FORWARDED_FOR")) AW> { AW> $ip = getenv("HTTP_X_FORWARDED_FOR"); AW> } AW> elseif (getenv("REMOTE_ADDR")) AW> { AW> $ip = getenv("REMOTE_ADDR"); AW> } AW> else $ip = "UNKNOWN"; AW> Thanks, AW> Adam Convert the ip numbers to integers and check if the incoming ip is within range. You can use ip2long(); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Limits and php...
Hi, I have been trying to understand how to write a simple code that will let me limit the number of files view to 10 records, but I need to under how php can look at a number of records and then caculates how many pages it needs to show all records. Is there some sample code that shows how to calculate and how to show limits 0,5 5,10 so on and so on Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: allowing access to php page by IP
Hello, [EMAIL PROTECTED] (Adam Williams) wrote > I want to allow access to a php page but am not sure how I should > verify the IP once I get it. I want to allow 10.8.4.* and 10.8.5.* to > access a certain webpage and keep everyone else out. I have written > code to figure out what someone's IP is, but am not sure about how I > should verify whether the IP is in the range of 10.8.4.* or 10.8.5.*. > Any suggestions? I was thinking of either using a regex (but I dunno > regex so I'd have to learn it) to stip off the .* octect and then > compare the rest of the IP and see if its either 10.8.4 or 10.8.5, or > create a for loop and loop through 1-254 and cat it to the end of > 10.8.4. and 10.8.5. and compare it to the IP they are coming from. > Any suggestions on how I should do it? Yes, bit basic but it should work. substr(). www.php.net/substr $FirstPartIp = substr($ip,0,5); if($FirstPartIp=='10.8.4' || $FirstPartIp=='10.8.5'){ echo 'We have a local IP, continue!'; }else{ echo 'Get out stupid hacker';} Should work. An other way is exploding the IP by . www.php.net/explode $IpParts = explode('.',$ip); $IpParts is now an array and you can check for the correct address. Good luck, Polleke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] allowing access to php page by IP
> certain webpage and keep everyone else out. I have written code to figure > out what someone's IP is, but am not sure about how I should verify > whether the IP is in the range of 10.8.4.* or 10.8.5.*. Any suggestions? $ipArray = explode( '.', $ipAddress ); if(( $ipArray[0] == 10 ) && ( $ipArray[1] == 8 ) && (( $ipArray[2] >=4 ) && ( $ipArray[2] <=5 ))) { echo 'Access granted'; } else { echo 'Get lost, ya bum!'; } Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Verry strange GET behaviour
Been having a problem accessing a variable that is passed on a URL. I've been developing PHP for years and this makes no seance. The variable I am trying to access in the script is $_section. I put the following code at the beginning (before anything else apart from http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
Ben Edwards wrote: Been having a problem accessing a variable that is passed on a URL. I've been developing PHP for years and this makes no seance. The variable I am trying to access in the script is $_section. I put the following code at the beginning (before anything else apart from echo "!$REQUEST_URI!$_section!"; I get the following output !/adultdyslexia.org/quiz.php?_menu=TOP&issue=1&_section=QUIZ&gen=Y!! So why is $_section blank! Probably because you have register_globals turned off. You can use $_GET['_section']. You can also turn it on. http://us3.php.net/register_globals - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
Hello, [EMAIL PROTECTED] (Brad Pauly) wrote > Probably because you have register_globals turned off. You can use > $_GET['_section']. You can also turn it on. > > http://us3.php.net/register_globals Don't tell them about that option! People are forced to script safe that way. Ben, with register globals off hackers can change variables you don't want to be changed theirself. Polleke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
> Ben, with register globals off hackers can change variables you don't want > to be changed theirself. Don't really have time to go through all our sites and change every variable option, then retest all the sites. Still dont understand why everything else works. Will probably start using $_GET in future. Ben -- * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP form attributes
--- Matthew Oatham <[EMAIL PROTECTED]> wrote: > I am new to PHP and am more used to JSP. My question is - if I > submit a form to a php3 page using action=="" for > some processing all is well I can see that form data. After the > processing the page is redisplayed - but the data originally sent > persits (in the request) You need to be more specific here. After the processing, the page is redisplayed? Does this mean you simply generate the appropriate output (using include() perhaps), redirect the user somewhere, the user clicks reload, or what? I would assume the first, but your problem sounds like you are doing something else. > if the user was to hit the refresh button then the data is submitted > to the server again and if for example the php page does an insert > into a database then a new row would be created etc... Now this question comes up a lot. There are many ways around it, and you will probably find more than I can mention by searching the archives. In fact, I'll only give you one suggestion now. If you form, form.php, submits to process.php, you can process the form with process.php and then include a Location header that redirects the user back to form.php: header('Location: http://yoursite.org/form.php'); This type of redirection is transparent to history mechanisms, so even clicking back in the browser won't cause the intermediate page to be displayed. A user who clicks reload will be reloading the form.php page which only generates the HTML form. I recommend searching the archives for other alternatives and choose whichever one seems best to you. > Is this normal behaviour of php and jsp? Yes. > I am not sure but I am noticing it now with php? Yes, it seems you are noticing it now, thus your question. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
--- Ben Edwards <[EMAIL PROTECTED]> wrote: > Been having a problem accessing a variable that is passed on a URL. This question is asked several times a week. You have register_globals disabled, and if you are asking this question, you need to leave register_globals disabled. Use $_GET['_section'] to access your variable. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
--- Paul van Schayck <[EMAIL PROTECTED]> wrote: > Don't tell them about that option! People are forced to script safe > that way. That is a bit of an exaggeration, don't you think? Leaving register_globals disabled certainly doesn't force people to "script safe[ly]". It does, however, force them to understand where data is coming from, and that is an important point. I agree with you that we should not recommend that people enable register_globals. This is especially true, because the people asking these types of questions already know the least about how data is exchanged on the Web. > Ben, with register globals off hackers can change variables you don't > want to be changed theirself. http://catb.org/~esr/jargon/html/H/hacker.html Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
Ben Edwards wrote: On Tue, 2003-10-07 at 16:14, Brad Pauly wrote: Probably because you have register_globals turned off. You can use $_GET['_section']. You can also turn it on. But it works in hundreds of other places on the server. I don't really want to use $_GET because I sometimes switch between post/get for debugging and changing all the wars is a pain. Do you have register_globals on or off? If it works in hundreds or other places, it should work fine. Also, you can use $_REQUEST if you want access to both GET and POST. http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.request - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
Chris Shiflett wrote: You have register_globals disabled, and if you are asking this question, you need to leave register_globals disabled. Use $_GET['_section'] to access your variable. But he says $REQUEST_URI works. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
On the topic of passing args, can someone please explain to me why I'm unable to use $_GET or $_POST if my php script is run as a .cgi? Basically, I have a simple html input form that has: and a simple php script in a file called test.cgi which looks like: #!/usr/local/bin/php Now, if I rename this script to test.php, everything works fine, but not while run as a cgi. I have no such problems when implementing the exact same code using Perl, so I'm thinking that php requires a different method of obtaining args when run as a cgi. If anyone can tell me the method, I would greatly appreciate it. Thanks, John --- Chris Shiflett <[EMAIL PROTECTED]> wrote: > --- Ben Edwards <[EMAIL PROTECTED]> wrote: > > Been having a problem accessing a variable that is > passed on a URL. > > This question is asked several times a week. > > You have register_globals disabled, and if you are > asking this question, you > need to leave register_globals disabled. Use > $_GET['_section'] to access your > variable. > > Hope that helps. > > Chris > > = > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
you need to configure your webserver recognize .cgi as a file to run the php interpreter against. i.e do whatever you did to make .php work again for .cgi --- John Wilcox <[EMAIL PROTECTED]> wrote: > On the topic of passing args, can someone please > explain to me why I'm unable to use $_GET or $_POST > if > my php script is run as a .cgi? Basically, I have a > simple html input form that has: > > method="GET"> > > > > > and a simple php script in a file called test.cgi > which looks like: > > #!/usr/local/bin/php > > print $_GET['testbox']; > ?> > > Now, if I rename this script to test.php, everything > works fine, but not while run as a cgi. I have no > such problems when implementing the exact same code > using Perl, so I'm thinking that php requires a > different method of obtaining args when run as a > cgi. > If anyone can tell me the method, I would greatly > appreciate it. Thanks, > > John > > --- Chris Shiflett <[EMAIL PROTECTED]> wrote: > > --- Ben Edwards <[EMAIL PROTECTED]> wrote: > > > Been having a problem accessing a variable that > is > > passed on a URL. > > > > This question is asked several times a week. > > > > You have register_globals disabled, and if you are > > asking this question, you > > need to leave register_globals disabled. Use > > $_GET['_section'] to access your > > variable. > > > > Hope that helps. > > > > Chris > > > > = > > My Blog > > http://shiflett.org/ > > HTTP Developer's Handbook > > http://httphandbook.org/ > > RAMP Training Courses > > http://www.nyphp.org/ramp > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > > __ > Do you Yahoo!? > The New Yahoo! Shopping - with improved product > search > http://shopping.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
> Do you have register_globals on or off? If it works in hundreds or other > places, it should work fine. In /etc/php4/apache/php.ini 'register_globals = On'. This is my point, I understand about the global issue but dont have the time to change all my code. > Also, you can use $_REQUEST if you want access to both GET and POST. Thanks for this, are there any issues in using it? what I don't understand is if $_GET is being used people can just change the URL anyway so why is it an issue? Ben -- * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
--- John Wilcox <[EMAIL PROTECTED]> wrote: > On the topic of passing args, can someone please explain to me why > I'm unable to use $_GET or $_POST if my php script is run as a .cgi? I believe this is because you are using the #! method to define the interpreter, which means your Web server simply executes the script the same as you would from the command line. What you may want to do is to have the Web server interpret .cgi files as PHP, assuming all your CGIs are PHP scripts. Then you can leave out your #! line at the top also. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
--- Ben Edwards <[EMAIL PROTECTED]> wrote: > what I don't understand is if $_GET is being used people can just > change the URL anyway so why is it an issue? It is only an issue in the sense that it hides the origin of data. An attacker can leverage this fact to exploit weaknesses in your application. When a developer uses $_GET['foo'] in his/her code, it is more obvious that the data is tainted than if the developer uses $foo, which could be tainted or could be filtered. It also keeps client data from crossing over, and distinguishing between POST data and GET data can be crucial in defending against attacks such as Cross-Site Request Forgeries (CSRF). Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
Ben Edwards wrote: what I don't understand is if $_GET is being used people can just change the URL anyway so why is it an issue? Ben All that it is about that if you have code like this: if($user=='admin' && $pwd=='secretpassword') { $admin=true; } and register_globals on someone can pass a get (or to have it more confortable cookie) variable and gain admin access. Sure, you should initialize all your variables with safe values and you are fine: $admin=false; if($user=='admin' && $pwd=='secretpassword') { $admin=true; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GET globals REQUEST the plot thickens
>From what I have $_REQUEST douse NOT work. As I said vars are being passed on the URL. My code: echo "sec=".$_REQUEST["_section"]."req=$REQUEST_URI"; the output sec= req=/adultdyslexia.org/quiz.php?_menu=TOP&issue=1&_section=QUIZ&gen=Y if I change the request to GET it works fine! Ben -- * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
On Tuesday 07 October 2003 23:04, Ben Edwards wrote: > Been having a problem accessing a variable that is passed on a URL. > I've been developing PHP for years and this makes no seance. > > The variable I am trying to access in the script is $_section. I put > the following code at the beginning (before anything else apart from > echo "!$REQUEST_URI!$_section!"; > > I get the following output > > !/adultdyslexia.org/quiz.php?_menu=TOP&issue=1&_section=QUIZ&gen=Y!! > > So why is $_section blank! Are any of the other variables there? What does print_r($GLOBALS) give you? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Today when a man gets married he gets a home, a housekeeper, a cook, a cheering squad and another paycheck. When a woman marries, she gets a boarder. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET globals REQUEST the plot thickens
Has you mention what php version are you running? Superglobals are available only since 4.1.0 Ben Edwards wrote: From what I have $_REQUEST douse NOT work. As I said vars are being passed on the URL. My code: echo "sec=".$_REQUEST["_section"]."req=$REQUEST_URI"; the output sec= req=/adultdyslexia.org/quiz.php?_menu=TOP&issue=1&_section=QUIZ&gen=Y if I change the request to GET it works fine! Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Command line parameters
Passing arguments to php bin like this used to work in older versions: # /usr/local/bin/php test.php '&arg=test' but now it doesn't: $arg has no value within test.php It's not in $GLOBALS either. How to pass parameters to the script (apart from argv/argc) ? # /usr/local/bin/php -v PHP 4.3.2 (cli) (built: Aug 10 2003 10:49:12) on RH9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
--- Chris Shiflett <[EMAIL PROTECTED]> wrote: > --- John Wilcox <[EMAIL PROTECTED]> wrote: > > On the topic of passing args, can someone please > explain to me why > > I'm unable to use $_GET or $_POST if my php script > is run as a .cgi? > What you may want to do is to have the Web server > interpret .cgi files as PHP, > assuming all your CGIs are PHP scripts. Then you can > leave out your #! line at > the top also. The reason why I'm having my php run as a .cgi in the first place, is because I want the script to inherit the user/group of the virtual host that it's running under (using suEXEC), and this is not possible when using a php script interpreted through the web server. It must be run as a .cgi, since .cgi's will inherit the user/group. This is no problem in Perl, since it provides a way to pass variables from one .cgi to another (using my $query = new CGI; param('testbox');). But I can't figure out how to do this in PHP, since using $_GET['testbox']; always produces "Undefined index: testbox in test.cgi on line 8".. Thanks, John P.S. If anyone has any other ideas of how to get a PHP script to run as a specific user/group under a Virtual Host, I'm all ears.. All I need is for the script to be able to mkdir as a specific user/group, but this is proving to be more than a small challenge! __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET globals REQUEST the plot thickens
Marek Kilimajer wrote: Has you mention what php version are you running? Superglobals are available only since 4.1.0 If $_GET works, then his PHP version must support superglobals. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
On Tue, 2003-10-07 at 12:53, John Wilcox wrote: > > P.S. If anyone has any other ideas of how to get a PHP > script to run as a specific user/group under a Virtual > Host, I'm all ears.. All I need is for the script to > be able to mkdir as a specific user/group, but this is > proving to be more than a small challenge! Under linux I usually set the stick bit on the container directory so that the group is always inheritted. I'v enever needed to worry about the owner given that the group contains rw perms and rwx for directories. chmod g+s container_dir 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
[PHP] faxing from php
Hi all, is there an easy way to send faxes from PHP? Please explain as you would have to explain it to your grandmother (I'm rather new with PHP, you know). Thanx in advance ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] or return problem
Calling the following retor_test() function causes a "Parse error: parse error, unexpected T_RETURN" message when the script is run: function istrue() { return true; } function retor_test() { istrue() or return( "False" ); return "True"; } The problem is with the "or return" part. Any ideas why? I realize that I could use an if statement instead, but I'm a lazy, lazy man and I don't want to. Pat Carmody -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] faxing from php
On Tue, 2003-10-07 at 12:59, Nicolas Claus wrote: > Hi all, > > is there an easy way to send faxes from PHP? > > Please explain as you would have to explain it to your grandmother (I'm > rather new with PHP, you know). Sorry grandmother, I just don't have the time to explain all this to you. Cheers. Rob. Ps. I don't have a clue how to fax from PHP. -- .. | 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] faxing from php
On Wednesday 08 October 2003 00:59, Nicolas Claus wrote: > is there an easy way to send faxes from PHP? Short answer, no. > Please explain as you would have to explain it to your grandmother (I'm > rather new with PHP, you know). Longer answer, you need to install some kind of fax software (HylaFAX is a good choice), then call it via one of the functions in manual > Program Execution functions Postscript to the longer answer, the HylaFAX server itself does not have to be on the same machine as the webserver. It can be called remotely. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I love mankind ... It's people I hate. -- Schulz */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
On Tue, 2003-10-07 at 13:02, Pat Carmody wrote: > > > Calling the following retor_test() function causes a "Parse error: parse > error, unexpected T_RETURN" message when the script is run: > > function istrue() { > return true; > } > function retor_test() { > istrue() or return( "False" ); > return "True"; > } > > The problem is with the "or return" part. Any ideas why? I realize that > I could use an if statement instead, but I'm a lazy, lazy man and I don't > want to. Your laziness is causing you problems. Please check out ALL of the documenation located at http://www.php.net since this is covered under basic syntax and we don't cater to lazy people (at the very least *I* don't cater to lazy people). 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] or return problem
Well Unfortunately pat You are going to have to be an unlazy man and use an if statement Chris > > Calling the following retor_test() function causes a "Parse error: parse > error, unexpected T_RETURN" message when the script is run: > > function istrue() { > return true; > } > function retor_test() { > istrue() or return( "False" ); > return "True"; > } > > The problem is with the "or return" part. Any ideas why? I realize that > I could use an if statement instead, but I'm a lazy, lazy man and I don't > want to. > > > Pat Carmody > > -- > 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] or return problem
Incidentally your post probably caused you more work than to have tested it yourself. So much for your laziness even being optimal laziness. *pt*. I thought making stupid posts was covered in the newbie guide!?! Rob. On Tue, 2003-10-07 at 13:06, Robert Cummings wrote: > On Tue, 2003-10-07 at 13:02, Pat Carmody wrote: > > > > > > Calling the following retor_test() function causes a "Parse error: parse > > error, unexpected T_RETURN" message when the script is run: > > > > function istrue() { > > return true; > > } > > function retor_test() { > > istrue() or return( "False" ); > > return "True"; > > } > > > > The problem is with the "or return" part. Any ideas why? I realize that > > I could use an if statement instead, but I'm a lazy, lazy man and I don't > > want to. > > Your laziness is causing you problems. Please check out ALL of the > documenation located at http://www.php.net since this is covered under > basic syntax and we don't cater to lazy people (at the very least *I* > don't cater to lazy people). > > 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. | > `' -- .. | 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] or return problem
So far everyone is telling me that it won't work, but no one is telling me why. (btw I did search extensively for the answer to this question but so far have found nothing). Robert, could you be more specific in your reference to the http://www.php.net documentation? I see nothing on the basic syntax page that addresses this. Pat Carmody On Tue, 7 Oct 2003, Robert Cummings wrote: >On Tue, 2003-10-07 at 13:02, Pat Carmody wrote: >> >> >> Calling the following retor_test() function causes a "Parse error: parse >> error, unexpected T_RETURN" message when the script is run: >> >> function istrue() { >> return true; >> } >> function retor_test() { >> istrue() or return( "False" ); >> return "True"; >> } >> >> The problem is with the "or return" part. Any ideas why? I realize that >> I could use an if statement instead, but I'm a lazy, lazy man and I don't >> want to. > >Your laziness is causing you problems. Please check out ALL of the >documenation located at http://www.php.net since this is covered under >basic syntax and we don't cater to lazy people (at the very least *I* >don't cater to lazy people). > >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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
I already said "Your laziness is causing you problems", this refers back to your original statement about being lazy. You should be able to infer form your own wrods the root of your problem. Rob. On Tue, 2003-10-07 at 13:14, Pat Carmody wrote: > > So far everyone is telling me that it won't work, but no one is telling me > why. (btw I did search extensively for the answer to this question but so > far have found nothing). Robert, could you be more specific in your > reference to the http://www.php.net documentation? I see nothing on the > basic syntax page that addresses this. > > Pat Carmody > > On Tue, 7 Oct 2003, Robert Cummings wrote: > > >On Tue, 2003-10-07 at 13:02, Pat Carmody wrote: > >> > >> > >> Calling the following retor_test() function causes a "Parse error: parse > >> error, unexpected T_RETURN" message when the script is run: > >> > >> function istrue() { > >> return true; > >> } > >> function retor_test() { > >> istrue() or return( "False" ); > >> return "True"; > >> } > >> > >> The problem is with the "or return" part. Any ideas why? I realize that > >> I could use an if statement instead, but I'm a lazy, lazy man and I don't > >> want to. > > > >Your laziness is causing you problems. Please check out ALL of the > >documenation located at http://www.php.net since this is covered under > >basic syntax and we don't cater to lazy people (at the very least *I* > >don't cater to lazy people). > > > >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] or return problem
On Tue, Oct 07, 2003 at 01:02:36PM -0400, Pat Carmody wrote: : : Calling the following retor_test() function causes a "Parse error: parse : error, unexpected T_RETURN" message when the script is run: : : function istrue() { : return true; : } : function retor_test() { : istrue() or return( "False" ); : return "True"; : } : : The problem is with the "or return" part. Any ideas why? Yes. : I realize that I could use an if statement instead, You just answered your own question. : but I'm a lazy, lazy man and I don't want to. Just use an if statement. Lazy, Perl-ish syntax blows chunks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Singleton Was: [PHP] OO parent/child relationship
One quick thought: You might want to add the following to your if statement: else { $this->_cache[$key] = new $key; return $this->_cache[$key]; } Andy > -Original Message- > From: Gerard Samuel [mailto:[EMAIL PROTECTED] > Sent: Monday, October 06, 2003 5:36 PM > To: 'PHP List' > Subject: [PHP] Singleton Was: [PHP] OO parent/child relationship > > Gerard Samuel wrote: > > > Andy Crain wrote: > > > >> This all seems like a perfect case for the singleton pattern. See > >> http://www.phppatterns.com/index.php/article/articleview/6/1/1/ and > >> http://www.phppatterns.com/index.php/article/articleview/75/1/1/ > >> Andy > >> > > Im currently trying to wrap the brain around the Singleton Registry > > article. > > Wish me luck :) > > http://www.trini0.org/index.php > This is based on work seen at > http://www.phppatterns.com/index.php/article/articleview/75/1/1/ > Yes yes, I know. It uses $GLOBALS, (OO Sin). Father forgive me > From the article, Im getting lost with the reason/meaning/purpose of > the instance() method. > If anyone can clarify it for me, and let me know if my example would > need something like it. > So if you care to critique it, feel free, Ill try not to be hurt ;) > Thanks > > -- > 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] or return problem
Chris Sherwood wrote: Well Unfortunately pat You are going to have to be an unlazy man and use an if statement Why won't any of you give a good reason why it won't work? How come this works: function foo() { 2+2==4 or die("The world is ending, or at least your processor!"); } But this doesn't: function foo() { 2+2==4 or return("The world is ending, or at least your processor!"); } The way I see it, there's something really odd going on here. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
> Why won't any of you give a good reason why it won't work? How come this > works: > > function foo() { > 2+2==4 or die("The world is ending, or at least your processor!"); > } > > But this doesn't: > > function foo() { > 2+2==4 or return("The world is ending, or at least your processor!"); > } > > The way I see it, there's something really odd going on here. Directly from the docs: http://ca3.php.net/manual/en/function.return.php First line: "If called from within a function, the return() statement immediately ends execution of the current function" Important concept: IMMEDIATELY returns. Learn to read. 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] or return problem
Robert Cummings wrote: Directly from the docs: http://ca3.php.net/manual/en/function.return.php First line: "If called from within a function, the return() statement immediately ends execution of the current function" Important concept: IMMEDIATELY returns. Learn to read. What does that have to do with anything? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_fetch_array() not working as expected
Hey peeps. Let me make this simple. I've got the following sql query in a function: SELECT c.id , cc.id , cc.prod_id , p.name , cc.price , cc.qty FROM cart AS c INNER JOIN cart_contents AS cc ON cc.cart_id = c.id INNER JOIN products AS p ON p.id = cc.prod_id WHERE c.cust_id = '6' ORDER BY cc.id When I get the result and turn it into an array with mysql_fetch_array($var, MYSQL_BOTH) I see the following with print_r(): Array ( [0] => Array ( [0] => 2 [id] => 3 [1] => 3 [2] => SDG6004-XX-XXX [prod_id] => SDG6004-XX-XXX [3] => Model 6004 [name] => Model 6004 [4] => 89.00 [price] => 89.00 [5] => 2 [qty] => 2 ) ) Notice that index 1 does not have a textual companion like the other indexes do. I expected the array to be created like this: Array ( [0] => Array ( [0] => 2 [c.id] => 3 [1] => 3 [cc.id] => 3 [2] => SDG6004-XX-XXX [cc.prod_id] => SDG6004-XX-XXX [3] => Model 6004 [p.name] => Model 6004 [4] => 89.00 [cc.price] => 89.00 [5] => 2 [cc.qty] => 2 ) ) But alas... that's not how it works. Anyway to get what I want? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
On Tue, 2003-10-07 at 14:29, Leif K-Brooks wrote: > Robert Cummings wrote: > > >Directly from the docs: > > > >http://ca3.php.net/manual/en/function.return.php > > > >First line: > > > >"If called from within a function, the return() statement > > immediately ends execution of the current function" > > > >Important concept: > > > >IMMEDIATELY returns. > > > >Learn to read. > > > > > What does that have to do with anything? How can you possibly test, in a conditional, the return value of the return statement itself when it has no value to return and even causes the current scope to exit IMMEDIATELY?? 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] or return problem
Robert Cummings wrote: How can you possibly test, in a conditional, the return value of the return statement itself when it has no value to return and even causes the current scope to exit IMMEDIATELY?? Ok, that explains it. Thanks. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] or return problem
> How can you possibly test, in a conditional, the return value of the > return statement itself when it has no value to return and even causes > the current scope to exit IMMEDIATELY?? Per the logic, if it returns immediately, isn't the value irrelevant? That is, assuming that the truth of the first clause short-circuits evaluation of the second one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] or return problem
On Tue, 2003-10-07 at 14:40, Roger B.A. Klorese wrote: > > How can you possibly test, in a conditional, the return value of the > > return statement itself when it has no value to return and even causes > > the current scope to exit IMMEDIATELY?? > > Per the logic, if it returns immediately, isn't the value irrelevant? That > is, assuming that the truth of the first clause short-circuits evaluation of > the second one. Depends on how the return statement is processed since it obviously has special treatment. But yes, that would be a bug probably if indeed the the return expression should never be evaluated due to the left operand evaluating to true. Nonetheless, it's a dirty style for a return IMHO since if the left operand does evaluate to false then the conditional is undefined as far as I can tell. 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] or return problem
--- Robert Cummings <[EMAIL PROTECTED]> wrote: > > >Directly from the docs: > > > > > >http://ca3.php.net/manual/en/function.return.php > > > > > >First line: > > > > > >"If called from within a function, the return() statement > > > immediately ends execution of the current function" > > > > > >Important concept: > > > > > >IMMEDIATELY returns. > > > > > >Learn to read. > > > > What does that have to do with anything? > > How can you possibly test, in a conditional, the return value of the > return statement itself when it has no value to return and even > causes the current scope to exit IMMEDIATELY?? The code in question, I believe, was basically this: function foo() { true or return('foo'); } Your answer does not address the question as to why this is invalid syntax, but instead you explain how return works. This is what Leif is questioning, I believe. Regardless, a little less hostility would be nice. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
On Tue, 2003-10-07 at 14:45, Chris Shiflett wrote: > --- Robert Cummings <[EMAIL PROTECTED]> wrote: > > > >Directly from the docs: > > > > > > > >http://ca3.php.net/manual/en/function.return.php > > > > > > > >First line: > > > > > > > >"If called from within a function, the return() statement > > > > immediately ends execution of the current function" > > > > > > > >Important concept: > > > > > > > >IMMEDIATELY returns. > > > > > > > >Learn to read. > > > > > > What does that have to do with anything? > > > > How can you possibly test, in a conditional, the return value of the > > return statement itself when it has no value to return and even > > causes the current scope to exit IMMEDIATELY?? > > The code in question, I believe, was basically this: > > function foo() > { > true or return('foo'); > } > > Your answer does not address the question as to why this is invalid syntax, but > instead you explain how return works. This is what Leif is questioning, I > believe. > > Regardless, a little less hostility would be nice. The original post came from someone being lazy, that appears to be influencing my take on the thread :) Also given the above code, it's completely pointless since the first operand is true and so it is impossible for return( 'foo' ) to ever be evaluated (and as stated in a post just before this the expression shouldn't break). Nonetheless given a variable as the first operand, I think anyone coding a return in a conditional like that is asking for trouble since I would guess that it has an undefined return value. 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] or return problem
On Wednesday 08 October 2003 02:51, Robert Cummings wrote: > The original post came from someone being lazy, that appears to be > influencing my take on the thread :) Also given the above code, it's > completely pointless since the first operand is true and so it is > impossible for return( 'foo' ) to ever be evaluated (and as stated in a > post just before this the expression shouldn't break). Nonetheless given > a variable as the first operand, I think anyone coding a return in a > conditional like that is asking for trouble since I would guess that it > has an undefined return value. The example given by Leif does not even run. You get a parse error. So all the discussion about return exiting immediately and the left expression evaluating to whatever is (IMHO) moot. Apparently PHP does not allow you to use return like that, period. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Wernher von Braun settled for a V-2 when he coulda had a V-8. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
On Tue, 2003-10-07 at 14:51, Robert Cummings wrote: > > The original post came from someone being lazy, that appears to be > influencing my take on the thread :) Also given the above code, it's > completely pointless since the first operand is true and so it is > impossible for return( 'foo' ) to ever be evaluated (and as stated in a > post just before this the expression shouldn't break). Nonetheless given > a variable as the first operand, I think anyone coding a return in a > conditional like that is asking for trouble since I would guess that it > has an undefined return value. I would say the real issue at hand here is that the return statement is not a fucntion, but rather a language construct, thus it cannot be used as a function unless explicitly stated as so. The reason a parse error is occurring is because this particular construct has no support for being used in the given context. It would be like dropping in any other language construct suddenly such as a { or @ where it is not understood. Given that die() and exit() works just means they have been given support for this context. 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] or return problem
On Tue, 2003-10-07 at 15:00, Jason Wong wrote: > > The example given by Leif does not even run. You get a parse error. So all the > discussion about return exiting immediately and the left expression > evaluating to whatever is (IMHO) moot. Apparently PHP does not allow you to > use return like that, period. > Yep. 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] or return problem
--- Robert Cummings <[EMAIL PROTECTED]> wrote: > The original post came from someone being lazy, that appears to be > influencing my take on the thread :) Understandable. :-) > Also given the above code, it's completely pointless since the first > operand is true and so it is impossible for return( 'foo' ) to ever > be evaluated I don't think that was the point. You can rewrite it like this if you like: function foo() { false or return 'foo'; } I believe the original poster mentioned being lazy to justify why this code is not used instead: function foo() { if (!false) { return 'foo'; } } The conditional expression itself is irrelevant. This is a question about the language construct. > I think anyone coding a return in a conditional like that is asking > for trouble since I would guess that it has an undefined return > value. Well, anyone who tries that code will get a parse error, so that is definitely an invitation for trouble. The return value would be defined if this worked as I think it the original poster indended. The 'or' is not a typical conditional statement, by the way, otherwise this would work just fine. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] or return problem
> I would say the real issue at hand here is that the return > statement is > not a fucntion, but rather a language construct, thus it > cannot be used > as a function unless explicitly stated as so. The reason a parse error > is occurring is because this particular construct has no support for > being used in the given context. It would be like dropping in > any other > language construct suddenly such as a { or @ where it is not > understood. > Given that die() and exit() works just means they have been given > support for this context. Sounds to me that if it looks like a function, quacks like a function, etc., only a broken language definition would treat it differently from a function... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
--- Robert Cummings <[EMAIL PROTECTED]> wrote: > Given that die() and exit() works just means they have been given > support for this context. I think you now understand the original poster's question. From my interpretation, he simply wanted to know why return was not given the same support. :-) Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] or return problem
On Tue, 2003-10-07 at 15:05, Roger B.A. Klorese wrote: > > Sounds to me that if it looks like a function, quacks like a function, etc., > only a broken language definition would treat it differently from a > function... Generally it doesn't look like a function since you can do: return 'foo' which has no parenthesis. The parenthesis are optional and only used to return the result of an expression. 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] or return problem
On Tue, 2003-10-07 at 15:08, Chris Shiflett wrote: > --- Robert Cummings <[EMAIL PROTECTED]> wrote: > > Given that die() and exit() works just means they have been given > > support for this context. > > I think you now understand the original poster's question. From my > interpretation, he simply wanted to know why return was not given the same > support. :-) Yep. My bad *bangs head on wall* :) 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] or return problem
> Generally it doesn't look like a function since you can do: > > return 'foo' > > which has no parenthesis. True enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array() not working as expected
Chris W. Parker wrote: Hey peeps. Let me make this simple. I've got the following sql query in a function: SELECT c.id , cc.id , cc.prod_id , p.name , cc.price , cc.qty FROM cart AS c INNER JOIN cart_contents AS cc ON cc.cart_id = c.id INNER JOIN products AS p ON p.id = cc.prod_id WHERE c.cust_id = '6' ORDER BY cc.id When I get the result and turn it into an array with mysql_fetch_array($var, MYSQL_BOTH) I see the following with print_r(): Array ( [0] => Array ( [0] => 2 [id] => 3 [1] => 3 [2] => SDG6004-XX-XXX [prod_id] => SDG6004-XX-XXX [3] => Model 6004 [name] => Model 6004 [4] => 89.00 [price] => 89.00 [5] => 2 [qty] => 2 ) ) Notice that index 1 does not have a textual companion like the other indexes do. I expected the array to be created like this: Array ( [0] => Array ( [0] => 2 [c.id] => 3 [1] => 3 [cc.id] => 3 [2] => SDG6004-XX-XXX [cc.prod_id] => SDG6004-XX-XXX [3] => Model 6004 [p.name] => Model 6004 [4] => 89.00 [cc.price] => 89.00 [5] => 2 [cc.qty] => 2 ) ) But alas... that's not how it works. Anyway to get what I want? Thanks, Chris. As you can see only column names create indexes, not table_name dot column_name. And thus your second id (cc.id) overwrites the first one (c.id) You can make the query: SELECT c.id , cc.id AS ccid , cc.prod_id , p.name and you will get $row['id'] and $row['ccid'] Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limits and php...
[snip] I have been trying to understand how to write a simple code that will let me limit the number of files view to 10 records, but I need to under how php can look at a number of records and then caculates how many pages it needs to show all records. Is there some sample code that shows how to calculate and how to show limits 0,5 5,10 so on and so on [/snip] search anywhere for 'paginating records', tutorials abound. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
Robert Cummings wrote: Generally it doesn't look like a function since you can do: return 'foo' which has no parenthesis. The parenthesis are optional and only used to return the result of an expression. The same is true of exit/die. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
--- Leif K-Brooks <[EMAIL PROTECTED]> wrote: > The same is true of exit/die. Right, Robert mentioned this earlier. :-) So, in summation, someone asked why return wasn't given the same support as exit (of which die is an alias), and a lot of discussion that didn't answer this question followed. :-) I don't know the answer myself, but I assume it could be considered (unless it already has and was decided against). Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] or return problem
On Tue, 2003-10-07 at 15:35, Leif K-Brooks wrote: > Robert Cummings wrote: > > > Generally it doesn't look like a function since you can do: > > > >return 'foo' > > > >which has no parenthesis. The parenthesis are optional and only used to > >return the result of an expression. > > > The same is true of exit/die. Yep, which is why I said they must receive special treat ment in the parser to be used as they are. They are also stated as being constructs and not functions in the online documentation. 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
[PHP] HTML Printing problem.
Issue: HTML files are to large to print from the browser. We are creating reports that are ++5 mg in size. This is a real problem for the browser. We are on a network and can print directly from the server but this means we must convert the html to some printer friendly format. We are using many new standards such as Any help with a solution? _ Help protect your PC. Get a FREE computer virus scan online from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php