php-general Digest 16 Jan 2001 15:19:53 -0000 Issue 458 Topics (messages 34742 through 34821): Re: MSQL and php creating problem with date.. 34742 by: Richard Lynch Re: Problems sending to several recipients with mail() using WIN NT and Apache 34743 by: Richard Lynch Re: debugging php 34744 by: Richard Lynch Re: Netscape differences? 34745 by: Richard Lynch 34768 by: Egan Re: variable tracking overview 34746 by: Richard Lynch Re: Ooops - I forgot the question... Freaking difficul thing to do (at least for me) 34747 by: Richard Lynch Re: Parse Error 34748 by: Richard Lynch Re: Missing function virtual () ??? 34749 by: Richard Lynch Re: safe mode in 4.0.4pl1 34750 by: Richard Lynch Re: how do I do this, please? 34751 by: Richard Lynch Re: 2 questions, can't find in the manual or archives . . . 34752 by: Richard Lynch Re: uploading files through php-generated scripts 34753 by: Richard Lynch 34770 by: David P. Schwartz Re: calling perl from within php 34754 by: Richard Lynch Re: Perl regular expression bug 34755 by: Richard Lynch Re: PHP & FDF on Linux PPC 34756 by: Richard Lynch 34766 by: Michael A. Peters Re: Magic Quotes - Problems with Inconsistent Behavior removing Slashes 34757 by: Richard Lynch 34759 by: Roy Re: [chiPHPug] Addslashes] 34758 by: Richard Lynch 34760 by: Jason Murray Re: Regex for telephone number 34761 by: Vikram Vaswani 34764 by: Jason Murray Automated Scripts 34762 by: Tait Grove at DIGITAL 34763 by: Tait Grove at DIGITAL 34765 by: Jason Murray Re: HELP WITH UPLOAD REQUIRED!!!!!!!! 34767 by: David P. Schwartz 34798 by: jdwright.mmm.com Running a php script at a giveb time 34769 by: Shimon Dekel 34771 by: Philip Olson 34772 by: jeremy brand 34775 by: Shimon Dekel 34807 by: Rick Hodger Re: PDFLIB 3.0 PHP 4.04 34773 by: webbie.deanox.com Re: [PHP-DEV] cookies and sessions security 34774 by: Kristofer Widholm Turning magic quotes on/off. 34776 by: void 34777 by: Rasmus Lerdorf javascript and php 34778 by: Patrice ROTH 34779 by: Soeren Staun-Pedersen 34783 by: Jřrg V. Bryne what is wrong with this sniplet? 34780 by: Jacky.lilst 34784 by: Jřrg V. Bryne 34811 by: Christian Cresante 34812 by: Jon Haworth Check browsers image displaying 34781 by: Vlad 34797 by: Christian Reiniger Re: what is wrong with this sniplet? oops! forgot to close tag 34782 by: Jacky.lilst 34787 by: Philip Olson Populating table rows 34785 by: Wade Halsey 34786 by: Philip Olson 34789 by: Tim Zickus Re: Perl-like DBI and generic SQL 34788 by: Dean Hall Version Difference 34790 by: Gareth Davies 34791 by: Philip Olson 34794 by: Gareth Davies 34795 by: Glen Scott Variables in 'friendly' urls 34792 by: William Bailey 34803 by: Tim Zickus RedHat+Apache+php+MSSQL 34793 by: Francesc Lladó PHPLIB and PHPMyAdmin 34796 by: Kevin Cawthorne 34805 by: tarique.sanisoft.com 34814 by: Krznaric Michael Probs with browsecap.ini 34799 by: Axel Tietje FTP functions 34800 by: brand.qzx.com Database Connections - permanent or something else? 34801 by: Sam Template parser 34802 by: Hrishi 34816 by: Paul K Egell-Johnsen Windows 2000 program execution fails 34804 by: Kees Hoekzema Re: Help with IMAP_open please 34806 by: Alejandro Garin HTTP_POST 34808 by: Wade Halsey is 1 a Variable...Discoverd it just now... 34809 by: Dhaval Desai 34813 by: Pavel Jartsev WML/WAP and PHP 34810 by: Rick Hodger 34815 by: Pavel Kalian Forking email out 34817 by: Kevin Cawthorne Reading specific data from a .txt file into PHP 34818 by: James Holloway 34819 by: Glen Scott 34820 by: James Holloway 34821 by: Pavel Kalian Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
> ***************************************************** > You have an error in your SQL syntax near > 'dayofmonth(date_add('', INTERVAL 7 DAY)))' at line 2 > ***************************************************** > > > > <?php > > $odate = date('Y m d'); > > $connect = mysql_connect("localhost"); > > What is $odate_sql supposed to be? It's blank, and SQL doesn't like that. I think you want just $odate there, only you may need to format it differently for mysql... Check the docs at http://mysql.org for the date formats it will accept. > $query = "insert into list(odate,edate) > values($odate,dayofmonth(date_add('$odate_sql', > INTERVAL 7 DAY))"; > > $execute = mysql_db_query("dubaiteenz",$query); > if($execute) > { > echo "Success, you are thinking in the right > direction"; > } > else > { > echo mysql_error(); > } > > > ?> > > > > > > Can anybody help me out please.... > > > Thanx! > Dhaval Desai > > > > > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
> I'm using Apache 1.3.14 on WIN NT, and can't send mail to more than one > recipient using the PHP-mail command. > > I've checked php.ini, and everything seems to be fine... > > This is an example that won't work (but should have worked..?) > > mail("[EMAIL PROTECTED], [EMAIL PROTECTED]","subject","content"); > > This one however turns out fine: > > mail("[EMAIL PROTECTED]","subject","content"); > > I have also tried to "manipulate" the header with "cc:", but no copy > arrives, only the one in the "to:" field. The To: parameter technically is only required to accept one (1) email. Many mail programs will accept multiple recipients there and DWIM and Cc: them. Your mail program is apparently not one of those. The Cc: thing with the extra headers should work on all compliant mail servers... $headers = "Cc: [EMAIL PROTECTED]\r\n"; $headers .= "From: [EMAIL PROTECTED]\r\n"; $headers .= "Reply-to: [EMAIL PROTECTED]\r\n"; mail("[EMAIL PROTECTED]", "subject", "content", $headers); Note that \r\n is spec, but many mail programs also accept \n only and DWIM. I'm guessing yours doesn't and that's what messed you up...
> - what is a good tcp-listener (i tried tcpdump, but this gives to much > output) No help for you there... I've never even tried this. Maybe you could pipe tcpdump through grep, and include something like ZZZZZZ in all your error messages or something... > - the debugger doesn't work: the command debugger_on("localhost"); leads to > the error-message shown below: > > Fatal error: Call to undefined function: debugger_on() in index.php on line > 2 > > ... and the manual says, that the debugger is still under development. That error message may just mean you didn't compile with the debugger code on... But that might be because the debugger code itself has been disabled for awhile -- I seem to recall a thread about that... I believe there are one or two IDEs already out there that you could try that may let you step through your code. No idea how tricky they are to set up nor how well they work though...
Try sending the various "no-cache" and "expiration" headers. You can find more details in code archive samples linked from: http://php.net/links.php Naturally, IE and Netscape don't agree on which headers mean what, so you have to send at least twice as many as you'd expect. Am I the only one that wants to put all the IE and Netscape engineers on an island and not let them off until their specs agree?... Sort of like "Survivor" :-) ----- Original Message ----- From: Joel Dossey <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Sunday, January 14, 2001 3:11 PM Subject: [PHP] Netscape differences? > Greetings, > I have a php script that generates a random image. All > images are kept in a mysql table. It works fine when > viewed by IE, but Netscape, and Lynx, always show the > same image. The database information, however, is > changed as it should be (correctly incrementing the > times seen column for the image), and on refresh all > information goes as it should, except for randomly > selecting an image. > This may be an apache caching problem, but I was > wondering if anyone has run into this working with php > in general, and what solutions I need to explore. > > Thanks much, > Joel Dossey > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
On Mon, 15 Jan 2001 21:05:08 -0600, "Richard Lynch" <[EMAIL PROTECTED]> wrote: >Try sending the various "no-cache" and "expiration" headers. You can find >more details in code archive samples linked from: > >http://php.net/links.php I see many links there, but I don't know which one is "code archive samples" Anybody?
If the answers to the 390 inputs are all limited in length, you *might* be able to squeeze them all into POST variables carried forward from page to page. What you need to realize here is that HTTP is stateless -- The browser and server won't remember anything unless you work at it. So, on each page, you need to dump out all the variables collected so far as <INPUT TYPE=HIDDEN fields in your FORM to be carried forward to the next page. That, of course, is going to get ugly pretty fast, and the sheer size will work against you -- Servers are encouraged not to limit the size of a POST, or at least to give it astronomically high limit, but they *can* limit it to something like 1K of data and still be "in spec". So, your next attractive option is to use PHP's new session management: <?php session_start(); session_register('var1'); session_register('var2'); #etc for each var the form is accepting. ?> Even this, however, could get ugly under heavy load -- storing all that data using standard file I/O could be too much slow disk I/O. Fortunately, you can swap in MySQL or other database as the storage mechanism for your server-side PHP session data. See http://php.net/manual/en/function.session-set-save-handler.php for complete details, but the basic idea is this: Alter php.ini to tell PHP you are using a user-defined/database storage mechanism rather than the built-in file one. Write a function for the five or six things a session data set can have done to it. (Read/Write/Create/Delete/...) The session_set_save_handler() function takes the names of these functions, and alters PHP so it calls them instead of the builtin ones. Hope that helps. Oh yeah: Probably moot now, but I think the rand() function needs some arguments to do what you wanted it to do... And it's not a real good choice for a unique user_id anyway. uniqid() is way mo' betta', or using the builtin session stuff, of course. ----- Original Message ----- From: Larry Jaques <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Sunday, January 14, 2001 7:45 PM Subject: [PHP] variable tracking overview > Could someone give/sell me a clue as to variable tracking and/or cookie > usage over multiple form pages > for multiple users? > > Environment: website > Number of variables: 390 or so. > I have 4 pages of forms, 4 result pages, and want to email all the results. > I put up one page of forms, they input, it spits the output to the result > page. > Each input/output works fine until the final output which comes up totally > empty. > > This session tracking code (hopefully) heads the input pages > <? > if (!isset($id)) { > srand((double)microtime()*1000000); > $randval = rand(); > setcookie("id",$randval,time()+14400,"/",".mywebpage.com",0); > } > > ?> > > It is shown as echo "Your session number is $id"; which shows up on every > page except the first. > > If I link the email output page to the first input page form, it outputs > the INFO SENT > html page and the email with all of the page info, so that part is working. > It just doesn't > track across several forms and if two people are logged in concurrently, > the same > session id number is used for both users. Arrrrrrrrrrrgh! > > What am I missing here? > > Should I be creating a database for this one-time-use info? > > > (Of course, the client dragged his feet for 5 months and now needs to get > it rolling > yesterday. I would appreciate any help ASAP.) > > Thanks. > > Larry > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
> My question is how I can do that after I get the data from the database? I > mean how I can make this admin module to work? You'll need to have to use str_replace/ereg_replace or similar to alter the keywords you dream up into HTML. EG: $html = str_replace("[LINK]", "<A HREF=", $content); All in all, though, it sounds like you are re-inventing the wheel... Various templating systems (PHPLib, FastTemplate, et al) and HTML-editors (eGrail springs to mind) already provide this functionality... Unless you're just doing this to learn, I'd look into just using one of those.
PHP parse error, or SQL parse error?... If it's PHP, you may need to look at the *previous* line, or even a bunch of lines before that if you are missing a { or } or have messed up quotes. If it's an SQL error, you probably don't have any data in $HTTP_POST_VARS['UserName'] or $HTTP_POST_VARS['Password'] It's a Good Idea to do this: $query = "Select * from Sky where SkyUName = '".$HTTP_POST_VARS['UserName']."' AND SkyPasswd = '".($HTTP_POST_VARS['Password'])."'"; #echo $query, "<BR>\n"; $sqlCheckLogin = sqlExecute($query); Then you can uncomment the query output to debug what your SQL looks like easily. ----- Original Message ----- From: "Wade Halsey" <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Monday, January 15, 2001 12:16 AM Subject: [PHP] Parse Error Hi Im getting a parse error with this: $sqlCheckLogin = sqlExecute( "Select * from Sky where SkyUName = '".$HTTP_POST_VARS['UserName']."' AND SkyPasswd = '".($HTTP_POST_VARS['Password'])."'" ) ; Help!!!!
> compiled PHP3/PHP4 as external CGI under Apache. > virtual("test.html"); > Does is not work in a CGI-PHP ? Correct. virtual() cannot work in CGI. You'll have to use some combination of exec()/fopen()/popen() to achieve what you need.
suExec() does most of what safe_mode would do, and other things besides... I don't think they are compatible... What exactly is your suExec'ed PHP able to do that you want to not allow? ----- Original Message ----- From: Ian Gulliver <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Monday, January 15, 2001 11:58 AM Subject: [PHP] safe mode in 4.0.4pl1 > I'm running PHP 4.0.4pl1 as a CGI under Apache 1.3.14 with suexec. > Whenever I turn on safe_mode in php.ini, the following messages appear > from a script owned by and running as uid 1013 which is trying to include > files owned by uid 1013 in a directory owned by 1013: > > Warning: SAFE MODE Restriction in effect. The script whose uid is -1 is > not allowed to access header.php owned by uid 1013 in archive.php on line > 1. > > Any help would be much appreciated. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
> <? > if (ereg !=("^[0-9]+[.]?[0-9]*$", $val1)) { > header("Location:http://localhost/calculate_form.html"); > exit; > > But the script will attempt to perform calculations on non numeric > fields and > > I also want it to return the form if anyone puts in a non numeric value. > > I think I need some ereg something like: > > (ereg("^[0-9]+[.]?[0-9]*$", $i, $p)) I dunno what's in the book, but I think what is supposed to be there is somewhere between the two: if (!ereg("^[0-9]+[.]?[0-9]*$", $val1)) { header("Location:http://localhost/calculate_form.html"); exit; } In other words, if the first argument to your calculator doesn't look like a number, it sends you back. ^ means "must start with" [0-9] means "0 through 9" + means "at *least* one, but maybe more" [.] means "." ? means "maybe we'll have that '.', and maybe we won't" [0-9] means "0 through 9" * means "maybe none, or maybe lots" $ means "must end with" So, all together, it has to start with a digit, it might or might not have a decimal point, and it might or might not have a bunch more digits, and it has to end there without anything else.
> I'm writing a SYSV LP script in PHP so that I can have a > print-to-database (MySQL) solution. First question: Am I wasting my > time? Are there already canned solutions? (LPRng perhaps?) I think you could just exec() it... exec("/usr/bin/lp $blah", $output, $error); while (list(,$line) = each($output)){ echo $line, "<BR>\n"; } if ($error){ echo "OS Error $error. Usually path/permissions, but with a printer involved...<BR>\n"; } Or maybe I'm not reading enough into the phrase print-to-database, and you're doing something horribly more complicated than I think... > Second question: How do I go about opening file descriptors by > numeric referance? (LP calls script with file descriptors for passing back > debug and status info). You mean like this? $printer = fopen("/dev/3", "r"); I dunno what number your OS assigns to the printer, but 3 probably isn't it... There's also PHP constants for stdin, stdout, and stderr, and there just might be one for the printer, though I've never noticed it. > Third question: How do I trap a signal (SIGTERM specifically) in a > PHP script? Maybe, maybe, maybe... The socket() stuff will let you do that... http://php.net/manual/en/ref.sockets.php > Obviously, I have the latest PHP compiled as a CGI with native MySQL > support. My OS environ is Solaris 7. You may need to recompile with the socket stuff, which I think is optional.
> I've got a strange thing with overriding an ini file in PHP. > > I'm trying to implement a simple example of a script that allows a file to be > uploaded. > > I put an <INPUT TYPE="file" NAME="myfile" ENCTYPE="multipart/form-data"> tag ENCTYPE goes in the FORM tag, I think... > on the form, along with a submit button. (yeah, the rest of the HTML is > fine...) > > The script gets the file, uploads it, and the $myfile variable says the > uploaded file is named something like "/var/tmp/phpq32345". However, I don't > have write permissions to /var/tmp. (Neither does the process doing the > actual upload!) What process is it that you think is doing the upload?... It's usually "nobody" who owns it, which usually does have write access to /tmp files. Or, maybe in your OS, /var/tmp files. If PHP says it got it there, it probably did. But then you must copy it or process it, because PHP will delete it when the script ends -- to avoid a denial-of-service attack where somebody tries to upload a million little files through your web-server to fill up /tmp. > I created a php3.ini file in the same directory that contains the script. > It has only the line: > > upload_tmp_dir = myuploads > > Then I created a directory named myuploads in the same dir with 2777 > perms. > > However, the script never sees this ini file! I printed out the cwd from > the script, and it IS the same dir where the php3.ini file resides; I can > even exec a command 'ls -l *.ini' and it shows up there just fine. You can't do that in a php.ini file in the same directory. You *can* do it (maybe) with an .htaccess file, if Apache has .htaccess turned on in httpd.conf, and upload_tmp_dir isn't one of the non-over-ridable directives.
Richard Lynch wrote: > > I've got a strange thing with overriding an ini file in PHP. > > > > I'm trying to implement a simple example of a script that allows a file to > be > > uploaded. > > > > I put an <INPUT TYPE="file" NAME="myfile" ENCTYPE="multipart/form-data"> > tag > > ENCTYPE goes in the FORM tag, I think... maybe, but this is copied straight out of a PHP book I've got by Judy Meloni > > on the form, along with a submit button. (yeah, the rest of the HTML is > > fine...) > > > > The script gets the file, uploads it, and the $myfile variable says the > > uploaded file is named something like "/var/tmp/phpq32345". However, I > don't > > have write permissions to /var/tmp. (Neither does the process doing the > > actual upload!) > > What process is it that you think is doing the upload?... PHP scripts run as user nobody on this system > It's usually "nobody" who owns it, which usually does have write access to > /tmp files. Or, maybe in your OS, /var/tmp files. If PHP says it got it > there, it probably did. PHP gives me a file name like what I showed above, but it's not there by the time the script tries to copy it. We're not talking a huge script here -- an exec( "ls -l $myfile" ) doesn't find the file. If it was ever there, it's gone almost instantaneously. > But then you must copy it or process it, because > PHP will delete it when the script ends -- to avoid a denial-of-service > attack where somebody tries to upload a million little files through your > web-server to fill up /tmp. > > > I created a php3.ini file in the same directory that contains the script. > > It has only the line: > > > > upload_tmp_dir = myuploads > > > > Then I created a directory named myuploads in the same dir with 2777 > > perms. > > > > However, the script never sees this ini file! I printed out the cwd from > > the script, and it IS the same dir where the php3.ini file resides; I can > > even exec a command 'ls -l *.ini' and it shows up there just fine. > > You can't do that in a php.ini file in the same directory. > You *can* do it (maybe) with an .htaccess file, if Apache has .htaccess > turned on in httpd.conf, and upload_tmp_dir isn't one of the > non-over-ridable directives. The things I've read say the php3.ini file goes in the "current directory". I'm not sure which one that is, but it's obviously not the one containing the script files. Any other ideas?
> We are running PHP 4 on a Solaris 2.7 box with Apache 1.3.11 with mod_perl > 1.24. > We need to communicate with 3rd-party Perl APIs from within PHP to handle > processing of a form. The API functions each expect an associated array and > will return a result value to the calling party. The Perl scripts munge the actual array passed in?... I dunno if you can do that... > I would assume that we would use exec( 'perl cgi-bin/myscript.pl', > $assoc_array, $return_value) to do this, placing the perl script I write to > handle the values in the server's cgi-bin directory. I would expect it to be more like: $command = "/usr/bin/perl cgi-bin/myscript.pl "; while (list($key, $value) = each($assoc_array); $command .= "$key=$value "; } exec($command, $output, $error); while (list(,$line) = each($output)){ echo $line, "<BR>\n"; } if ($error){ echo "OS Error $error<BR>\n"; } Not sure at all if myscript.pl will take the array that way: You may need to write a wrapper script to take key/value pairs and bundle them up to pass off to myscript.pl
> <?PHP > $string = "[["; Okay. I don't think [ is special in PHP. { is a new special character, though. > $string = preg_replace("/(\W)/", "\\\\1", $string); \W -- what's that? You probably need \\W there... > ?> > > $string would then contain "\[\[". I dunno about that. This Regex stuff is over my head usually. I find that I can usually write a str_replace and/or use strtok and write a mini-parser faster than I can wrap my poor little brain around all those secret characters.
Try the Apache/MySQL/PHP Mailing List also: To unsubscribe from this list, just send a blank message to [EMAIL PROTECTED] To switch to or start with the digest version, send a blank message to [EMAIL PROTECTED] This list is hosted as a public service by Dynapolis Internet Communities http://www.dynapolis.com Listmaster <[EMAIL PROTECTED]> which makes me guess the subscribe is [EMAIL PROTECTED] ----- Original Message ----- From: Erick Schmidt <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Monday, January 15, 2001 5:48 PM Subject: [PHP] PHP & FDF on Linux PPC > Has anyone configured PHP to work with FDF on a PPC box? > > If so, do you have any helpful hints that may get me up and running. > > Thanks for the help. > > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Richard Lynch wrote: > > Try the Apache/MySQL/PHP Mailing List also: > > To unsubscribe from this list, just send a blank message to > [EMAIL PROTECTED] > > To switch to or start with the digest version, send a blank message to > [EMAIL PROTECTED] > > This list is hosted as a public service by Dynapolis Internet Communities > http://www.dynapolis.com Listmaster <[EMAIL PROTECTED]> > > which makes me guess the subscribe is [EMAIL PROTECTED] > > ----- Original Message ----- > From: Erick Schmidt <[EMAIL PROTECTED]> > Newsgroups: php.general > Sent: Monday, January 15, 2001 5:48 PM > Subject: [PHP] PHP & FDF on Linux PPC > > > Has anyone configured PHP to work with FDF on a PPC box? Pardon my ignorace, but what is FDF? I've done a lot with Linux on PowerPC, but I am unfamiliar with FDF. > > > > If so, do you have any helpful hints that may get me up and running. > > > > Thanks for the help. > > > > [EMAIL PROTECTED] *SNIP* [EMAIL PROTECTED] -- -=-=-=-=-=-=-=-=-=-=-=-=- Michael A. Peters Abriasoft Senior Developer
Unless I'm even more confused than usual about something I've long believed to be true... MagicQuotes does not ever strip slashes. MagicQuotes does an addslashes before the data gets into the database. Are you viewing the same record all the time, or is it possible that one of your records has an extra \ in it? ----- Original Message ----- From: Roy <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Monday, January 15, 2001 5:48 PM Subject: [PHP] Magic Quotes - Problems with Inconsistent Behavior removing Slashes > I'm seeing strange behavior with Magic Quotes in PHP on my ISP hosted > accounts. Basically, it's not consistently removing the escaped backslashes > before displaying. > > For instance, take the following piece database text (stored in, say, a > character field).... > > It's fun to be a penguin. > > If I do a simple retrieve and echo on a webpage, I will get the following > 80% of the time.. > > It's fun to be a penguin. > > But, the other 20% of the time I get > > It\'s fun to be a penguin. > > There's something inconsistent about the way MagicQuotes are removed by the > system...it's as if the system gets "busy" or the cache gets flushed before > PHP gets the opportunity to unescape the single quotes. > > Is anyone else seeing this behavior and has any suggestions on how to make > it work more consistent? Yes, I've been including "stripslashes" to try to > make SURE that these slashes get removed, but that doesn't work all the > time EITHER. > > Roy > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Richard, It's the same record every time that shows the different behavior. The code is extremely straightforward, just retrieve the record and display it. And, I've got other scripts on the same host that also display this behavior intermittantly. MagicQuotes is turned on. And, it typically DOES remove the escaped out characters automatically. So, I guess I need to read up more on MagicQuotes to see if there's any known information on how it could fail periodically (perhaps under heavy load conditions or incombination with something else?). I've posted a note on the ISP's discussion forum as well to see if anyone else hosting their content there have seen similar behavior. Roy At 10:07 PM 1/15/01 -0600, you wrote: >Unless I'm even more confused than usual about something I've long believed >to be true... > >MagicQuotes does not ever strip slashes. > >MagicQuotes does an addslashes before the data gets into the database. > >Are you viewing the same record all the time, or is it possible that one of >your records has an extra \ in it? > > >----- Original Message ----- >From: Roy <[EMAIL PROTECTED]> >Newsgroups: php.general >Sent: Monday, January 15, 2001 5:48 PM >Subject: [PHP] Magic Quotes - Problems with Inconsistent Behavior removing >Slashes > > >> I'm seeing strange behavior with Magic Quotes in PHP on my ISP hosted >> accounts. Basically, it's not consistently removing the escaped >backslashes >> before displaying. >> >> For instance, take the following piece database text (stored in, say, a >> character field).... >> >> It's fun to be a penguin. >> >> If I do a simple retrieve and echo on a webpage, I will get the following >> 80% of the time.. >> >> It's fun to be a penguin. >> >> But, the other 20% of the time I get >> >> It\'s fun to be a penguin. >> >> There's something inconsistent about the way MagicQuotes are removed by >the >> system...it's as if the system gets "busy" or the cache gets flushed >before >> PHP gets the opportunity to unescape the single quotes. >> >> Is anyone else seeing this behavior and has any suggestions on how to make >> it work more consistent? Yes, I've been including "stripslashes" to try to >> make SURE that these slashes get removed, but that doesn't work all the >> time EITHER. >> >> Roy >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] >> > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] >
> The thing that always seems to screw me up is the difference in new lines between windows and *nix ... at the end of the day you need to play with the --records-separated-by clause in the mysqlimport line ... the permutations to play with are ='\n' v. '\r\n' ... you're shooting to get 0 in the warnings indicator. I never got that --records-desparated-by thing to do what I wanted, and always found that converting to Un*x before uploading and uploading as binary works easiest... That's just me, though. After all these years, couldn't two of these three end-of-line formats swallow their pride and just deprecate themselves?...
> After all these years, couldn't two of these three end-of-line formats > swallow their pride and just deprecate themselves?... ... and break everything *else* that depends on them? Jason -- Jason Murray [EMAIL PROTECTED] Web Design Team, Melbourne IT Fetch the comfy chair!
Thanks for the reply. I'd like to ensure that numbers entered are in any of these formats: 123 4567 1234567 +91 44 123 4567 +91 44 1234567 91-44-123 4567 91-44-1234567 Number will be a minimum of 5 digits. TIA Vikram At 12:11 AM 1/16/01 +1100, Angus Mann wrote: >At 17:55 15/01/01 +0500, Vikram Vaswani wrote: >>Hi! >> >>Can someone help me out with a regex to validate a phone number? > >We'd need to know what format of telephone numbers you're looking to >validate, first. > >Angus. >
> 123 4567 > 1234567 > +91 44 123 4567 > +91 44 1234567 > 91-44-123 4567 > 91-44-1234567 So, 91441234567 and 9 1 4 4 1 2 3 4 5 6 7 aren't valid? You *could* apply a rule here, but it's fallible. 1. Strip out everything thats not a number (ereg_replace("[^0-9]", "")). 2. Count the number of digits. a. If there's less than 7 digits, its invalid. b. 7 digits is valid, local number format. c. 8, 9, and 10 digit numbers are invalid. d. 11 digits is valid, international format. Of course, if someone has a mobile phone this will fall flat on its face (in Australia, our phone numbers have 8 digits and our mobiles have 10 digits - this is the same in a number of countries). My advice, check that there's at least 7 digits and let it go. Jason -- Jason Murray [EMAIL PROTECTED] Web Design Team, Melbourne IT Fetch the comfy chair!
I need to run a script that renames a file and deletes an old one then ships it to another server every monday at a certain time.... I know this is possible, but what is the technology called? Does PERL or PHP have the ability to do this? Can I get CRON objects to run PHP source code? PLEASE HELP!!! -Tait
I need to run a script that renames a file and deletes an old one then ships it to another server every Monday at a certain time.... I know this is possible, but what is the technology called? Does PERL or PHP have the ability to do this? Can I get CRON objects to run PHP source code? PLEASE HELP!!! -Tait
> I need to run a script that renames a file and deletes an old > one then ships it to another server every Monday at a certain > time.... I know this is possible, but what is the technology > called? Does PERL or PHP have the ability to do this? Can I > get CRON objects to run PHP source code? Is this an example of such a script, emailling the same mail to the mailing list every monday at a specific time? I already replied to you off-list. Jason -- Jason Murray [EMAIL PROTECTED] Web Design Team, Melbourne IT Fetch the comfy chair!
This is the same sort of error I'm getting. Try printing out the variables $userfile $userfile_name $userfile_size $userfile_type Telnet or ssh into your system and see if the file is getting transferred into the directory identified in $userfile. In my case, the upload file isn't getting saved in the /var/tmp directory, so the copy statement has nothing to copy from. Unfortunately, the error message appears to point to the output file, when the error is on the input side of the equation. Let me know what you find. -David Schwartz Mike Yuen wrote: > I am trying to allow various users to upload their own picture. What I > would like to happen is to have the copy statement rename the .jpg > image to the username. For example, if the username is mike, then I want > the picture to be renamed mike.jpg > > The following is a snippet of code: > > <?PHP > print "$CUserName" //ensures name is carried over from session > > if(copy($userfile,"c:/phpweb/userpics/$CUserName.jpg")) > { > print "Your picture has been uploaded!"; > } > else > { > print "Error"; > } > > unlink($userfile) > ?> > > The errors I get are as follows: > Warning: unable to open " for reading: Permission denied in > c:\phpweb/fuploadconfirm.php on line 15 > Warning: Unlink failed (No such file or directory) in > c:\phpweb/fuploadconfirm.php on line 31 > > Line 15 is the if copy($userfile........) line in the above code > > AND > > Line 31 is the unlink statement at the end. > > Thanks, > Mike > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Mike, I haven't had a problem. I'm using Apache 1.3.14 with PHP 4.0.3pl1 + 4.0.4. I use the same code on 3 computers (depending on where I am when I'm working on it. Normally it's Win95, but Win2k and WinNT are used as well. The snippet of code I use is: --code 1----- list($scriptBase, ) = explode($HTTP_SERVER_VARS["SCRIPT_NAME"], $HTTP_SERVER_VARS["SCRIPT_FILENAME"]); ------------- --code 2----- { $j=0; for ($i=1;$i<6;$i++) { $addnewName = "photo" . $i; $addnewSize = "photo" . $i . "_size"; if (${$addnewSize} > 0) { copy(${$addnewName}, 'temp/'.$SessionID.'.'.++$j.'.jpg'); $addnewSession['photo'.$j] = 'temp/'.$SessionID.'.'.$j.'.jpg'; unlink (${$addnewName}); } } $addnewSession["photos"] = $j; } ------------- --code 3----- for ($i=1;$i<=$addnewSession["photos"];$i++) { if (!@copy($addnewSession["photo".$i], $scriptBase."/images/property/".$addnewPropertyID.",".$i.".jpg")) { $addnewFileErrors .= " c".$i; } if (!@unlink($addnewSession["photo".$i])) { $addnewFileErrors .= " d".$i; } } ------------- The first line just sets $scriptBase as the base of the web site (so I can use it anywhere, 'cause moving computers may mean different locations, and as all the needs of the site is below the site's root, then I just need to work out where the base of the site is. The next set of code is to move the files to a temp location (until the script deals with them in the third chunk). Someone can upload up to five photos, so this will just go thru each of them, and if there's a file (I know it a photo - the check was done earlier), 'cause it's size is greater than zero, then move it. This code will also group together the photos (if someone uploaded a file in photo1, photo3 and photo4, then 3 will become 2 and so on, so the photos end up as 1, 2, and 3). It also stores the photo's location in the session var, as well as the number of photos. The second lot just moves them to their final location. I haven't tested this code on Linux/Unix servers, but I know it works on Windows/Apache using PHP 4.0.3 and PHP 4.0.4, irrespective on the operating system and where the files are located. See if that helps. I don't know why yours shouldn't work, but I've posted my code so you can see and work with it to help yours. At 09:36 PM 1/15/01, you wrote: I am trying to allow various users to upload their own picture. What I would like to happen is to have the copy statement rename the .jpg image to the username. For example, if the username is mike, then I want the picture to be renamed mike.jpg The following is a snippet of code: <?PHP print "$CUserName" //ensures name is carried over from session if(copy($userfile,"c:/phpweb/userpics/$CUserName.jpg")) { print "Your picture has been uploaded!"; } else { print "Error"; } unlink($userfile) ?> The errors I get are as follows: Warning: unable to open " for reading: Permission denied in c:\phpweb/fuploadconfirm.php on line 15 Warning: Unlink failed (No such file or directory) in c:\phpweb/fuploadconfirm.php on line 31 Line 15 is the if copy($userfile........) line in the above code AND Line 31 is the unlink statement at the end. Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __________________________________________________ Jonathan Wright (DjNA) [EMAIL PROTECTED]
Hi, I need to run a PHP script or a PHP page, few times every morning, say 10 times between 7am and 8am every morning to see if a cretin database condition is met. Is it possible? ============================== Shimon Dekel Israeli Vegetable Board Information System Manager 2 Karlibach St Tel-Aviv 67132 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] <http://www.yerek.co.il> www.yerek.co.il ==============================
Hello Shimon, Information to generally setup a cron tab : How do I set up a cron job on Linux? ------------------------------------------------------------------- http://www.faqts.com/knowledge_base/view.phtml/aid/1005/fid/436 In regards to php : How can I make a PHP script be called from the cron daemon? ------------------------------------------------------------------- http://www.faqts.com/knowledge_base/view.phtml/aid/80/fid/32 Also, search mailing list for word 'cron' and many results will come about. Here's a link to such a search : http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=cron&q=b Good luck! -- Philip Olson http://www.cornado.com/ On Tue, 16 Jan 2001, Shimon Dekel wrote: > Hi, > I need to run a PHP script or a PHP page, few times every morning, say > 10 times between 7am and 8am every morning to see if a cretin database > condition is met. > Is it possible? > > > > ============================== > Shimon Dekel Israeli Vegetable Board > Information System Manager > 2 Karlibach St Tel-Aviv 67132 > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > <http://www.yerek.co.il> www.yerek.co.il > ============================== > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Sure. I would use cron. see crontab(5). You could also use any other type of scheduling software. In case you didn't know, you can run PHP scripts without a web server. Simply compile php without apache. Then you can run your script like this: /usr/bin/php your_script.php (if you install the php binary in /usr/bin) Hope this helps. Jeremy Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED] http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more Get your own Free, Private email at http://www.smackdown.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.JEEP-FOR-SALE.com/ -- I need a buyer On Tue, 16 Jan 2001, Shimon Dekel wrote: > Date: Tue, 16 Jan 2001 09:16:36 +0200 > From: Shimon Dekel <[EMAIL PROTECTED]> > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: [PHP] Running a php script at a giveb time > > Hi, > I need to run a PHP script or a PHP page, few times every morning, say > 10 times between 7am and 8am every morning to see if a cretin database > condition is met. > Is it possible? > > > > ============================== > Shimon Dekel Israeli Vegetable Board > Information System Manager > 2 Karlibach St Tel-Aviv 67132 > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > <http://www.yerek.co.il> www.yerek.co.il > ============================== > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
>Jeremy Brant wrote: >In case you didn't know, you can run PHP scripts without a web server. Thanks but... Can you do this on NT (Sorry) as well? I am using NT with MySQL in the CGI configuration. Shimon ============================== Shimon Dekel Israeli Vegetable Board Information System Manager 2 Karlibach St Tel-Aviv 67132 [EMAIL PROTECTED] www.yerek.co.il ============================== -----Original Message----- From: jeremy brand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 8:46 AM To: Shimon Dekel Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP] Running a php script at a giveb time Sure. I would use cron. see crontab(5). You could also use any other type of scheduling software. In case you didn't know, you can run PHP scripts without a web server. Simply compile php without apache. Then you can run your script like this: /usr/bin/php your_script.php (if you install the php binary in /usr/bin) Hope this helps. Jeremy Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED] http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more Get your own Free, Private email at http://www.smackdown.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.JEEP-FOR-SALE.com/ -- I need a buyer On Tue, 16 Jan 2001, Shimon Dekel wrote: > Date: Tue, 16 Jan 2001 09:16:36 +0200 > From: Shimon Dekel <[EMAIL PROTECTED]> > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: [PHP] Running a php script at a giveb time > > Hi, > I need to run a PHP script or a PHP page, few times every morning, say > 10 times between 7am and 8am every morning to see if a cretin database > condition is met. > Is it possible? > > > > ============================== > Shimon Dekel Israeli Vegetable Board > Information System Manager > 2 Karlibach St Tel-Aviv 67132 > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > <http://www.yerek.co.il> www.yerek.co.il > ============================== > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
Shimon Dekel <[EMAIL PROTECTED]> wrote in message 2B851D414E69D411923000D0B789259A0697@EXCHANGE">news:2B851D414E69D411923000D0B789259A0697@EXCHANGE... > >Jeremy Brant wrote: > >In case you didn't know, you can run PHP scripts without a web server. > Thanks but... > Can you do this on NT (Sorry) as well? I am using NT with MySQL in the > CGI configuration. > Shimon The pre-compiled binaries package of PHP for Windows includes the stand-alone CGI program, php.exe. You just need to find use the WindowsNT scheduling system and tell it to either run php.exe directly, or make up batch files to do the job. -- Rick Hodger
Quoting Jani Taskinen <[EMAIL PROTECTED]>: > On Mon, 15 Jan 2001, Cal Evans wrote: > > >But when I ./configure php, I use: > > > >./configure --with-pdflib=/usr/local/lib > > Leave the /lib part out..ie. use --with-pdflib=/usr/local > instead. Furthermore, make sure you use 4.0.4pl1 as 4.0.4 is buggy with PDFlib. Lee.
At 14.54 -0500 01-01-15, Tim Zickus poked the keyboard as follows: > > Wow, I never thought of using the remote IP! Thanks for the tip. I >> am going to use it today for an authentication system I'm building. > >Please note that remote IP is NOT reliable. For clients behind the proxies >& gateways of large ISP's (AOL is the prime example) you can see the remote >address bounce around from number to number, even within the same session, >depending on which path the data takes. > Ach, oy vey! Then, having looked at AOL's info, it seems to me that perhaps one could build a function or class that could evaluate against a known list of alternate proxies. So, if the request came from 152.163.197, it would recognize that as an AOL proxy and just code the current proxy as "AOL" or something. Each subsequent request (from 152.163.* etc.) would go through the same filter. Obviously, this means that the system could be vulnerable to being compromised by someone working through a large ISP such as AOL, but I think it's unlikely that people with the expertise to sniff cookies and such would be using AOL. And anyway, the system would still be more secure than if I weren't using IP verification at all. Does anyone one know of a class or function that's been already built to do this? Kristofer -- ______________________________________ Kristofer Widholm Web Pharmacy [EMAIL PROTECTED] 191 Grand Street, Brooklyn NY 11211 718.599.4893 ______________________________________
Hi, I just struggled with quoting in php3 and php4. Traditional old-style raw data would be nice to have but using set_magic_quotes_runtime (false) doesn't help. Should that turn it off anyway? Another thing not documented to me is get_magic_quotes_gpc (). What does the gpc part mean? Best regards, Sven Klose
> I just struggled with quoting in php3 and php4. Traditional > old-style raw data would be nice to have but using > set_magic_quotes_runtime (false) doesn't help. Should that > turn it off anyway? It is likely already off. magic_quotes_runtime is a legacy feature nobody uses anymore. > Another thing not documented to me is get_magic_quotes_gpc (). What > does the gpc part mean? magic_quotes_gpc is likely what you are after. GPC means GET/POST/COOKIE which is actually EGPCS these days (Environment, GET, POST, Cookie, Server). This cannot be turned off in your script because it operates on the data before your script is called. You can check if it is on using that function and treat the data accordingly. -Rasmus
It is easy to generate javascript through php,but how to call php through javascript. In fact, I'd like to update some form fields according to events on other fields. I can do this using javascript, but the values should be readed in a MySql database. Thank's Patrice
> It is easy to generate javascript through php,but how to call php through > javascript. > In fact, I'd like to update some form fields according to events on other > fields. I can do this using javascript, but the values should be readed in a > MySql database. You're in a serverside, clientside problem. You want the client to execute the PHP code, which it cannot. If you want to update the form fields with some other data, you have to provide the page you sent to the client with all the needed data beforehand. Regards, Soeren Staun-Pedersen - [EMAIL PROTECTED] ------ "The internet is full, beat it" - Me.
In general: We made a script which did this, however a bit limited because of the client/server-problems mentioned. The script is part of a registration-form, and pick out a city based on the zip entered. We didn't want the list of zipcodes and cities in JS since it would be quite huge. Don't remember the excacts but in general: (simplified model) <form name=oFrm> <input name=zip onBlur='fetch();'><input name=city> </form> Fetch() is a function that opens a new pop-up window at 50x50px, and set the url-property of this window using JS (ex:) var strURL = "find_city.php?zip=" + document.oFrm.zip.value; The find_city.php script recieves the zip in a get-var, and can connect to mysql and retrieve the city etc. and closes itself. find_city then outputs JS (ex): <script> opener.document.oFrm.city.value = "$the_right_city"; self.close(); </script> The "drawbacks" here is a window flashing a short second or so... You can make this thing run queries or whatever... Wrote the above from memory, so the syntax might be a bit of, but the flow is the same. have a nice day! -Jørg V. Bryne ----- Original Message ----- From: "Patrice ROTH" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 10:04 AM Subject: [PHP] javascript and php > It is easy to generate javascript through php,but how to call php through > javascript. > In fact, I'd like to update some form fields according to events on other > fields. I can do this using javascript, but the values should be readed in a > MySql database. > > Thank's > Patrice > ----- Original Message ----- From: "Soeren Staun-Pedersen" <[EMAIL PROTECTED]> To: "Patrice ROTH" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 10:08 AM Subject: Re: [PHP] javascript and php > > It is easy to generate javascript through php,but how to call php through > > javascript. > > In fact, I'd like to update some form fields according to events on other > > fields. I can do this using javascript, but the values should be readed in a > > MySql database. > > You're in a serverside, clientside problem. You want the client to execute > the PHP code, which it cannot. If you want to update the form fields with > some other data, you have to provide the page you sent to the client with > all the needed data beforehand. > > Regards, > > Soeren Staun-Pedersen - [EMAIL PROTECTED] > ------ > "The internet is full, beat it" > - Me. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hi people Looking for a piece of advice about what is wrong with this sniplet and what is the right one. I tried to write the html using print(""); as below: print("<td>"); print("<input type='button' value='back' onclick='self.history.back()';"); print("</td>"); what happen was that when the html page was generated, that specific part did not apear on the page, although the source can be seen using view source. What did I do wrong? cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
print("<input type='button' value='back' onclick='self.history.back()';"); lacks a > at the end of the input-tag print("<input type='button' value='back' onclick='self.history.back()';>"); ----- Original Message ----- From: "Jacky@lilst" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 11:28 PM Subject: [PHP] what is wrong with this sniplet? Hi people Looking for a piece of advice about what is wrong with this sniplet and what is the right one. I tried to write the html using print(""); as below: print("<td>"); print("<input type='button' value='back' onclick='self.history.back()';"); print("</td>"); what happen was that when the html page was generated, that specific part did not apear on the page, although the source can be seen using view source. What did I do wrong? cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
I think it should be ... onClick='javascript:self.history.back()'... --- "Jacky@lilst" <[EMAIL PROTECTED]> wrote: > Hi people > Looking for a piece of advice about what is wrong > with this sniplet and what is the right one. I > tried to write the html using print(""); as below: > print("<td>"); > print("<input type='button' value='back' > onclick='self.history.back()';"); > print("</td>"); > > what happen was that when the html page was > generated, that specific part did not apear on the > page, although the source can be seen using view > source. > What did I do wrong? > cheers > Jack > [EMAIL PROTECTED] > "There is nothing more rewarding than reaching the > goal you set for yourself" > __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
I thought it was <a href="javascript:history.back(N)">, where N is the number of jumps back you want to make. I could be wrong about this. -----Original Message----- From: Christian Cresante [mailto:[EMAIL PROTECTED]] Sent: 16 January 2001 13:13 To: php Subject: Re: [PHP] what is wrong with this sniplet? I think it should be ... onClick='javascript:self.history.back()'... --- "Jacky@lilst" <[EMAIL PROTECTED]> wrote: > Hi people > Looking for a piece of advice about what is wrong > with this sniplet and what is the right one. I > tried to write the html using print(""); as below: > print("<td>"); > print("<input type='button' value='back' > onclick='self.history.back()';"); > print("</td>"); > > what happen was that when the html page was > generated, that specific part did not apear on the > page, although the source can be seen using view > source. > What did I do wrong? > cheers > Jack > [EMAIL PROTECTED] > "There is nothing more rewarding than reaching the > goal you set for yourself" > __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi all! How can I check (in PHP code) if the target browser supports image displaying or not? Thanks, Vlad.
On Tuesday 16 January 2001 09:30, Vlad wrote: > Hi all! > How can I check (in PHP code) if the target browser supports image > displaying or not? PHP manual/misc. functions/get_browser() -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) What luck for the rulers that men do not think. - Adolf Hitler
Oops, forgot that I actually close the input tage, the previous one was the mistype. print("<td>"); print("<input type='button' value='back' onclick='self.history.back()';>"); print("</td>"); what happen was that when the html page was generated, that specific part did not apear on the page, although the source can be seen using view source. What did I do wrong? cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
Hi Jack, Firstly, this is an HTML issue. You can lose the ; and I'd run your page through a validator, such as : http://validator.w3.org/ It must be a table issue or something. For example, when isolated this works just fine : <table> <tr> <?php print("<td>"); print("<input type='button' value='back' onclick='self.history.back()'>"); print("</td>"); ?> </tr> </table> Regards, Philip On Tue, 16 Jan 2001, Jacky@lilst wrote: > > Oops, forgot that I actually close the input tage, the previous one was the mistype. > print("<td>"); > print("<input type='button' value='back' onclick='self.history.back()';>"); > print("</td>"); > > what happen was that when the html page was generated, that specific part did not >apear on the page, although the source can be seen using view source. > What did I do wrong? > cheers > Jack > [EMAIL PROTECTED] > "There is nothing more rewarding than reaching the goal you set for yourself" >
Hi Ive selected some details from a database and now want to loop through the result and populate a row in a table each time. $sqlCurrentTraces = sqlExecute( "Select * from Sky where No = '$Name'" ); $result = sqlFetchObject( $sqlCurrentTraces ); $SkyDateAss = $result ->DATEASSIGNED; $SkyDateResult = $result ->DATEAOFRESULT; $SkyAccNo = $result ->ACCNO; I want to do the stuff below: <tr><td> <? echo $SkyAccNo ?></td><td> <? echo $SkyDateAss ?></td><td> <? echo $SkyDateResult ?></td><td><input type="submit" name="UpdateDiary" value ="Update Diary"></td></tr> The sql qorks and the table is populated once. Help someone? Thanks Wade [EMAIL PROTECTED]
Although the syntax is a little odd, let's go with it : while ($result = sqlFetchObject(sqlCurrentTraces)) { $SkyDateAss = $result ->DATEASSIGNED; $SkyDateResult = $result ->DATEAOFRESULT; $SkyAccNo = $result ->ACCNO; print "<br>$SkyAccNo -- $SkyDateAss -- $SkyDateResult \n"; } consider changing variable names $sqlCurrentTraces to $result and $result to something like $row and it may make more sense. or at the very least, be more "standard" also, SkyDateAss struck me as funny. Philip On Tue, 16 Jan 2001, Wade Halsey wrote: > Hi > > Ive selected some details from a database and now want to loop through the result >and populate a row in a table each time. > > > $sqlCurrentTraces = sqlExecute( "Select * from Sky where No = '$Name'" ); > $result = sqlFetchObject( $sqlCurrentTraces ); > > $SkyDateAss = $result ->DATEASSIGNED; > $SkyDateResult = $result ->DATEAOFRESULT; > $SkyAccNo = $result ->ACCNO; > > I want to do the stuff below: > <tr><td> <? echo $SkyAccNo ?></td><td> <? echo $SkyDateAss ?></td><td> <? echo >$SkyDateResult ?></td><td><input type="submit" name="UpdateDiary" value ="Update >Diary"></td></tr> > > The sql qorks and the table is populated once. > > Help someone? > > Thanks > Wade > [EMAIL PROTECTED] > >
You need a while loop: $sqlCurrentTraces = sqlExecute(...) while ($result = sqlFetchObject( $sqlCurrentTraces ) { ... your table stuff ... } - Tim http://www.phptemplates.org ----- Original Message ----- From: "Wade Halsey" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 4:47 AM Subject: [PHP] Populating table rows Hi Ive selected some details from a database and now want to loop through the result and populate a row in a table each time. ...
Is metabase in the "DB" subdirectory of PEAR? Dean. ----- Original Message ----- From: "Alex Black" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 15, 2001 03.58pm Subject: Re: [PHP] Perl-like DBI and generic SQL > I have found metabase to be superior to any other abstraction layer I've > ever come across. > > Hey, it also allows you to do DB schema definitions with XML files, which is > hugely cool. > > We're running development of commercial-grade (tested, yadda-yadda) doing > development on mySQL, and moving to Oracle in production. With no problems. > > Without metabase, I would consider the above suicidal and idiotic, but with > metabase it works like a charm. > > If you'd like other resources beyond an abstraction layer (like > authentication, permissions, and all kinds of other groovy tools), have a > look at binarycloud.com. > > _a > > > -- > Alex Black, Head Monkey > [EMAIL PROTECTED] > > The Turing Studio, Inc. > http://www.turingstudio.com > > vox+510.666.0074 > fax+510.666.0093 > > Saul Zaentz Film Center > 2600 Tenth St Suite 433 > Berkeley, CA 94710-2522 > > > > > > From: [EMAIL PROTECTED] (Michael Kimsal) > > Newsgroups: php.general > > Date: 15 Jan 2001 06:28:19 -0800 > > Subject: Re: [PHP] Perl-like DBI and generic SQL > > > > > > > > Dean Hall wrote: > > > >> I read once on this list that PHP supports a DBI-like database access object > >> (such as the one in Perl). Is this true? Does anyone know where I can find > >> documentation for it? I can't seem to find it in the manual. > >> > >> Also, how do you all handle generic SQL for multiple DBMSs? I'd like > >> (ideally) to write SQL that is DBMS-independent, although that's probably not > >> possible. I'm very familiar with mysql and not much else; as far as I'm > >> aware, mysql is the primary DBMS that has problems with standard SQL (like > >> nested queries and such). Does anyone even worry about this? > >> > >> I'm writing a little piece of software that I'd like to be as extensible as > >> possible and as usable as possible for people using any DBMS, including > >> mysql. > >> > >> Anyway, if I can't find a generic built-in database interface in PHP, it'll > >> all be moot. I'd really rather not use phplib; I'd like to use an interface > >> built in to the interpreter rather than something that's interpreted on every > >> page access. > >> > > > > You won't find one. The 'benefit' of PHP is that is, for the most part, uses > > native db drivers for access to each db. Should be a bit faster and allows > > access to the specific features of each db. > > > > There is a PEAR repository which offers something similar to DBI, afaik, but > > it's not widely discussed, from what I can see. PEAR is a set of files that > > comes with a distribution, and there is a README. People on shared host > > environments may be out of luck here, though, with respect to a README (d/l > > the file and read it manualyl I guess). > > > > "metabase" from manuel lemos purports to be a single interface to multiple dbs > > - write one SQL statement and it'd do the necessary translation on the SQL to > > be specific to whatever db you are using. Haven't used it, but heard nice > > things about it. But, it violates your 'not interpreted' clause. > > > > Good luck. > > > > > > > > > >> > >> Thanks for the help. > >> Dean. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi all, With the following in one page: <input type=text name=document_title>"; and this in the page called: echo "$document_title"; I am receiving two different results from two different environments under some circumstances, which is causing me a massive headache. My development environment is PHP 4.0.3pl1 running on Windows 95. My live environment is 4.0.1pl2 running on a Cobalt Raq. All is well in both the above until the user enters an apostrophe, upon which the development environment nicely adds a backslash prior to it, allowing it to be saved in Mysql with no additional effort. The live environment, however, does not. I am trying to build quite an advanced system using PHP and I'm finding a number of issues with quotes and double-quotes which makes building dependable code extremely difficult and time consuming. Has anyone else had trouble getting their applications to be 100% water tight regarding user entry? Any help would be greatly appreciated - I've now spent more than one week just messing around with apostrophes in one form or another - this is only the latest of my worries - and I'm sure there are more quote related issues to come :O) Gareth Davies Progressive Business Services Ltd +44 (0) 1274 889592 Office +44 (0) 1274 889656 Fax +44 (0) 7970 733851 Mobile (24 Hour)
> Hi all, > > With the following in one page: > <input type=text name=document_title>"; > > and this in the page called: > echo "$document_title"; > > I am receiving two different results from two different environments > under some circumstances, which is causing me a massive headache. oh my! > My development environment is PHP 4.0.3pl1 running on Windows 95. > My live environment is 4.0.1pl2 running on a Cobalt Raq. > > All is well in both the above until the user enters an apostrophe, upon > which the development environment nicely adds a backslash prior to it, > allowing it to be saved in Mysql with no additional effort. The live > environment, however, does not. this will make perfect sense. live has setting magic_quotes_gpc on, the dev has magic_quotes_gpc off. this is most likely cause at least. see : http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc > I am trying to build quite an advanced system using PHP and I'm finding > a number of issues with quotes and double-quotes which makes building > dependable code extremely difficult and time consuming. Has anyone else > had trouble getting their applications to be 100% water tight regarding > user entry? others have run into similar "issues" as well but after learning why it usually is okay. > Any help would be greatly appreciated - I've now spent more than one > week just messing around with apostrophes in one form or another - this > is only the latest of my worries - and I'm sure there are more quote > related issues to come :O) oh my, should have asked earlier! ;-) regards, philip > > Gareth Davies > Progressive Business Services Ltd > > +44 (0) 1274 889592 Office > +44 (0) 1274 889656 Fax > +44 (0) 7970 733851 Mobile (24 Hour) >
Thanks philip......I must confess to not having ventured too much into the PHP.ini file. Simple when you know how, huh? Thanks again, that's cheered the miserable little mood I've been having this morning! Gareth. ----- Original Message ----- From: Philip Olson <[EMAIL PROTECTED]> To: Gareth Davies <[EMAIL PROTECTED]> Cc: PHP List <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 10:43 AM Subject: Re: [PHP] Version Difference > > Hi all, > > > > With the following in one page: > > <input type=text name=document_title>"; > > > > and this in the page called: > > echo "$document_title"; > > > > I am receiving two different results from two different environments > > under some circumstances, which is causing me a massive headache. > > oh my! > > > My development environment is PHP 4.0.3pl1 running on Windows 95. > > My live environment is 4.0.1pl2 running on a Cobalt Raq. > > > > All is well in both the above until the user enters an apostrophe, upon > > which the development environment nicely adds a backslash prior to it, > > allowing it to be saved in Mysql with no additional effort. The live > > environment, however, does not. > > this will make perfect sense. live has setting magic_quotes_gpc on, the > dev has magic_quotes_gpc off. this is most likely cause at least. see : > > http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc > > > I am trying to build quite an advanced system using PHP and I'm finding > > a number of issues with quotes and double-quotes which makes building > > dependable code extremely difficult and time consuming. Has anyone else > > had trouble getting their applications to be 100% water tight regarding > > user entry? > > others have run into similar "issues" as well but after learning why it > usually is okay. > > > Any help would be greatly appreciated - I've now spent more than one > > week just messing around with apostrophes in one form or another - this > > is only the latest of my worries - and I'm sure there are more quote > > related issues to come :O) > > oh my, should have asked earlier! ;-) > > regards, > > philip > > > > > > Gareth Davies > > Progressive Business Services Ltd > > > > +44 (0) 1274 889592 Office > > +44 (0) 1274 889656 Fax > > +44 (0) 7970 733851 Mobile (24 Hour) > > > >
At 10:37 16/01/01, Gareth Davies wrote: >All is well in both the above until the user enters an apostrophe, upon >which the development environment nicely adds a backslash prior to it, >allowing it to be saved in Mysql with no additional effort. The live >environment, however, does not. Do you have magic_quotes_gpc set in your php.ini file on your RaQ server? - Glen ----------------------------------------------------- Design Solution Limited t: +44 (0)1502 513008 f: +44 (0)1502 588622 e: [EMAIL PROTECTED] w: http://www.designsolution.co.uk Nouvotech House, Harbour Road, Oulton Broad, Suffolk, NR32 3LZ, UK -----------------------------------------------------
Hi, Is there a way to pass variables as 'friendly' urls? So instead of haveing a url like www.blah.co.uk/profile.php?team=tigers i could have www.blah.co.uk/profile.php/team/tigers which would call profile.php and set team to tigers. I've been playing with it but i can't seem to get it to set the variables. It will run the script (profile.php) but the variable $team if still unset. Thanks, William.
You need to parse some of the environment variables to get this data, $pathArray = explode("/",$HTTP_SERVER_VARS[PATH_INFO]) seems to be particularly helpful. Put a call to phpinfo() into your file and see what's there. - Tim > Is there a way to pass variables as 'friendly' urls? So instead of > haveing a url like www.blah.co.uk/profile.php?team=tigers i could have > www.blah.co.uk/profile.php/team/tigers which would call profile.php and set > team to tigers. > I've been playing with it but i can't seem to get it to set the > variables. It will run the script (profile.php) but the variable $team if > still unset.
I have to install in a computer with RedHat 7.0, an Apache web server and php with connection at Microsoft SQL Server 7. Which kind of versions of Apache and php do you recommend? Someone of you has tried it? Which are the more frequently problems? Tank you very much!!! -- Francesc Lladó i Dardet [EMAIL PROTECTED] Interkonet Publishers s.l. Atenes 22 08006 Barcelona Tel. 932 530 866 Fax. 932 530 866 http://www.interkonet.com [EMAIL PROTECTED]
Hi, I want to install PHPLIB but one of the configuration notes says "turn off magic quotes in the php.ini file". OK But I'm, using phpMyAdmin, which I understand NEEDS magic quotes on to work. Has anyone done this using the two together? Kevin Cawthorne
On Tue, 16 Jan 2001, Kevin Cawthorne wrote: > Hi, > > I want to install PHPLIB but one of the configuration notes says "turn off magic >quotes in the php.ini file". > > OK But I'm, using phpMyAdmin, which I understand NEEDS magic quotes on to work. > > Has anyone done this using the two together? Yes, I use .htaccess files to control phplib (you can have multiple phplibs) Tarique ========================================= B2B Application Providers http://www.sanisoft.com Vortal for Nagpur http://nagpurcity.net =========================================
How can you control 'magic quotes' with .htaccess? I thought this is a php.ini command? I kind of have the same problem. My web host has magic quotes off and I would like to use phpMyAdmin. Is it possible to turn them on without accesing the ini file? Mike -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 7:16 AM To: Kevin Cawthorne Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHPLIB and PHPMyAdmin On Tue, 16 Jan 2001, Kevin Cawthorne wrote: > Hi, > > I want to install PHPLIB but one of the configuration notes says "turn off magic quotes in the php.ini file". > > OK But I'm, using phpMyAdmin, which I understand NEEDS magic quotes on to work. > > Has anyone done this using the two together? Yes, I use .htaccess files to control phplib (you can have multiple phplibs) Tarique ========================================= B2B Application Providers http://www.sanisoft.com Vortal for Nagpur http://nagpurcity.net ========================================= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi, I'm using the function get_browser(), but the whole thing does not seem to work properly. Please have a look at http://web.flynet.de/info.php to see what I mean. Is there anyone who could tell me what's probably wrong? I'm using PHP 4.04, which compiled ok. I seems to find the browsecap.ini, but the output is buggy. TIA, Axel. -- [EMAIL PROTECTED]
I am trying to get a directory listing over ftp with the ftp_nlist() function. The problem is that the directory name has spaces in it and it looks like ftp_nlist() chops the string at each space and performs a separate listing for each word, which fails. I have tried quoting, urlencoding and rawurlencoding the string but nothing works. However, ftp_chdir() works when given the directory name with spaces. Is this a bug in ftp_nlist() or is it an undocumented feature?
Hi, I have several web pages that are built with php and mySQL. I use a new connection for each script. Should I be using a permanent connection? Or is there a better way around this? Regards, Sam Rose
Hello, Is it possible using apache .htaccess to have every file served from a particular domain/directory pass through a custom script? or is it necessary to make changes at the root level? Thanks, Hrishi
Hrishi wrote: > > Hello, > > Is it possible using apache .htaccess to have every file served from a > particular domain/directory > pass through a custom script? or is it necessary to make changes at the root > level? RewriteEngine on RewriteRule ^/(.+) http://newserver/$1 [R,L] or RewriteEngine on RewriteRule ^/(.+) /your/apache/documentroot/admin/index.php Read more about rewrite here: http://httpd.apache.org/docs/misc/rewriteguide.html -- Paul K Egell-Johnsen Utvikler/PR Manager eZ systems as http://ez.no/
Hi all, I want to retrieve the contents of a dir, so i use C:/WINNT/system32/cmd.exe /C dir /b e:\logs1\ to do that. the command works on the cli of win2k. The server is running win2k + Apache 1.3.14 + PHP-4.0.4pl1 I receive the following error: Warning: Unable to fork [C:/WINNT/system32/cmd.exe /C dir /b e:\logs1\] in c:/www/apache/htdocs/counter-stats/test.php on line 3 The complete script is: <? <? //include("config.inc"); exec("C:/WINNT/system32/cmd.exe /C dir /b e:\\logs1\\", $arr); print_r($arr); ?> tia, Kees Hoekzema
--- Dezider Góra <[EMAIL PROTECTED]> wrote: > I always get this error when trying to connect to > the mailbox. I have > installed uw imap server. > > Warning: Couldn't open stream {localhost:143} in > /home/httpd/html/webmail/mailbox.php on line 12 > > Affected line is: > > $connection = IMAP_Open("{localhost:143}", $name, > $psw); Try with : $connection = IMAP_Open("{localhost:143}INBOX", $name, $psw); regards ===== ============== Ing. Alejandro Garín Telecom Internet __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Hi I have the following code which is created in a loop. <tr> <td><?php print $SkyAccNo; ?></td> <td><?php print $SkyDateAss; ?></td> <td><?php print $SkyDateResult; ?></td> <td><input type="checkbox" name="<?php echo$SkyAccNo;?>" value="ON"></td> </tr> For example there will be three rows with different values and each checkbox will have a unique name. On the next page once a submit button has been pushed I want to do: sqlExecute( "Select * from SkyDiary where AccNo = (Here I want the value of the checkbox) Do I use HTTP_POST_VARS here and if so how?? Thanks Wade Halsey [EMAIL PROTECTED]
HI! When I run the foillowing code: <form action="<?php echo"$PHP_SELF"; ?>" method="post"> <input type="hidden" name="flag" value="0"> <select name="recepients" onchange="javascript:submit();"> <option value="">--</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select></form></td> </tr> </table> <?php if(isset($flag)) { for($i=1; $i<=$recepients; $i++) { echo "<input type=\"text\" name=\"$i\">" ."<br>"; } } else { echo "<input type=\"text\" name=\"1\">"; } ?> I get error on saying echo $i on the next page... **************************************************** Parse error: parse error, expecting `T_VARIABLE' or `'$'' in C:\HTTPD\HTDOCS\preston\sms\send.php **************************************************** WHy is it so..? Is there any other way of doing the above... Please let me know.. Thanx a lot! Dhaval Desai --------------------------------- Do You Yahoo!? Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.
Dhaval Desai wrote: > > ... > > for($i=1; $i<=$recepients; $i++) > { > echo "<input type=\"text\" name=\"$i\">" ."<br>"; Maybe this line should be: echo "<input type=\"text\" name=\"$i\"><br>"; -- Pavel a.k.a. Papi
Here's a fun little thing I discovered, possibly a bug in PHP itself? To output a WAP page you must output a content-type header else the phone's browser won't recognise the page. Dead simple. Use: header("Content-type: text/vnd.wap.wml"); And all is well and good as long as you use echo/printf etc to output your page. The second you deviate out of PHP and back to HTML the content-type gets overwritten with a text/html, and so the page doesn't work. ASP used to be able to cope with this, is it a bug or something I'm doing wrong? -- Rick Hodger
Hi Rick, you are not doing anything wrong. You just have to send the proper content-type depending on what you're outputing. For example if you want to produce a gif image you have to use header("Content-type: image/gif"); There's nothing wrong with it as PHP can't predict what you want to do. text/html is set as default simply because it's the type most users in most cases need. Pavel ----- Original Message ----- From: "Rick Hodger" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 2:10 PM Subject: [PHP] WML/WAP and PHP > Here's a fun little thing I discovered, possibly a bug in PHP itself? > > To output a WAP page you must output a content-type header else the phone's > browser won't recognise the page. Dead simple. Use: > > header("Content-type: text/vnd.wap.wml"); > > And all is well and good as long as you use echo/printf etc to output your > page. The second you deviate out of PHP and back to HTML the content-type > gets overwritten with a text/html, and so the page doesn't work. ASP used > to be able to cope with this, is it a bug or something I'm doing wrong? > > -- > Rick Hodger > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Due to the sheer size of my mailing list, it would seems sensible to try streamlining the send -mailing script I run. In PERL I think the command to split the sending proccess was "fork", where the script launches a new command allowing the script to continue on while each person is emailed. Do any of you know of a similar technique in PHP 4+ ? Kevin Cawthorne
Hi all, I'm attempting to write a weather script, which will display weather conditions for areas in the UK. I have the data I need, which is stored in a file on another server. The data comes in the format: 2001/01/16 13:50 OOOO SCT010 BKNDPIP WYXWE Q1012 2001/01/16 13:46 CYGL 161346Z 34004KT 15SM -SN BKN011 BKN030 RMK SF6SC1 Where the first four characters below the dates are 4 letter codes for cities (the script will be using metar(aviation) readings) and the rest is the actual weather information. The trouble is, that there are about 3000 cities in the text file. I'm assuming that I fill use fopen(); and fread(); to open and read the files, but does anyone know of a way of singling out one line (say: CYGL 161346Z 34004KT 15SM -SN BKN011 BKN030 RMK SF6SC1 ) from the whole text file? Like if a variable, $city = CYGL, is it possible to then go to that one line in the text file and read all the information from just one line? I'm pretty confident I could then split the information up into readable variable using the split(); function :) Thanks in advance for any help you might be able to give, James.
James, The trouble is, that there are about 3000 cities in the text file. I'm >assuming that I fill use fopen(); and fread(); to open and read the files, >but does anyone know of a way of singling out one line (say: > >CYGL 161346Z 34004KT 15SM -SN BKN011 BKN030 RMK SF6SC1 > >) from the whole text file? Like if a variable, $city = CYGL, is it >possible to then go to that one line in the text file and read all the >information from just one line? I'm pretty confident I could then split the >information up into readable variable using the split(); function :) Assuming the first field (i.e. CYGL) is unique, just read each line and check using a regular expression whether it matches the city you require. If it matches, you can stop reading the file and do whatever you need to do with the line. Regards, Glen ----------------------------------------------------- Design Solution Limited t: +44 (0)1502 513008 f: +44 (0)1502 588622 e: [EMAIL PROTECTED] w: http://www.designsolution.co.uk Nouvotech House, Harbour Road, Oulton Broad, Suffolk, NR32 3LZ, UK -----------------------------------------------------
Glen Scott <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > James, > > The trouble is, that there are about 3000 cities in the text file. I'm > >assuming that I fill use fopen(); and fread(); to open and read the files, > >but does anyone know of a way of singling out one line (say: > > > >CYGL 161346Z 34004KT 15SM -SN BKN011 BKN030 RMK SF6SC1 > > > >) from the whole text file? Like if a variable, $city = CYGL, is it > >possible to then go to that one line in the text file and read all the > >information from just one line? I'm pretty confident I could then split the > >information up into readable variable using the split(); function :) > > Assuming the first field (i.e. CYGL) is unique, just read each line and > check using a regular expression whether it matches the city you > require. If it matches, you can stop reading the file and do whatever you > need to do with the line. That's just it, I don't know how to 'read' each line and stop.... And the first field is unique.... Sorry to be such a dummy, I'm still very new to PHP, and have never really used Perl either ;) By 'using a regular expression', do you mean that something as simple as an "if" statement might do the job? Can you help any further? Thanks for getting me this far. James.
check the manual for fgets() function. then you can maybe explode() the string using " " (space) as separator. Pavel ----- Original Message ----- From: "James Holloway" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 4:13 PM Subject: Re: [PHP] Reading specific data from a .txt file into PHP > > Glen Scott <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > James, > > > > The trouble is, that there are about 3000 cities in the text file. I'm > > >assuming that I fill use fopen(); and fread(); to open and read the > files, > > >but does anyone know of a way of singling out one line (say: > > > > > >CYGL 161346Z 34004KT 15SM -SN BKN011 BKN030 RMK SF6SC1 > > > > > >) from the whole text file? Like if a variable, $city = CYGL, is it > > >possible to then go to that one line in the text file and read all the > > >information from just one line? I'm pretty confident I could then split > the > > >information up into readable variable using the split(); function :) > > > > Assuming the first field (i.e. CYGL) is unique, just read each line and > > check using a regular expression whether it matches the city you > > require. If it matches, you can stop reading the file and do whatever you > > need to do with the line. > > That's just it, I don't know how to 'read' each line and stop.... And the > first field is unique.... Sorry to be such a dummy, I'm still very new to > PHP, and have never really used Perl either ;) > > By 'using a regular expression', do you mean that something as simple as an > "if" statement might do the job? > > Can you help any further? > > Thanks for getting me this far. > > James. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >