Re: [PHP] String termination
the zval struct in PHP is multifunctional and its string branch has length member. Much of the operations on string are with *_STRINGL() L comes from length. It is preferable php function to use the length instead of *_STRING macros which looks throug the string to find its end. Andrey - Original Message - From: "Marco Laponder" <[EMAIL PROTECTED]> To: "'Php-General (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, April 12, 2002 9:49 AM Subject: [PHP] String termination > Hi All, > > I have the following question. I have been developing with C for a > while and I was used that the \0 indicated the end of a string. So if > I had a variable containing 1234\056789 and the variable was printed, > only 1234 was printed. > > As I can see in PHP (version 4.0.6 ), when I echo such a variable > also the characters are printed, even the characters after \0. Is this > the case PHP should work or is it a bug ? Isn't \0 really a string > termination character in PHP ? > > I have been searching for documentation on this matter so if anyone > could help me... > > Kind Regards, > > > -- > 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] String termination
I think that all chars (\0 to \255) are valid chars in php, from the looks of it, php maintains the strings length, or something, so that you can have \0 in the string Martin -Original Message- From: Marco Laponder [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 4:50 PM To: 'Php-General (E-mail) Subject: [PHP] String termination Hi All, I have the following question. I have been developing with C for a while and I was used that the \0 indicated the end of a string. So if I had a variable containing 1234\056789 and the variable was printed, only 1234 was printed. As I can see in PHP (version 4.0.6 ), when I echo such a variable also the characters are printed, even the characters after \0. Is this the case PHP should work or is it a bug ? Isn't \0 really a string termination character in PHP ? I have been searching for documentation on this matter so if anyone could help me... Kind Regards, -- 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] String termination
Hi All, I have the following question. I have been developing with C for a while and I was used that the \0 indicated the end of a string. So if I had a variable containing 1234\056789 and the variable was printed, only 1234 was printed. As I can see in PHP (version 4.0.6 ), when I echo such a variable also the characters are printed, even the characters after \0. Is this the case PHP should work or is it a bug ? Isn't \0 really a string termination character in PHP ? I have been searching for documentation on this matter so if anyone could help me... Kind Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP script to write to /home/userid/ dir. popen not working. how?
Hi, I'm using PHP 4.1.2 to write a webmail. I'm using Procmail along with Sendmail. PHP runs as user nobody or user apache. Note that I have the user id and password in my PHP script from using HTTP authentication. FYI I'm running Mandrake Linux 8.1. The problem is: I want to write to some files (procmail recipe files) that'll reside in /home/userid. I tested running su using the below code $fp=popen("su userid","w"); fputs($fp,"userpassword"); fputs($fp,"cd /home/db/"); fputs($fp,"mkdir THIS_IS_GOOD"); //just testing if I can write to dir fclose($fp); exit(done); 1) Even when I enter the wrong password, my PHP code doesn't complain. It dutifully echoes done. Why? 2) Doesn't seem like it's running as it should. How can I achieve what I want to do - to write to a file (specifically to create procmail files called .forward and .procmailrc file) to /home/userid/ dir from a PHP script? PS: If you're not familiar with procmail, don't worry abt the procmail jargons! Gaukia _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session unset or unregister??
Rodrigo Peres wrote: > > if(isset($HTTP_GET_VARS['erase_data'])) { > session_unregister('data'); > } > > but the code doesn't erase the var from session, and If i use > session_unset('data') it erases all vars from session, that I don't want to. > How to solve this?!??! i have started the session and used > session_register('data','id').. to store the vars. normally it should work exactly like that. how do you tell the variable isn't unregistered when you run this? did you check if the code in the if statement is executed at all? henning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable wildcards
On Friday 12 April 2002 14:17, Nick Richardson wrote: > Following on the same subject (kinda) of Variable Variables... i have > actually wondered this before... is there a difference between these 2 > blocks?? (both should print "worldhello" if i am not mistaken, but is there > a difference in how the nested variable is handled when it's inside curly > braces?): The {} are to resolve ambiguities. In your simple example there are no ambiguities thus both give the same result. See manual for example(s) where {} needs to be used. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Just because you're paranoid doesn't mean they AREN'T after you. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "the document contained no data"
The fact that there's a seg fault involved makes me think that's it's not so much a problem w/ code, but a problem with either apache (or whatever web server you use) a/o your PHP installation - PHP may be seg faulting before it's done reading the data from the directory and apache is reporting that no data was sent but the parser has stopped responding and is what it thinks is "done". Could also be that the user apache runs under doesn't have access to that directory. Or i could be completley wrong too... who knows ;) //Nick -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 10:43 PM To: 'Phieu Huynh' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] "the document contained no data" does that code work if you set the directory path to "./" ? -Original Message- From: Phieu Huynh [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 3:33 PM To: Martin Towell Cc: [EMAIL PROTECTED] Subject: Re: [PHP] "the document contained no data" I also try the following code and still have the same problem. I am runing php4.0.?, solaris(linux) $dir_name = "/export/home/phuynh/php/main/student/upload/"; $dir = opendir($dir_name); while (false !== ($file_names = readdir($dir))) { echo "$file_names"; } closedir($dir); Martin Towell wrote: > odd, I copied your code, changed the dir to "./" and it works for me > (php4.0.?, winnt) > > if dir() doesn't work for you, you might need to use opendir(), readdir(), > etc > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 2:14 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] "the document contained no data" > > Sorry, the file has ; I retype it wrong, > I did set error_reporting but no change, > but in the httpd error log file I found "exit signal segmentation fault > (11)" > > Martin Towell wrote: > > > is that a direct copy of your code - if it is, you're missing a ; after > > $entry=$d->read() > > but that wound have stopped the first one... > > > > to set error level to E_ALL, use: > > error_reporting(E_ALL); > > > > or set it in your php.ini file > > error_reporting = E_ALL > > > > -Original Message- > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 12, 2002 12:31 PM > > To: Martin Towell; [EMAIL PROTECTED] > > Subject: Re: [PHP] "the document contained no data" > > > > I don't know how to set erro level to E_ALL, can you give me some sample. > > I did try different way > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > it is ok and the output is only a dot(.) > > if I add another read() statement then I got " ... no data" > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > can anyone tell me what has read() has > > and readdir() return. > > > > Martin Towell wrote: > > > > > turn the displaying of errors on, and set the error level to E_ALL > > > I'm thinking that you've got a error somewhere that's stopping the > script > > > prematurely > > > > > > -Original Message- > > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, April 12, 2002 10:49 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] "the document contained no data" > > > > > > Hi, > > > I am trying to read the files in the directory and display them . > > > but I got the message " the document contained no data " > > > > > > this is my code > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > > echo "Handle: ".$d->handle.""; > > > echo "Path: ".$d->path.""; > > > > > > while($entry=$d->read()) { > > > echo $entry."\n"; > > > } > > > echo ""; > > > $d->close(); > > > ?> > > > > > > Can anyone tell me what should I do to correct it. > > > I would like some help, thank in advance. > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > > > Phieu (phil) Huynh > > Computer System Officer > > Monash University > > Electrical & Computer Systems Engineering > > Phone : +61 3 990 53469 > > -- > > Phieu (phil) Huynh > Computer System Officer > Monash University > Electrical & Computer Systems Engineering > Phone : +61 3 990 53469 -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- 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] Re: Variable wildcards
Following on the same subject (kinda) of Variable Variables... i have actually wondered this before... is there a difference between these 2 blocks?? (both should print "worldhello" if i am not mistaken, but is there a difference in how the nested variable is handled when it's inside curly braces?): $a = "hello"; $hello = "world"; print($$a.$a); -- and -- $a = "hello"; $hello = "world"; print(${$a}.$a); -Original Message- From: Jason Bell [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 7:33 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Variable wildcards This would certainly work, but I got a suggestion for using that i think will be a much cleaner solution. Thanks! - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: "Jason Bell" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 4:10 PM Subject: Re: Variable wildcards > If you want to process the list when they submit the form you can do > something like this: > > foreach($_REQUEST as $key => $value ) { > if( ereg("user([0-9]*)", $key, $match_ary) ) { > #go crazy; > } > } > > ?? > -philip > > On Thu, 11 Apr 2002, Jason Bell wrote: > > > Yeah, I thought so too, but variable variables doesn't seem to provide for > > this to add a little bit of detail to what I am doing, it is a user > > list, and I want to have a check box next to each user so that you can > > select 1 or more users for deletion. Each checkbox will be named User$id > > ($id of course being the numerical id of the user in the database) > > > > > > I did try doing somehting like $User{ereg ([0-9])} but it doesn't seem to > > work, or I'm doing it wrong. > > > > > > I guess maybe an easier way is if I could somehow drop all of the selected > > id's into an array? Then I wouldn't need to worry about needing to determine > > which variables exist. > > > > > > - Original Message - > > From: "Kevin Stone" <[EMAIL PROTECTED]> > > To: "Jason Bell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Thursday, April 11, 2002 3:44 PM > > Subject: Re: Variable wildcards > > > > > > > Sounds like what you want is Variable Variables. > > > http://www.php.net/manual/en/language.variables.variable.php > > > > > > - Original Message - > > > From: "Jason Bell" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Thursday, April 11, 2002 4:24 PM > > > Subject: Variable wildcards > > > > > > > > > are there wildcard characters for variables? > > > > > > Lets say that I have a varable that always starts with $user but then has > > > the 2 digit user id attached to the end, so it could be $user12 or $user28 > > > > > > > > > is there a way to grab these? sort of like in unix standards, where I > > could > > > use user?? or user* ? > > > > > > > > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "the document contained no data"
does that code work if you set the directory path to "./" ? -Original Message- From: Phieu Huynh [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 3:33 PM To: Martin Towell Cc: [EMAIL PROTECTED] Subject: Re: [PHP] "the document contained no data" I also try the following code and still have the same problem. I am runing php4.0.?, solaris(linux) $dir_name = "/export/home/phuynh/php/main/student/upload/"; $dir = opendir($dir_name); while (false !== ($file_names = readdir($dir))) { echo "$file_names"; } closedir($dir); Martin Towell wrote: > odd, I copied your code, changed the dir to "./" and it works for me > (php4.0.?, winnt) > > if dir() doesn't work for you, you might need to use opendir(), readdir(), > etc > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 2:14 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] "the document contained no data" > > Sorry, the file has ; I retype it wrong, > I did set error_reporting but no change, > but in the httpd error log file I found "exit signal segmentation fault > (11)" > > Martin Towell wrote: > > > is that a direct copy of your code - if it is, you're missing a ; after > > $entry=$d->read() > > but that wound have stopped the first one... > > > > to set error level to E_ALL, use: > > error_reporting(E_ALL); > > > > or set it in your php.ini file > > error_reporting = E_ALL > > > > -Original Message- > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 12, 2002 12:31 PM > > To: Martin Towell; [EMAIL PROTECTED] > > Subject: Re: [PHP] "the document contained no data" > > > > I don't know how to set erro level to E_ALL, can you give me some sample. > > I did try different way > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > it is ok and the output is only a dot(.) > > if I add another read() statement then I got " ... no data" > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > can anyone tell me what has read() has > > and readdir() return. > > > > Martin Towell wrote: > > > > > turn the displaying of errors on, and set the error level to E_ALL > > > I'm thinking that you've got a error somewhere that's stopping the > script > > > prematurely > > > > > > -Original Message- > > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, April 12, 2002 10:49 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] "the document contained no data" > > > > > > Hi, > > > I am trying to read the files in the directory and display them . > > > but I got the message " the document contained no data " > > > > > > this is my code > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > > echo "Handle: ".$d->handle.""; > > > echo "Path: ".$d->path.""; > > > > > > while($entry=$d->read()) { > > > echo $entry."\n"; > > > } > > > echo ""; > > > $d->close(); > > > ?> > > > > > > Can anyone tell me what should I do to correct it. > > > I would like some help, thank in advance. > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > > > Phieu (phil) Huynh > > Computer System Officer > > Monash University > > Electrical & Computer Systems Engineering > > Phone : +61 3 990 53469 > > -- > > Phieu (phil) Huynh > Computer System Officer > Monash University > Electrical & Computer Systems Engineering > Phone : +61 3 990 53469 -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "the document contained no data"
!== is correct - it's checking for type, as well as value "strict non-equality" -Original Message- From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 3:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] "the document contained no data" At 10:33 PM 4/11/2002 Thursday, Phieu Huynh wrote: >I also try the following code and still have the same problem. >I am runing php4.0.?, solaris(linux) > >$dir_name = "/export/home/phuynh/php/main/student/upload/"; >$dir = opendir($dir_name); > while (false !== ($file_names = readdir($dir))) { > echo "$file_names"; > } > closedir($dir); Your while statement needs to read. > while (false != ($file_names = readdir($dir))) { > echo "$file_names"; > } Not !== But != Phillip -- 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] "the document contained no data"
At 10:33 PM 4/11/2002 Thursday, Phieu Huynh wrote: >I also try the following code and still have the same problem. >I am runing php4.0.?, solaris(linux) > >$dir_name = "/export/home/phuynh/php/main/student/upload/"; >$dir = opendir($dir_name); > while (false !== ($file_names = readdir($dir))) { > echo "$file_names"; > } > closedir($dir); Your while statement needs to read. > while (false != ($file_names = readdir($dir))) { > echo "$file_names"; > } Not !== But != Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "the document contained no data"
I also try the following code and still have the same problem. I am runing php4.0.?, solaris(linux) $dir_name = "/export/home/phuynh/php/main/student/upload/"; $dir = opendir($dir_name); while (false !== ($file_names = readdir($dir))) { echo "$file_names"; } closedir($dir); Martin Towell wrote: > odd, I copied your code, changed the dir to "./" and it works for me > (php4.0.?, winnt) > > if dir() doesn't work for you, you might need to use opendir(), readdir(), > etc > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 2:14 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] "the document contained no data" > > Sorry, the file has ; I retype it wrong, > I did set error_reporting but no change, > but in the httpd error log file I found "exit signal segmentation fault > (11)" > > Martin Towell wrote: > > > is that a direct copy of your code - if it is, you're missing a ; after > > $entry=$d->read() > > but that wound have stopped the first one... > > > > to set error level to E_ALL, use: > > error_reporting(E_ALL); > > > > or set it in your php.ini file > > error_reporting = E_ALL > > > > -Original Message- > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 12, 2002 12:31 PM > > To: Martin Towell; [EMAIL PROTECTED] > > Subject: Re: [PHP] "the document contained no data" > > > > I don't know how to set erro level to E_ALL, can you give me some sample. > > I did try different way > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > it is ok and the output is only a dot(.) > > if I add another read() statement then I got " ... no data" > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > $entry=$d->read() > > echo $entry ; > > $entry=$d->read() > > echo $entry ; > > $d->close(); > > ?> > > > > can anyone tell me what has read() has > > and readdir() return. > > > > Martin Towell wrote: > > > > > turn the displaying of errors on, and set the error level to E_ALL > > > I'm thinking that you've got a error somewhere that's stopping the > script > > > prematurely > > > > > > -Original Message- > > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, April 12, 2002 10:49 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] "the document contained no data" > > > > > > Hi, > > > I am trying to read the files in the directory and display them . > > > but I got the message " the document contained no data " > > > > > > this is my code > > > > > $d = dir("/export/home/phuy/www/test/upload"); > > > echo "Handle: ".$d->handle.""; > > > echo "Path: ".$d->path.""; > > > > > > while($entry=$d->read()) { > > > echo $entry."\n"; > > > } > > > echo ""; > > > $d->close(); > > > ?> > > > > > > Can anyone tell me what should I do to correct it. > > > I would like some help, thank in advance. > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > > > Phieu (phil) Huynh > > Computer System Officer > > Monash University > > Electrical & Computer Systems Engineering > > Phone : +61 3 990 53469 > > -- > > Phieu (phil) Huynh > Computer System Officer > Monash University > Electrical & Computer Systems Engineering > Phone : +61 3 990 53469 -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Forms in PHP
On Friday 12 April 2002 09:19, Jennifer Downey wrote: > Actually after the submit button is clicked it returns a blank page. > "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hi all, > > > > Now I have a weird problem. I am using this code and can't understand why > > it > > > doesn't work. > > When the script is run it returns a blank page, no error or done. > > > > here it is and any help would be appreciated. > > > > if(($type == book) or ($type == weapon)){ > > echo ""; > > echo ""; > > echo "Put in my shop"; > > echo "Put into my Footlocker"; > > echo "Discard this item"; > > echo "Donate this item"; > > echo ""; > > echo ""; You haven't given your submit button a name... > > > > > > > > if(isset($submit)) Thus this test fails and you get no output. May I also suggest that you rewrite your echo statements as: echo 'Donate this item'; Vastly improves legibility. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It was all so different before everything changed. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error using an include class
On Thursday 11 April 2002 14:30, Andrew Schoenherr wrote: [snip] > Problem > I have just started using classes, downloaded from www.thewebmasters.net > web site. I am working on user authentication and I am getting a > parse error when the page loads. Only since I started using the > class has this parse error occurred, but I am not sure if it the > class that is causing the problem or not. I have included sections that > I feel are relevant from my httpd.conf, php.ini and locations and > contents of my .htpasswd files. [snip] Whilst it is commendable in providing detailed information about a setup when posting a question, it is best to restrict this to OS version, PHP version & webserver version. You seemed to left out the MOST important piece of info which is what line the parse error occurs at. Post an extract of your code, just the 5-10 lines leading up to and including the line on which the error occurs. Also don't just say the error occurs at line 15, *indicate* which is line 15. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* The mosquito exists to keep the mighty humble. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "the document contained no data"
odd, I copied your code, changed the dir to "./" and it works for me (php4.0.?, winnt) if dir() doesn't work for you, you might need to use opendir(), readdir(), etc -Original Message- From: Phieu Huynh [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 2:14 PM To: Martin Towell; [EMAIL PROTECTED] Subject: Re: [PHP] "the document contained no data" Sorry, the file has ; I retype it wrong, I did set error_reporting but no change, but in the httpd error log file I found "exit signal segmentation fault (11)" Martin Towell wrote: > is that a direct copy of your code - if it is, you're missing a ; after > $entry=$d->read() > but that wound have stopped the first one... > > to set error level to E_ALL, use: > error_reporting(E_ALL); > > or set it in your php.ini file > error_reporting = E_ALL > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 12:31 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] "the document contained no data" > > I don't know how to set erro level to E_ALL, can you give me some sample. > I did try different way > >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > $entry=$d->read() > echo $entry ; > $d->close(); > ?> > > it is ok and the output is only a dot(.) > if I add another read() statement then I got " ... no data" > >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > $entry=$d->read() > echo $entry ; > $entry=$d->read() > echo $entry ; > $d->close(); > ?> > > can anyone tell me what has read() has > and readdir() return. > > Martin Towell wrote: > > > turn the displaying of errors on, and set the error level to E_ALL > > I'm thinking that you've got a error somewhere that's stopping the script > > prematurely > > > > -Original Message- > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 12, 2002 10:49 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] "the document contained no data" > > > > Hi, > > I am trying to read the files in the directory and display them . > > but I got the message " the document contained no data " > > > > this is my code > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > > > while($entry=$d->read()) { > > echo $entry."\n"; > > } > > echo ""; > > $d->close(); > > ?> > > > > Can anyone tell me what should I do to correct it. > > I would like some help, thank in advance. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > > Phieu (phil) Huynh > Computer System Officer > Monash University > Electrical & Computer Systems Engineering > Phone : +61 3 990 53469 -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
On Friday 12 April 2002 05:29, Kevin Stone wrote: > Wouldn't it be more helpful to assume that the individual is simply > uninformed? So isntead of flaming him and calling him stupid you could > say, "Check the PHP manual at www.php.net". Nobody called him/her stupid. In fact it's probably a very bright individual, getting others to do their work for them ;) -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Better dead than mellow. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Error using an include class
Hello, This is my first question to the list, I have included as much information as I feel will help someone find a solution to my problem. Server: RedHat Linux 7.0, Kernel 2.2.16-22 PHP Version: 4.1.0 Apache Version: 1.3.12 Class name: class.Htpasswd.php3 Problem I have just started using classes, downloaded from www.thewebmasters.net web site. I am working on user authentication and I am getting a parse error when the page loads. Only since I started using the class has this parse error occurred, but I am not sure if it the class that is causing the problem or not. I have included sections that I feel are relevant from my httpd.conf, php.ini and locations and contents of my .htpasswd files. File Locations: php config script - php.ini - /usr/local/lib/php.ini password flat file - .htpasswd - /var/www/html/private/.htpasswd include directory - - /var/www/html/php/includes include class name - class.Htpasswd.php3 ** start php file to validate user * Quick Validate Using Htpasswd Class EXISTS) { print("authentication error); } else { // try to debug by printing to the screen // echo( "passes check for aHTPasswd->EXITS"); if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) ) { print( "phpbook is a valid user" ); } else { print( "phpbook is not a valid user" ); } } ?> ** end php file to validate user * The following is from my http.conf file. ** start section of httpd.conf file * ### Section 1: Global Environment ServerType standalone ServerRoot "/etc/httpd" Port 80 User apache Group apache ServerAdmin andrew@fremont ServerName 192.168.2.2 DocumentRoot "/var/www/html" Options FollowSymLinks AllowOverride None Options Indexes Includes FollowSymLinks # Changed 4-5-02 AllowOverride Limit # Changed 4-2-02 AllowOverride All #AllowOverride None AllowOverride Limit # # Controls who can get stuff from this server. # Order allow,deny Allow from all ** end section of httpd.conf file * My php.ini file listing all directives, include towards the end. ** start php.ini file * engine = On short_open_tag = On asp_tags = Off precision= 14 y2k_compliance = Off output_buffering = Off output_handler = zlib.output_compression = Off implicit_flush = Off allow_call_time_pass_reference = On safe_mode = Off safe_mode_gid = Off safe_mode_include_dir = safe_mode_exec_dir = safe_mode_allowed_env_vars = PHP_ safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions = highlight.string = #CC highlight.comment = #FF9900 highlight.keyword = #006600 highlight.bg = #FF highlight.default = #CC highlight.html= #00 max_execution_time = 30 ; Maximum execution time of each script, in seconds memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = Off log_errors = Off track_errors = Off warn_plus_overloading = Off include_path = ".:/php/includes" doc_root = user_dir = extension_dir = ./ enable_dl = On file_uploads = On upload_max_filesize = 2M ** end php.ini file * Here is the details from my .htaccess file that I have installed inside the folder I want protected. The user ahelis has been added to the ../../private/.htpasswd successfully. ** start .htaccess file * AuthUserFile ../../private/.htpasswd AuthGroupFile /dev/null AuthName ByPassword AuthType Basic require ahelis ** end .htaccess file * On a side note, if someone can check my .htaccess permissions as compared to the directives set in my httpd.conf file, I would appreciate knowing if I have other problems. I hope the solution is something that I have over looked or miss configured. Any assistance is appreciated. Andrew Schoenherr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "the document contained no data"
Sorry, the file has ; I retype it wrong, I did set error_reporting but no change, but in the httpd error log file I found "exit signal segmentation fault (11)" Martin Towell wrote: > is that a direct copy of your code - if it is, you're missing a ; after > $entry=$d->read() > but that wound have stopped the first one... > > to set error level to E_ALL, use: > error_reporting(E_ALL); > > or set it in your php.ini file > error_reporting = E_ALL > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 12:31 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] "the document contained no data" > > I don't know how to set erro level to E_ALL, can you give me some sample. > I did try different way > >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > $entry=$d->read() > echo $entry ; > $d->close(); > ?> > > it is ok and the output is only a dot(.) > if I add another read() statement then I got " ... no data" > >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > $entry=$d->read() > echo $entry ; > $entry=$d->read() > echo $entry ; > $d->close(); > ?> > > can anyone tell me what has read() has > and readdir() return. > > Martin Towell wrote: > > > turn the displaying of errors on, and set the error level to E_ALL > > I'm thinking that you've got a error somewhere that's stopping the script > > prematurely > > > > -Original Message- > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 12, 2002 10:49 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] "the document contained no data" > > > > Hi, > > I am trying to read the files in the directory and display them . > > but I got the message " the document contained no data " > > > > this is my code > > > $d = dir("/export/home/phuy/www/test/upload"); > > echo "Handle: ".$d->handle.""; > > echo "Path: ".$d->path.""; > > > > while($entry=$d->read()) { > > echo $entry."\n"; > > } > > echo ""; > > $d->close(); > > ?> > > > > Can anyone tell me what should I do to correct it. > > I would like some help, thank in advance. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > > Phieu (phil) Huynh > Computer System Officer > Monash University > Electrical & Computer Systems Engineering > Phone : +61 3 990 53469 -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Uploading not taking place
On Friday 12 April 2002 10:53, Manisha wrote: > >I'd be surprised if you really want to move the file to /img. > >And if you're on a Unix system the web server certainly won't > >have write access to the / directory. > > i tried with complete path starting from root (/usr/web/html/img) and > also with virtual (/img/). > > Is there any extra param setting ? any access rights ? Check that the webserver has execute rights to each of the directories from /usr, /usr/web/... through to .../html/img > > >STILL NOT GETTING LOADED. ANYTHING ELSE ? > > > >Please don't shout. > > Am I ? I do not think so. It is just an EMPHASIS. Using ALLCAPS is considered rude. A word here and there is OK but a whole 2 sentences would annoy some people. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I don't wish to appear overly inquisitive, but are you still alive? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Uploading not taking place
At 10:53 AM +0800 12/4/02, Manisha wrote: >> >if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { >> > copy($HTTP_POST_FILES['userfile']['tmp_name'], "/img"); >> >>Check to see whether that "copy" function completed successfully. > >how ? I put one echo statement after copy which is displaying but never >uploading the file. http://www.php.net/manual/en/function.copy.php >>I'd be surprised if you really want to move the file to /img. >>And if you're on a Unix system the web server certainly won't >>have write access to the / directory. > >i tried with complete path starting from root (/usr/web/html/img) and >also with virtual (/img/). > >Is there any extra param setting ? any access rights ? The web server must have write and execute access to the directory in which you are creating the new file. In general the web server runs with no privileges, so the directory must be world-writable. This is the reason uploaded images are generally dumped into a database. Bad news having world-writable files/directories scattered all around. Try creating the file in /tmp as a test. ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML Character Parsing
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Hi all, > > I have a textarea which will containg info from the user. This then > needs to be parsed through something like htmlspecialchars() or > htmlentities(). > > The issue is that my system really needs to do the following: > > 1. Accept the info > 2. Check if there is any HTML syntax (, etc) > 3. If YES: remove anything that might be harmful (eg FORM, etc) > 4. If NO: Add replace CR/LF with > > The idea is that normal formatting such as , , , is > ok, but I do not want off illegal stuff. I want something a little like > Slashdot's stuff. > > Easy?? anyone know anything about this? > > Thanks > > David R Striptags() -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "the document contained no data"
is that a direct copy of your code - if it is, you're missing a ; after $entry=$d->read() but that wound have stopped the first one... to set error level to E_ALL, use: error_reporting(E_ALL); or set it in your php.ini file error_reporting = E_ALL -Original Message- From: Phieu Huynh [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 12:31 PM To: Martin Towell; [EMAIL PROTECTED] Subject: Re: [PHP] "the document contained no data" I don't know how to set erro level to E_ALL, can you give me some sample. I did try different way handle.""; echo "Path: ".$d->path.""; $entry=$d->read() echo $entry ; $d->close(); ?> it is ok and the output is only a dot(.) if I add another read() statement then I got " ... no data" handle.""; echo "Path: ".$d->path.""; $entry=$d->read() echo $entry ; $entry=$d->read() echo $entry ; $d->close(); ?> can anyone tell me what has read() has and readdir() return. Martin Towell wrote: > turn the displaying of errors on, and set the error level to E_ALL > I'm thinking that you've got a error somewhere that's stopping the script > prematurely > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 10:49 AM > To: [EMAIL PROTECTED] > Subject: [PHP] "the document contained no data" > > Hi, > I am trying to read the files in the directory and display them . > but I got the message " the document contained no data " > > this is my code >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > > while($entry=$d->read()) { > echo $entry."\n"; > } > echo ""; > $d->close(); > ?> > > Can anyone tell me what should I do to correct it. > I would like some help, thank in advance. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RPM apache+php v. source apache+php
Addressed to: Jeff Bearer <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Jeff Bearer <[EMAIL PROTECTED]> 11 Apr 2002 13:40:52 -0400 > What is your opinion of using Red Hat's Apache and PHP binaries instead > of compiling from source? If what they provide is exactly what you need, that's fine. For critical services like web or email, don't be suprised if your needs differ from what the RPM's creator planned for. I use stock programs for my base server load, but important things like apache+mod_ssl+php or qmail+vpopmail I compile myself. The stock versions just don't cut it for me. > If Red hat is too specific for this list we > can expand it, but that is the binary that I'm interested in seeing how > it stacks up. Don't worry, it isn't just Red Hat. I use SuSE, which also uses RPMs for installing packages. It is great for most things, for other things you have a compiler... > Red Hat compiles a bunch of stuff into both apache and php but most of > it is modular so it shouldn't have enormous amounts of overhead. On the > other hand, it sure is easy to keep up to date, and when you have a lot > of servers that is a big plus. I disagree. The simplest way to update a bunch of servers is to create a single static linked httpd with everything you want in it, then copy _one file_ to each server, and re-start it. (Stop then start, not graceful.) > If you need a feature in php that is not included in the RH configure > you are better off using source, I've tried building the php source RPM > adding some new options and didn't come close to getting it to work, but > I'm not an expert in building RPM's and maybe it was all my fault. Correct. If the RPM isn't EXACTLY what you want, forget about it and use the source. > For those of you that are of the mindset that everyone should compile > everything from source, that's duly noted, but I'd rather hear from > people who weigh out the benefits of using one or the other and go with > the best choice. Compiling everything from source would be crazy! There are many things that come with a Linux distribution that are just fine. Compiling your own login, intetd, ps, ls, etc. would be nothing but a waste of time. As I said: If the RPM is exactly what you need, use it... else use the source and don't look back. Rick Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and PDF?????
I did a simple search at sourceforge.net, and got this link. Try this link instead: http://sourceforge.net/projects/pc4p/ "Jason Caldwell" <[EMAIL PROTECTED]> wrote in message 001701c1e1b9$784c7300$0202a8c0@cosmos">news:001701c1e1b9$784c7300$0202a8c0@cosmos... > Thanks for the response... I don't think the link you gave is working -- is > there another? > > Jason > > > - Original Message - > From: "Jason Wong" <[EMAIL PROTECTED]> > Newsgroups: php.general > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 1:57 PM > Subject: Re: [PHP] PHP and PDF? > > > > On Friday 12 April 2002 03:44, Jason Caldwell wrote: > > > Does anyone have any *simple* examples of how I can go about taking a > text > > > file and converting it to a PDF using PHP's PDF functions? Looking at > the > > > documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the > PDF > > > functions is a bit confusing... > > > > > > I just want to take a text file and convert it to a PDF file, just that > > > simple (I hope) :-) > > > > There's a nice class at http://pc4p.sourceforge.net which makes the PDF > > functions a lot easier to use. > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > Man has never reconciled himself to the ten commandments. > > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making graphics
H, I didn;t know you wanted to animate anything... but this could be achieved through CSS/DHMTL. And if you're going that way, the images themselves could be replaced with dynamically sized DIVs. DHTML isn't my thing though... check out some CSS newsgroups, and of course be prepared for lack of browser support of DHTML :) Justin French Creative Director http://Indent.com.au on 12/04/02 12:54 PM, Ian ([EMAIL PROTECTED]) wrote: > how do you then animate that? > - Original Message - > From: "Justin French" <[EMAIL PROTECTED]> > To: "Ian" <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 7:29 PM > Subject: Re: [PHP] Making graphics > > >> If you take a single coloured pixle (1x1), you can stretch it to any size >> via 's height and width attributes. No GC, no PHP, no JavaScript!! >> >> > $bar1height = 80; >> $bar2height = 25; >> $bar3height = 49; >> ?> >> >> >> >> >> >> This would produce a three bar graph, and with the use of align and > perhaps >> tables, they could be arranged into a reasonable graph representation > using >> tiny images, and virtualy no server-side programming. >> >> The height vars could be established via PHP calculations, values for a >> table, etc etc. >> >> >> Justin French >> >> Creative Director >> http://Indent.com.au >> >> >> >> >> >> on 12/04/02 3:56 AM, Ian ([EMAIL PROTECTED]) wrote: >> >>> modifying the width or height of an image in javascript works well > alsoi >>> cant imagine why youd want to do this serverside >>> >>> >>> "Christoph Starkmann" <[EMAIL PROTECTED]> wrote in message >>> B120D7EC8868D411A63D0050040EDA77111BEE@XCHANGE">news:B120D7EC8868D411A63D0050040EDA77111BEE@XCHANGE... Hi Ron! > Here is what I want to do. > > I am taking a poll and I would like to display the results in > a bar graph > format. What is the best way to do this.hopefully you > will not say GD > library! If you don't like GD, why not try Flash instead? ;)) >>> >>> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't load php_ldap.dll - Module doesn't exist???
Hello, I'm getting this error from IIS/NTSP4 - but the php_ldap.dll module is right next to the php_gd.dll module I'm loading (along with several others, but that doesn't seem to make any difference). What module is it looking for? John -- /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer * We also walk dogs... Dynamic Web Design PHP/MySQL/Linux/Hosting * www.steelesoftconsulting.com [EMAIL PROTECTED] */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alphabetizing titles when first word begins with'The','A',etc.
Hi Steph, 1st things 1st, you're date is set the year 00 for some reason, so your email was kinda hidden in my PHP folder. This may limit the number of ppl who respond. I have no idea if it can be done in the MySQL query, but you could get all your results into an array, and do a regular expression replace for an array of bad starts like The A An etc etc, creating a new item in the array called title_sort, and sort the array by that array element, but use the original title to print to the page. Sorry, I'm having trouble explaining it. Perhaps someone with a little more experience with arrays will be able to show you in code :) Justin on 13/04/00 5:44 AM, Steph ([EMAIL PROTECTED]) wrote: > Hi. Im using MySQL and as part of my tables I have titles (of stories). My > question os in regards to outputing those titles. Some of the titles begin > with words such as 'The', 'A', 'An', etc. Is there a way to order these > particular titles based on the second word in the title?? > > ~Steph > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Uploading not taking place
At 05:52 PM 4/11/02 +1000, Richard Archer wrote: >At 2:28 PM +0800 11/4/02, Manisha wrote: > > > > >That's a mighty small limit on file size. Especially if it's an >image being uploaded. Are you sure the file you're testing with >is smaller than 1000 bytes? > >Also, be aware that this field is advisory only. Many browsers >ignore it. > yes it is within limit > >if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { > > copy($HTTP_POST_FILES['userfile']['tmp_name'], "/img"); > >Check to see whether that "copy" function completed successfully. how ? I put one echo statement after copy which is displaying but never uploading the file. >I'd be surprised if you really want to move the file to /img. >And if you're on a Unix system the web server certainly won't >have write access to the / directory. i tried with complete path starting from root (/usr/web/html/img) and also with virtual (/img/). Is there any extra param setting ? any access rights ? > >STILL NOT GETTING LOADED. ANYTHING ELSE ? > >Please don't shout. Am I ? I do not think so. It is just an EMPHASIS. > ...R. > >-- >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] HTML Character Parsing
This is pretty basic, and I recommend looking at all the string functions. Basically, you want to use strip_tags() to get rid of the html (with optionally allowing SOME tags to be passed thru. Then use nl2br() to convert /n's (the only type of newline you're likely to receive via a web form) to 's. Let's say we only want to allow ; Bold,Italics,link\nunderline"; $string = strip_tags($string, ""); $string = nl2br($string); echo $string; ?> This will print: Bold,Italics,linkunderline Ie, every tag apart from the allowed tags has been stripped, and the \n has been changed to a break. Of course, all this is in the manual :) This doesn't strip out ALL evil however. There's been some discussion about the allowed tags having evil in them (eg ) recently, and you'd also want to trim the input down to a certain length (to save people flooding your server with 50mb of text or something :) The simple solution is not to think about what you KNOW of to be evil, but look at it the other way, and only accept what you consider safe, and throw out everything else. Justin French Justin French Creative Director http://Indent.com.au on 11/04/02 11:07 PM, David ([EMAIL PROTECTED]) wrote: > Hi all, > > I have a textarea which will containg info from the user. This then > needs to be parsed through something like htmlspecialchars() or > htmlentities(). > > The issue is that my system really needs to do the following: > > 1. Accept the info > 2. Check if there is any HTML syntax (, etc) > 3. If YES: remove anything that might be harmful (eg FORM, etc) > 4. If NO: Add replace CR/LF with > > The idea is that normal formatting such as , , , is > ok, but I do not want off illegal stuff. I want something a little like > Slashdot's stuff. > > Easy?? anyone know anything about this? > > Thanks > > David R > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Variable wildcards
This would certainly work, but I got a suggestion for using that i think will be a much cleaner solution. Thanks! - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: "Jason Bell" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 4:10 PM Subject: Re: Variable wildcards > If you want to process the list when they submit the form you can do > something like this: > > foreach($_REQUEST as $key => $value ) { > if( ereg("user([0-9]*)", $key, $match_ary) ) { > #go crazy; > } > } > > ?? > -philip > > On Thu, 11 Apr 2002, Jason Bell wrote: > > > Yeah, I thought so too, but variable variables doesn't seem to provide for > > this to add a little bit of detail to what I am doing, it is a user > > list, and I want to have a check box next to each user so that you can > > select 1 or more users for deletion. Each checkbox will be named User$id > > ($id of course being the numerical id of the user in the database) > > > > > > I did try doing somehting like $User{ereg ([0-9])} but it doesn't seem to > > work, or I'm doing it wrong. > > > > > > I guess maybe an easier way is if I could somehow drop all of the selected > > id's into an array? Then I wouldn't need to worry about needing to determine > > which variables exist. > > > > > > - Original Message - > > From: "Kevin Stone" <[EMAIL PROTECTED]> > > To: "Jason Bell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Thursday, April 11, 2002 3:44 PM > > Subject: Re: Variable wildcards > > > > > > > Sounds like what you want is Variable Variables. > > > http://www.php.net/manual/en/language.variables.variable.php > > > > > > - Original Message - > > > From: "Jason Bell" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Thursday, April 11, 2002 4:24 PM > > > Subject: Variable wildcards > > > > > > > > > are there wildcard characters for variables? > > > > > > Lets say that I have a varable that always starts with $user but then has > > > the 2 digit user id attached to the end, so it could be $user12 or $user28 > > > > > > > > > is there a way to grab these? sort of like in unix standards, where I > > could > > > use user?? or user* ? > > > > > > > > > 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] "the document contained no data"
I don't know how to set erro level to E_ALL, can you give me some sample. I did try different way handle.""; echo "Path: ".$d->path.""; $entry=$d->read() echo $entry ; $d->close(); ?> it is ok and the output is only a dot(.) if I add another read() statement then I got " ... no data" handle.""; echo "Path: ".$d->path.""; $entry=$d->read() echo $entry ; $entry=$d->read() echo $entry ; $d->close(); ?> can anyone tell me what has read() has and readdir() return. Martin Towell wrote: > turn the displaying of errors on, and set the error level to E_ALL > I'm thinking that you've got a error somewhere that's stopping the script > prematurely > > -Original Message- > From: Phieu Huynh [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 10:49 AM > To: [EMAIL PROTECTED] > Subject: [PHP] "the document contained no data" > > Hi, > I am trying to read the files in the directory and display them . > but I got the message " the document contained no data " > > this is my code >$d = dir("/export/home/phuy/www/test/upload"); > echo "Handle: ".$d->handle.""; > echo "Path: ".$d->path.""; > > while($entry=$d->read()) { > echo $entry."\n"; > } > echo ""; > $d->close(); > ?> > > Can anyone tell me what should I do to correct it. > I would like some help, thank in advance. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Phieu (phil) Huynh Computer System Officer Monash University Electrical & Computer Systems Engineering Phone : +61 3 990 53469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phpGuests?
Is this PHP guestbook no longer available for download? Does anyone know? Thanks, Steph
RE: [PHP] "the document contained no data"
turn the displaying of errors on, and set the error level to E_ALL I'm thinking that you've got a error somewhere that's stopping the script prematurely -Original Message- From: Phieu Huynh [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 10:49 AM To: [EMAIL PROTECTED] Subject: [PHP] "the document contained no data" Hi, I am trying to read the files in the directory and display them . but I got the message " the document contained no data " this is my code handle.""; echo "Path: ".$d->path.""; while($entry=$d->read()) { echo $entry."\n"; } echo ""; $d->close(); ?> Can anyone tell me what should I do to correct it. I would like some help, thank in advance. -- 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] Posting with script tags, or a plea not to
Rasmus, I gathered info in several ways to hopefully save time. I composed a message containing a simple, one-line PHP echo function and sent it to myself. Not surprisingly, nothing showed in the message body when pulled up via the webmail app. The exhibits are displayed below. This message was composed via Outlook, just to eliminate any confusion. Message sent: Subject: PHP Test Message: Message received in Earthlink webmail: Subject: PHP Test Message: (nothing appears) View Source in IE 6.0: Subject: PHP Test Earthlink Mailcenter's "view source" hyperlink to "mimeget.php3?": Subject: PHP Test Sender: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> X-Originating-IP: 66.149.18.3 Thanks, -- Barry C. Hawkins Systems Consultant [EMAIL PROTECTED] -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 8:07 PM To: Barry C. Hawkins Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Posting with script tags, or a plea not to Ok, but you didn't really answer my question. When you do a view source to see the raw html in the webmail app, do you see the PHP tags. ie. the tag in this thread? On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > Rasmus, > I was able to see the PHP code because I came home and fired up > Outlook. Right after I posted that last message, I closed Outlook and > went to Earthlink webmail. Same problem. No code, and incredibly > weird hyerlinks and garbled code. I opened Outlook back up, loaded > the same messages I just viewed in webmail, and presto, they look > fine. It's definitely their app. > I could create an email address and password for you on Earthlink > just to let you see it firsthand. However, I am sure you have much > better things to do with your time. > > Regards, > -- > Barry C. Hawkins > Systems Consultant > [EMAIL PROTECTED] > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 11, 2002 7:43 PM > To: Barry C. Hawkins > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Posting with script tags, or a plea not to > > > Well, you read the message and I didn't get an email. That tells me > that it isn't actually executing the code. Are you sure it isn't just > putting the code in the mail literally? ie. if you do a "view source" > on the message, do you not see the raw PHP tags? > > -Rasmus > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > Rasmus, > > Well, if ever I had leverage for asking Earthlink to fix the > problem, > > I think it would be now. Forwarding an email from the person > > credited > > > with starting the scripting language that they are using for their > > system that basically illustrates their recklessness should do the > > job. At least I would hope so. > > By the way, thanks for getting PHP going. I love having an > > alternative to ASP. > > > > > > -- > > Barry C. Hawkins > > Systems Consultant > > All Things Computed > > [EMAIL PROTECTED] > > > > -Original Message- > > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, April 11, 2002 7:20 PM > > To: Barry C. Hawkins > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Posting with script tags, or a plea not to > > > > > > > > > > I'm sorry, but if your webmail system just sent me your password > > file, > > > you should run, not walk, to another provider. This is a list about > > PHP. There is going to be example PHP snippets all over it. Deal > > with > > > it. > > > > -Rasmus > > > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > > > List members, > > > I am sure this was probably mentioned before I joined the > > > list, > > but when members post to the list using the PHP tags around the > > script, a number of web-based PHP mail apps attempt to process the > > script server-side and those of us blessed with such systems see > > either nothing or unintelligible garble with some of the funniest > > hyperlink behaviors I have seen in a while. > > > In case anyone's curious, I am using Earthlink's webmail, > > > which > > is a PHP3-based app (with several issues, particularly handling > > escaped characters and special characters in message replies). > > > Am I one of very few persons experiencing this? If not, > > > could we > > > > > (or have we already) adopt some policy to enable those with this > > > challenge to see code on postings? > > > > > > Regards, > > > -- > > > Barry C. Hawkins > > > Systems Consultant > > > All Things Computed > > > [EMAIL PROTECTED] > > > > > > > > > -- > > > 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 Genera
Re: [PHP] Variable wildcards
Hey J: On Thu, Apr 11, 2002 at 03:24:36PM -0700, Jason Bell wrote: > Lets say that I have a varable that always starts with $user but then > has the 2 digit user id attached to the end, so it could be $user12 or > $user28 Use an array. $user[12] and $user[28]. You can then use the various array functions to loop through them. Enjoy, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Forms in PHP
Actually after the submit button is clicked it returns a blank page. "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > Now I have a weird problem. I am using this code and can't understand why it > doesn't work. > When the script is run it returns a blank page, no error or done. > > here it is and any help would be appreciated. > > if(($type == book) or ($type == weapon)){ > echo ""; > echo ""; > echo "Put in my shop"; > echo "Put into my Footlocker"; > echo "Discard this item"; > echo "Donate this item"; > echo ""; > echo ""; > > > > if(isset($submit)) > { > > if($sort == "shop") > { > echo "done" or die("Not!"); > } > } > } > elseif($type==food) > { > > echo ""; > echo "Feed my pet"; > echo "Put in my shop"; > echo "Put into my Footlocker"; > echo "Discard this item"; > echo "Donate this item"; > echo ""; > echo ""; > echo ""; > > > } > } > } > > Thanks for your time > Jennifer > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] "the document contained no data"
Hi, I am trying to read the files in the directory and display them . but I got the message " the document contained no data " this is my code handle.""; echo "Path: ".$d->path.""; while($entry=$d->read()) { echo $entry."\n"; } echo ""; $d->close(); ?> Can anyone tell me what should I do to correct it. I would like some help, thank in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms in PHP
Hi all, Now I have a weird problem. I am using this code and can't understand why it doesn't work. When the script is run it returns a blank page, no error or done. here it is and any help would be appreciated. if(($type == book) or ($type == weapon)){ echo ""; echo ""; echo "Put in my shop"; echo "Put into my Footlocker"; echo "Discard this item"; echo "Donate this item"; echo ""; echo ""; if(isset($submit)) { if($sort == "shop") { echo "done" or die("Not!"); } } } elseif($type==food) { echo ""; echo "Feed my pet"; echo "Put in my shop"; echo "Put into my Footlocker"; echo "Discard this item"; echo "Donate this item"; echo ""; echo ""; echo ""; } } } Thanks for your time Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Posting with script tags, or a plea not to
Ok, but you didn't really answer my question. When you do a view source to see the raw html in the webmail app, do you see the PHP tags. ie. the tag in this thread? On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > Rasmus, > I was able to see the PHP code because I came home and fired up > Outlook. Right after I posted that last message, I closed Outlook and > went to Earthlink webmail. Same problem. No code, and incredibly weird > hyerlinks and garbled code. I opened Outlook back up, loaded the same > messages I just viewed in webmail, and presto, they look fine. It's > definitely their app. > I could create an email address and password for you on > Earthlink just to let you see it firsthand. However, I am sure you have > much better things to do with your time. > > Regards, > -- > Barry C. Hawkins > Systems Consultant > [EMAIL PROTECTED] > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 11, 2002 7:43 PM > To: Barry C. Hawkins > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Posting with script tags, or a plea not to > > > Well, you read the message and I didn't get an email. That tells me > that it isn't actually executing the code. Are you sure it isn't just > putting the code in the mail literally? ie. if you do a "view source" > on the message, do you not see the raw PHP tags? > > -Rasmus > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > Rasmus, > > Well, if ever I had leverage for asking Earthlink to fix the > problem, > > I think it would be now. Forwarding an email from the person credited > > > with starting the scripting language that they are using for their > > system that basically illustrates their recklessness should do the > > job. At least I would hope so. > > By the way, thanks for getting PHP going. I love having an > > alternative to ASP. > > > > > > -- > > Barry C. Hawkins > > Systems Consultant > > All Things Computed > > [EMAIL PROTECTED] > > > > -Original Message- > > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, April 11, 2002 7:20 PM > > To: Barry C. Hawkins > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Posting with script tags, or a plea not to > > > > > > > > > > I'm sorry, but if your webmail system just sent me your password file, > > > you should run, not walk, to another provider. This is a list about > > PHP. There is going to be example PHP snippets all over it. Deal with > > > it. > > > > -Rasmus > > > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > > > List members, > > > I am sure this was probably mentioned before I joined the list, > > but when members post to the list using the PHP tags around the > > script, a number of web-based PHP mail apps attempt to process the > > script server-side and those of us blessed with such systems see > > either nothing or unintelligible garble with some of the funniest > > hyperlink behaviors I have seen in a while. > > > In case anyone's curious, I am using Earthlink's webmail, which > > is a PHP3-based app (with several issues, particularly handling > > escaped characters and special characters in message replies). > > > Am I one of very few persons experiencing this? If not, could > > > we > > > > > (or have we already) adopt some policy to enable those with this > > > challenge to see code on postings? > > > > > > Regards, > > > -- > > > Barry C. Hawkins > > > Systems Consultant > > > All Things Computed > > > [EMAIL PROTECTED] > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Tutorial on proper code formating
Thank you all for your input. I will read through the tutorial and then figure out which style I want to use. I appreciate your time. Jennifer "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > Could someone point me to a tutorial on the proper way to format code. To > make it more readable. > > TIA > Jennifer > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Posting with script tags, or a plea not to
Rasmus, I was able to see the PHP code because I came home and fired up Outlook. Right after I posted that last message, I closed Outlook and went to Earthlink webmail. Same problem. No code, and incredibly weird hyerlinks and garbled code. I opened Outlook back up, loaded the same messages I just viewed in webmail, and presto, they look fine. It's definitely their app. I could create an email address and password for you on Earthlink just to let you see it firsthand. However, I am sure you have much better things to do with your time. Regards, -- Barry C. Hawkins Systems Consultant [EMAIL PROTECTED] -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 7:43 PM To: Barry C. Hawkins Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Posting with script tags, or a plea not to Well, you read the message and I didn't get an email. That tells me that it isn't actually executing the code. Are you sure it isn't just putting the code in the mail literally? ie. if you do a "view source" on the message, do you not see the raw PHP tags? -Rasmus On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > Rasmus, > Well, if ever I had leverage for asking Earthlink to fix the problem, > I think it would be now. Forwarding an email from the person credited > with starting the scripting language that they are using for their > system that basically illustrates their recklessness should do the > job. At least I would hope so. > By the way, thanks for getting PHP going. I love having an > alternative to ASP. > > > -- > Barry C. Hawkins > Systems Consultant > All Things Computed > [EMAIL PROTECTED] > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 11, 2002 7:20 PM > To: Barry C. Hawkins > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Posting with script tags, or a plea not to > > > > > I'm sorry, but if your webmail system just sent me your password file, > you should run, not walk, to another provider. This is a list about > PHP. There is going to be example PHP snippets all over it. Deal with > it. > > -Rasmus > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > List members, > > I am sure this was probably mentioned before I joined the list, > but when members post to the list using the PHP tags around the > script, a number of web-based PHP mail apps attempt to process the > script server-side and those of us blessed with such systems see > either nothing or unintelligible garble with some of the funniest > hyperlink behaviors I have seen in a while. > > In case anyone's curious, I am using Earthlink's webmail, which > is a PHP3-based app (with several issues, particularly handling > escaped characters and special characters in message replies). > > Am I one of very few persons experiencing this? If not, could > > we > > > (or have we already) adopt some policy to enable those with this > > challenge to see code on postings? > > > > Regards, > > -- > > Barry C. Hawkins > > Systems Consultant > > All Things Computed > > [EMAIL PROTECTED] > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Posting with script tags, or a plea not to
Well, you read the message and I didn't get an email. That tells me that it isn't actually executing the code. Are you sure it isn't just putting the code in the mail literally? ie. if you do a "view source" on the message, do you not see the raw PHP tags? -Rasmus On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > Rasmus, > Well, if ever I had leverage for asking Earthlink to fix the > problem, I think it would be now. Forwarding an email from the person > credited with starting the scripting language that they are using for > their system that basically illustrates their recklessness should do the > job. At least I would hope so. > By the way, thanks for getting PHP going. I love having an > alternative to ASP. > > > -- > Barry C. Hawkins > Systems Consultant > All Things Computed > [EMAIL PROTECTED] > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 11, 2002 7:20 PM > To: Barry C. Hawkins > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Posting with script tags, or a plea not to > > > > > I'm sorry, but if your webmail system just sent me your password file, > you should run, not walk, to another provider. This is a list about > PHP. There is going to be example PHP snippets all over it. Deal with > it. > > -Rasmus > > On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > > > List members, > > I am sure this was probably mentioned before I joined the list, > but when members post to the list using the PHP tags around the script, > a number of web-based PHP mail apps attempt to process the script > server-side and those of us blessed with such systems see either nothing > or unintelligible garble with some of the funniest hyperlink behaviors I > have seen in a while. > > In case anyone's curious, I am using Earthlink's webmail, which > is a PHP3-based app (with several issues, particularly handling escaped > characters and special characters in message replies). > > Am I one of very few persons experiencing this? If not, could we > > > (or have we already) adopt some policy to enable those with this > > challenge to see code on postings? > > > > Regards, > > -- > > Barry C. Hawkins > > Systems Consultant > > All Things Computed > > [EMAIL PROTECTED] > > > > > > -- > > 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] Posting with script tags, or a plea not to
-Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 4:50 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Posting with script tags, or a plea not to On Friday 12 April 2002 03:51, Barry C. Hawkins wrote: > List members, > I am sure this was probably mentioned before I joined the list, > but when members post to the list using the PHP tags around the > script, a number of web-based PHP mail apps attempt to process the > script server-side and those of us blessed with such systems see > either nothing or unintelligible garble with some of the funniest > hyperlink behaviors I have seen in a while. In case anyone's curious, > I am using Earthlink's webmail, which is a PHP3-based app (with > several issues, particularly handling escaped characters and special > characters in message replies). Am I one of very few persons > experiencing this? If not, could we (or have we already) adopt some > policy to enable those with this challenge to see code on postings? There is something seriously wrong if your webmail is trying to execute the php code embedded inside an email. Is it a proprietory webmail system that Earthlink is using? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* If people see that you mean them no harm, they'll never hurt you, nine times out of ten! */ It looks proprietary to me, like some home-grown app that they may have developed internally. Maybe I should just make a fix and send it to their support staff...it's really frustrating. -- Barry C. Hawkins Systems Consultant [EMAIL PROTECTED] -- 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] Posting with script tags, or a plea not to
Rasmus, Well, if ever I had leverage for asking Earthlink to fix the problem, I think it would be now. Forwarding an email from the person credited with starting the scripting language that they are using for their system that basically illustrates their recklessness should do the job. At least I would hope so. By the way, thanks for getting PHP going. I love having an alternative to ASP. -- Barry C. Hawkins Systems Consultant All Things Computed [EMAIL PROTECTED] -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 7:20 PM To: Barry C. Hawkins Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Posting with script tags, or a plea not to I'm sorry, but if your webmail system just sent me your password file, you should run, not walk, to another provider. This is a list about PHP. There is going to be example PHP snippets all over it. Deal with it. -Rasmus On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > List members, > I am sure this was probably mentioned before I joined the list, but when members post to the list using the PHP tags around the script, a number of web-based PHP mail apps attempt to process the script server-side and those of us blessed with such systems see either nothing or unintelligible garble with some of the funniest hyperlink behaviors I have seen in a while. > In case anyone's curious, I am using Earthlink's webmail, which is a PHP3-based app (with several issues, particularly handling escaped characters and special characters in message replies). > Am I one of very few persons experiencing this? If not, could we > (or have we already) adopt some policy to enable those with this > challenge to see code on postings? > > Regards, > -- > Barry C. Hawkins > Systems Consultant > All Things Computed > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML Character Parsing
I have this class, comes close to what you want. Feel free to modify, sorry I didn't have the time to comment it yet. I hope you can understand and use it :-) Anyway test it and see what it does. class InseForm { function AllowedTags() { $allowed_tags = Array(); $allowed_tags[''] = ''; $allowed_tags[''] = ''; $allowed_tags[] = ''; $allowed_tags[''] = ''; $allowed_tags[''] = ''; return $allowed_tags; } function FilterTags($text) { $text = strip_tags($text, ''); $text = ereg_replace("]+href *= *([^ ]+)[^>]*>", "", $text); $text = ereg_replace("<(/?[[b]r?|i|p|a])[^>]*>", "<\\1>", $text); return htmlentities(stripslashes(trim($text))); } function CountAllowedTags($text) { $missing_tag = ''; foreach($this->AllowedTags() as $open_tag => $close_tag) { $nr_open_tags = substr_count(strtolower($text), $open_tag); $nr_close_tags = substr_count(strtolower($text), $close_tag); if ($nr_open_tags > $nr_close_tags) { $missing_tag .= 'A tag ' . htmlentities($open_tag) . ' was not closed!'; } } if (!ereg("^[[:blank:]]*$", $missing_tag)) { return '' . $missing_tag . ''; } else { return false; } } } -- Julio Nobrega. Tô chegando: http://www.inerciasensorial.com.br "David" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I have a textarea which will containg info from the user. This then > needs to be parsed through something like htmlspecialchars() or > htmlentities(). > > The issue is that my system really needs to do the following: > > 1. Accept the info > 2. Check if there is any HTML syntax (, etc) > 3. If YES: remove anything that might be harmful (eg FORM, etc) > 4. If NO: Add replace CR/LF with > > The idea is that normal formatting such as , , , is > ok, but I do not want off illegal stuff. I want something a little like > Slashdot's stuff. > > Easy?? anyone know anything about this? > > Thanks > > David R > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and PDF?????
Thanks for the response... I don't think the link you gave is working -- is there another? Jason - Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 1:57 PM Subject: Re: [PHP] PHP and PDF? > On Friday 12 April 2002 03:44, Jason Caldwell wrote: > > Does anyone have any *simple* examples of how I can go about taking a text > > file and converting it to a PDF using PHP's PDF functions? Looking at the > > documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the PDF > > functions is a bit confusing... > > > > I just want to take a text file and convert it to a PDF file, just that > > simple (I hope) :-) > > There's a nice class at http://pc4p.sourceforge.net which makes the PDF > functions a lot easier to use. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Man has never reconciled himself to the ten commandments. > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting with script tags, or a plea not to
I'm sorry, but if your webmail system just sent me your password file, you should run, not walk, to another provider. This is a list about PHP. There is going to be example PHP snippets all over it. Deal with it. -Rasmus On Thu, 11 Apr 2002, Barry C. Hawkins wrote: > List members, > I am sure this was probably mentioned before I joined the list, but when >members post to the list using the PHP tags around the script, a number of web-based >PHP mail apps attempt to process the script server-side and those of us blessed with >such systems see either nothing or unintelligible garble with some of the funniest >hyperlink behaviors I have seen in a while. > In case anyone's curious, I am using Earthlink's webmail, which is a PHP3-based >app (with several issues, particularly handling escaped characters and special >characters in message replies). > Am I one of very few persons experiencing this? If not, could we (or have we >already) adopt some policy to enable those with this challenge to see code on >postings? > > Regards, > -- > Barry C. Hawkins > Systems Consultant > All Things Computed > [EMAIL PROTECTED] > > > -- > 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] Set Global Variables
Well, on unix, you could use the (still experimental, according to the docs) shared memory functions: http://php.he.net/manual/en/ref.shmop.php There's also the apparently more mature, but less portable semaphore/shared memory functions (also Unix only) here: http://php.he.net/manual/en/ref.sem.php I've never used either of these. Maybe you could explain what you're trying to do a bit more (and what platform you're on). I can't see where loading separate copies of the variables would be much of a memory issue, unless you have large numbers of variables, very long strings stored there, and hundreds of apache child processes. - steve At 2:52 PM -0400 4/11/02, [EMAIL PROTECTED] wrote: >If I do that, won't the data that I fetch be duplicated in memory for each >user? I'm trying to have just one space in memory allocated for these >variables, sort of like the HTTP_SERVER_VARS. It seems that even if I do an >autoprepend that file is going to run each time a user visits the site and a >new memory space will be created for that variable. What I'm asking is how >to set those constant server-wide global variables. > >Thanks >Roger > >-Original Message- >From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] >Sent: Thursday, April 11, 2002 10:15 AM >To: [EMAIL PROTECTED] >Cc: [EMAIL PROTECTED] >Subject: Re: [PHP] Set Global Variables > > >Set up an auto_prepend file that either simply sets these constant globals >ot fetches them from the DB. > >-Rasmus > >On Thu, 11 Apr 2002 [EMAIL PROTECTED] wrote: > >> Is there a way to set a global variable that all users can access? I have >> some values in a database that I'm reading at the beginning of the session >> and carrying through out the session. The thing is, those values are the >> same for every user and instead of having a memory space for each users >> values I'd rather just use one memory space for all users. >> >> Thanks >> >> Roger Ramirez >> Web Developer > > LifeFiles.com Inc. >> -- ++ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | ++ | "If only life would imitate toys." | | - Ted Raimi, March 2002 | | - http://www.whoosh.org/issue67/friends67a.html#raimi | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pass variables via URL
missing an "echo" - -Original Message- From: Craig Westerman [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 9:45 AM To: php-general-list Subject: [PHP] Pass variables via URL I'm trying to set $image = imageA via a URL: http://www.abc123.com/php001/image_switch.php?image=imageA Script is: Image Switch Image link ends up as: http://www.abc123.com/php001/.gif Link needs to be: http://www.abc123.com/php001/imageA.gif What am I doing wrong? Thanks Craig ><> [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pass variables via URL
I'm trying to set $image = imageA via a URL: http://www.abc123.com/php001/image_switch.php?image=imageA Script is: Image Switch Image link ends up as: http://www.abc123.com/php001/.gif Link needs to be: http://www.abc123.com/php001/imageA.gif What am I doing wrong? Thanks Craig ><> [EMAIL PROTECTED]
[PHP] Re: Variable wildcards
If you want to process the list when they submit the form you can do something like this: foreach($_REQUEST as $key => $value ) { if( ereg("user([0-9]*)", $key, $match_ary) ) { #go crazy; } } ?? -philip On Thu, 11 Apr 2002, Jason Bell wrote: > Yeah, I thought so too, but variable variables doesn't seem to provide for > this to add a little bit of detail to what I am doing, it is a user > list, and I want to have a check box next to each user so that you can > select 1 or more users for deletion. Each checkbox will be named User$id > ($id of course being the numerical id of the user in the database) > > > I did try doing somehting like $User{ereg ([0-9])} but it doesn't seem to > work, or I'm doing it wrong. > > > I guess maybe an easier way is if I could somehow drop all of the selected > id's into an array? Then I wouldn't need to worry about needing to determine > which variables exist. > > > - Original Message - > From: "Kevin Stone" <[EMAIL PROTECTED]> > To: "Jason Bell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 3:44 PM > Subject: Re: Variable wildcards > > > > Sounds like what you want is Variable Variables. > > http://www.php.net/manual/en/language.variables.variable.php > > > > - Original Message - > > From: "Jason Bell" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, April 11, 2002 4:24 PM > > Subject: Variable wildcards > > > > > > are there wildcard characters for variables? > > > > Lets say that I have a varable that always starts with $user but then has > > the 2 digit user id attached to the end, so it could be $user12 or $user28 > > > > > > is there a way to grab these? sort of like in unix standards, where I > could > > use user?? or user* ? > > > > > > 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] Variable wildcards
Yeah, I thought so too, but variable variables doesn't seem to provide for this to add a little bit of detail to what I am doing, it is a user list, and I want to have a check box next to each user so that you can select 1 or more users for deletion. Each checkbox will be named User$id ($id of course being the numerical id of the user in the database) I did try doing somehting like $User{ereg ([0-9])} but it doesn't seem to work, or I'm doing it wrong. I guess maybe an easier way is if I could somehow drop all of the selected id's into an array? Then I wouldn't need to worry about needing to determine which variables exist. - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: "Jason Bell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 3:44 PM Subject: Re: [PHP] Variable wildcards > Sounds like what you want is Variable Variables. > http://www.php.net/manual/en/language.variables.variable.php > > - Original Message - > From: "Jason Bell" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 4:24 PM > Subject: [PHP] Variable wildcards > > > are there wildcard characters for variables? > > Lets say that I have a varable that always starts with $user but then has > the 2 digit user id attached to the end, so it could be $user12 or $user28 > > > is there a way to grab these? sort of like in unix standards, where I could > use user?? or user* ? > > > Thanks! > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
Kevin Stone wrote: > Wouldn't it be more helpful to assume that the individual is simply > uninformed? So isntead of flaming him and calling him stupid you could say, > "Check the PHP manual at www.php.net". > -Kevin > The definition of a question assumes the person is uninformed - else, why ask the question? Perhaps the list should have an autoreponse with 'check the php.net manual' as a canned response to every post. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable wildcards
Sounds like what you want is Variable Variables. http://www.php.net/manual/en/language.variables.variable.php - Original Message - From: "Jason Bell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 4:24 PM Subject: [PHP] Variable wildcards are there wildcard characters for variables? Lets say that I have a varable that always starts with $user but then has the 2 digit user id attached to the end, so it could be $user12 or $user28 is there a way to grab these? sort of like in unix standards, where I could use user?? or user* ? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable wildcards
are there wildcard characters for variables? Lets say that I have a varable that always starts with $user but then has the 2 digit user id attached to the end, so it could be $user12 or $user28 is there a way to grab these? sort of like in unix standards, where I could use user?? or user* ? Thanks!
[PHP] session unset or unregister??
Hi list, I'm in a serious trouble that I couldn't figure out an escape. I have basically to html pages that pass variables to each other by get method. So I register some vars in sessions. in one o this pages i have. if(isset($HTTP_GET_VARS['erase_data'])) { session_unregister('data'); } but the code doesn't erase the var from session, and If i use session_unset('data') it erases all vars from session, that I don't want to. How to solve this?!??! i have started the session and used session_register('data','id').. to store the vars. Thank's in advance Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ImageTTFText Problems...
Never mind. I managed to find a free code 39 barcode font that /is/ Unicode compatible, and it works. Matthew Walker Senior Software Engineer ePliant Marketing -Original Message- From: Matthew Walker Sent: Thursday, April 11, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: [PHP] ImageTTFText Problems... Im having no luck using ImageTTFText(). I have a .ttf barcode font that works fine on windows if I select it in a word processor, but when I try and use it with PHP to generate barcode images, it outputs a blank image. I can select other TTF fonts, and they work fine. Just this one seems to have a problem. Ive read that a font wont work with PHP if it isnt Unicode compatible. Is there any way I can check this? Or is something else probably wrong? Matthew Walker Senior Software Engineer ePliant Marketing --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.345 / Virus Database: 193 - Release Date: 4/9/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.345 / Virus Database: 193 - Release Date: 4/9/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageTTFText Problems...
Im having no luck using ImageTTFText(). I have a .ttf barcode font that works fine on windows if I select it in a word processor, but when I try and use it with PHP to generate barcode images, it outputs a blank image. I can select other TTF fonts, and they work fine. Just this one seems to have a problem. Ive read that a font wont work with PHP if it isnt Unicode compatible. Is there any way I can check this? Or is something else probably wrong? Matthew Walker Senior Software Engineer ePliant Marketing --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.345 / Virus Database: 193 - Release Date: 4/9/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string...
Aehm, as I´m a bit old- and shell- stylish (see reply from Rasmus on:How to create...) why don´t you just make unset($retval); // cleans the array to contain the resul exec("ls ".$your_path".*_.jpg",$retval,$is_ok); // $retval will be an array containing all matches if($is_ok) { $retval[$i] } Here is an example of the files in the directory... >willies_0411.jpg >watson_0411.jpg >willies_logo.jpg >watson_logo.jpg >etc.. >When I remove the eregi() it works fine, all the files are displayed, >however I only want the files ending in _.jpg to be displayed in the >select box and well I did another one using a sting to filter out all files >except _logo.jpg and it works fine, I just can't get the _.jpg files to >display. Also the directory is fine, I have the same function being called >in two places one to display only *_logo.jpg files and the second to display >only *_.jpg files the number one doesnt seem to work so I may just >create two directories for the two types I need, but I would rather get this >sting function down so I can use it elsewhere on our site. Any help would >be great... >Jas > >"Erik Price" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > On Friday, April 12, 2002, at 01:50 AM, jas wrote: > > > > > Ok, I have tried all 3 examples and even tried a few variations that you > > > have given me and so far nothing is getting displayed, is there a way to > > > check for errors? here is the code I am working with: > > > > What happens if you get rid of that eregi() function? Does it show you > > all of your files? If so, then the problem is the regex in your eregi(). > > > > > > > // second selection for main image on main page > > > $dir_name = "/path/to/images/directory/"; > > > $dir = opendir($dir_name); > > > $file_lost .= " > > NAME=\"images\"> > > > "; > > > while ($file_names = readdir($dir)) { > > > if ($file_names != "." && $file_names !=".." && > > > eregi("^/*_[0-9]{4}\.jpg$", $file_name)) { > > ^^ > > This regex will match only files that obey the following rules: > > 1. may or may not start with a slash > > 2. next character must be an underscore > > 3. next 4 characters must be digits > > 4. next character must be a dot > > 5. next 3 characters must be "jpg" > > 6. case doesn't matter > > > > Are you sure you have files that meet the above 6 rules in your > > directory? If you don't, then nothing will be displayed. Are you sure > > that your "/path/to/directory" is a real path to a real directory? etc > > etc > > > > > > > $file_lost .= " > > NAME=\"$file_names\">$file_names"; > > > } > > > } > > > $file_lost .= " > > VALUE=\"select\">"; > > > closedir($dir); > > > > > > > > > > > > Erik > > > > > > > > > > > > Erik Price > > Web Developer Temp > > Media Lab, H.H. Brown > > [EMAIL PROTECTED] > > > > > >-- >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] Re: PHP & Dynamic XML Pages
I use pretty much the same idea, but PHP isn't used to parse the returned XML. Rather, it just fetches the XML and sends it off to an XSLT processor. Look at the XSLT extension for PHP. You'll likely need to get Sablotron from www.gingerall.com. You'll also have to write an XSL stylesheet to convert the XML to HTML. Of course, this is all done with PHP4. I haven't used PHP3, so I can't say if it would work properly with it. (Is there even an XSLT extension for PHP3?) J Alex Kirk wrote: > I've got a client who wants me to build a form-based user interface for an > application that will allow people to sign up for ISP service. Each form > will post to a remote server, which will give me an XML reply upon which > to base the response page for the user. > > Being very much new to PHP, I'm not sure if this is even possible. I know > PHP can parse XML and act appropriately thereupon, but every example I've > looked up shows PHP just parsing a static XML page. > > As best I can tell, the sequence of events if this did work would be: > > 1. User posts HTML form to PHP script. > 2. PHP script submits appropriately encoded query string to remote server. > 3. PHP script parses returned XML. > 4. PHP script generates HTML to send to the user. > > Do I have this roughly right? Can such a thing even happen? If not, is > there a language I can do it in? Oh, and probably very importantly, would > having PHP3 (the version their server is running) pose problems? > > Thanks, > Alex Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
Wouldn't it be more helpful to assume that the individual is simply uninformed? So isntead of flaming him and calling him stupid you could say, "Check the PHP manual at www.php.net". -Kevin - Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 2:53 PM Subject: Re: [PHP] chechking to see if a directory already exists > On Friday 12 April 2002 04:48, Jeff Bearer wrote: > > In the spirit of sharing I'll supply a link to tfm > > > > http://www.php.net/manual/en/function.is-dir.php > > http://www.php.net/manual/en/function.file-exists.php > > > > sometimes it's hard to rtfm if you don't even know what you are looking > > for. > > PHP has one of the best laid out manuals. Even a cursory search for > "directory" in the main chapter headings would have lead to the correct > answer. Talk about lazy or what? > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > -- Owen Meredith > */ > > -- > 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] send both POST and GET data
On Thursday, April 11, 2002, at 04:09 PM, Erik Price wrote: > I'm trying to think of a clever way to send both POST and GET data in > the same form. I want to use GET data so that the variables appear in > the querystring (so that users can bookmark or save the URL, it's a > search engine-kinda thing), but I have a main switch() statement which > is controlled by POST data -- because after the search engine step of > the form, I want the rest of the data to be sent by POST. > > Any good ideas? I just thought of an answer to my own question -- I could change the switch() statement so that it is controlled by GET data and simply pass the appropriate value on the querystring in the form's "action" attribute, but use POST as the method of the form. So I end up with a form that looks like: $form = "\n"; This works very well -- and by including a hidden form field in the POST-based form like "", I can perform a test at the receiving end to make sure that the user didn't bookmark this page. Of course, it's not real security, since anyone could fake the POST data, but I'm not trying to hide anything -- just trying to keep the user from making a dumb mistake. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and PDF?????
On Friday 12 April 2002 03:44, Jason Caldwell wrote: > Does anyone have any *simple* examples of how I can go about taking a text > file and converting it to a PDF using PHP's PDF functions? Looking at the > documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the PDF > functions is a bit confusing... > > I just want to take a text file and convert it to a PDF file, just that > simple (I hope) :-) There's a nice class at http://pc4p.sourceforge.net which makes the PDF functions a lot easier to use. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Man has never reconciled himself to the ten commandments. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: pages compressed with zlib
Levy Alves Carneiro Jr. wrote: > > Hello, > > inside php.ini file there's a special configuration: > > ; Transparent output compression using the zlib library > ; Valid values for this option are 'off', 'on', or a specific > ; buffer size to be used for compression (default is 4KB) > zlib.output_compression = On > > this way pages will be parsed, compressed, and then sent to the > browser. Does anybody know of pros & cons of using this > configuration? Which browsers support zlib compression? > > Thanks, > Levy > Netscape 4.x *says* it supports compression, but it doesn't uncompress when printing, so if you use the compression method, your netscape 4 users will be at a loss if they want to print. Maybe this will force them to upgrade (finally) but probably not. Michael Kimsal http://www.phphelpdesk.com Guaranteed PHP support when you need it 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
On Friday 12 April 2002 04:48, Jeff Bearer wrote: > In the spirit of sharing I'll supply a link to tfm > > http://www.php.net/manual/en/function.is-dir.php > http://www.php.net/manual/en/function.file-exists.php > > sometimes it's hard to rtfm if you don't even know what you are looking > for. PHP has one of the best laid out manuals. Even a cursory search for "directory" in the main chapter headings would have lead to the correct answer. Talk about lazy or what? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* -- Owen Meredith */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting with script tags, or a plea not to
On Friday 12 April 2002 03:51, Barry C. Hawkins wrote: > List members, > I am sure this was probably mentioned before I joined the list, but > when members post to the list using the PHP tags around the script, a > number of web-based PHP mail apps attempt to process the script server-side > and those of us blessed with such systems see either nothing or > unintelligible garble with some of the funniest hyperlink behaviors I have > seen in a while. In case anyone's curious, I am using Earthlink's webmail, > which is a PHP3-based app (with several issues, particularly handling > escaped characters and special characters in message replies). Am I one of > very few persons experiencing this? If not, could we (or have we already) > adopt some policy to enable those with this challenge to see code on > postings? There is something seriously wrong if your webmail is trying to execute the php code embedded inside an email. Is it a proprietory webmail system that Earthlink is using? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* If people see that you mean them no harm, they'll never hurt you, nine times out of ten! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
In the spirit of sharing I'll supply a link to tfm http://www.php.net/manual/en/function.is-dir.php http://www.php.net/manual/en/function.file-exists.php sometimes it's hard to rtfm if you don't even know what you are looking for. On Thu, 2002-04-11 at 16:42, Jason Wong wrote: > On Friday 12 April 2002 05:36, Someone Somewhere wrote: > > How can I check to see if a directory already exists. > > rtfm > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > No one wants war. > -- Kirk, "Errand of Mercy", stardate 3201.7 > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
On Friday 12 April 2002 05:36, Someone Somewhere wrote: > How can I check to see if a directory already exists. rtfm -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* No one wants war. -- Kirk, "Errand of Mercy", stardate 3201.7 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD 2.0
I have a problem that I can't figure out. I'm using PHP ver. 4.0.6 which has a few functions built in it that require GD 2.0 or better, however; I tried putting GD 2.0.1 in my /usr/lib/ directory but it still cannot find it. Does anyone know why? -- Edgardo G. Diaz Software Engineer Paragee Zero Search 109 4th Street, Suite B Eureka, California 95501 707.445.2678 ext 205 707.445.4655 fax http://www.paragee.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] chechking to see if a directory already exists
How can I check to see if a directory already exists. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] large file error
is there some way to enable large file support for the fstat functions? when i try to do an fstat on a large file (4 gig) i get the following error: stat failed for /test/test.gz (errno=127 - Value too large to be stored in data type) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & Dynamic XML Pages
I've got a client who wants me to build a form-based user interface for an application that will allow people to sign up for ISP service. Each form will post to a remote server, which will give me an XML reply upon which to base the response page for the user. Being very much new to PHP, I'm not sure if this is even possible. I know PHP can parse XML and act appropriately thereupon, but every example I've looked up shows PHP just parsing a static XML page. As best I can tell, the sequence of events if this did work would be: 1. User posts HTML form to PHP script. 2. PHP script submits appropriately encoded query string to remote server. 3. PHP script parses returned XML. 4. PHP script generates HTML to send to the user. Do I have this roughly right? Can such a thing even happen? If not, is there a language I can do it in? Oh, and probably very importantly, would having PHP3 (the version their server is running) pose problems? Thanks, Alex Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] send both POST and GET data
I'm trying to think of a clever way to send both POST and GET data in the same form. I want to use GET data so that the variables appear in the querystring (so that users can bookmark or save the URL, it's a search engine-kinda thing), but I have a main switch() statement which is controlled by POST data -- because after the search engine step of the form, I want the rest of the data to be sent by POST. Any good ideas? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and PDF?????
Try looking at fpdf, which can be found at fpdf.org. I have used it for a couple things and it works beautifully. Cheers! Rick "It is better to have loved and lost than to never have loved at all." - Unknown > From: "Jason Caldwell" <[EMAIL PROTECTED]> > Date: Thu, 11 Apr 2002 12:44:10 -0700 > To: [EMAIL PROTECTED] > Subject: [PHP] PHP and PDF? > > Does anyone have any *simple* examples of how I can go about taking a text > file and converting it to a PDF using PHP's PDF functions? Looking at the > documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the PDF > functions is a bit confusing... > > I just want to take a text file and convert it to a PDF file, just that > simple (I hope) :-) > > Thanks. > Jason > > > > -- > 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] Set Global Variables
Keep in mind that there is no common memory space for all the users. Each request is being handled by a different process with its own memory space that's forked off of the original web server. (Assuming apache, I don't know how IIS works). -Steve On Thursday, April 11, 2002, at 01:52 PM, [EMAIL PROTECTED] wrote: > If I do that, won't the data that I fetch be duplicated in memory for > each > user? I'm trying to have just one space in memory allocated for these > variables, sort of like the HTTP_SERVER_VARS. It seems that even if I > do an > autoprepend that file is going to run each time a user visits the site > and a > new memory space will be created for that variable. What I'm asking is > how > to set those constant server-wide global variables. > > Thanks > Roger > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 11, 2002 10:15 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Set Global Variables > > > Set up an auto_prepend file that either simply sets these constant > globals > ot fetches them from the DB. > > -Rasmus > > On Thu, 11 Apr 2002 [EMAIL PROTECTED] wrote: > >> Is there a way to set a global variable that all users can access? I >> have >> some values in a database that I'm reading at the beginning of the >> session >> and carrying through out the session. The thing is, those values are >> the >> same for every user and instead of having a memory space for each users >> values I'd rather just use one memory space for all users. >> >> Thanks >> >> Roger Ramirez >> Web Developer >> LifeFiles.com Inc. >> >> >> -- >> 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] unique ID
I personally really like this, Maybe you can customize it as needed - or someone can improve upon it ! PIN9f39f7 $rawuid = md5(uniqid(rand(),1)); $uid = "PIN" . substr($rawuid,0,6); echo $uid; ?> on 4/11/02 3:44 PM, ROBERT MCPEAK at [EMAIL PROTECTED] wrote: > Could somebody share with me a simple way to create a unique numeric ID > for a new record in a mySQL db? > > Thanks! -- s t e v e b i s s o n n e t t e [EMAIL PROTECTED] PLANK. A multi-faceted-media company. http://www.plankdesign.com v. 514.875.0003 f. 514.875.7611 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Posting with script tags, or a plea not to
List members, I am sure this was probably mentioned before I joined the list, but when members post to the list using the PHP tags around the script, a number of web-based PHP mail apps attempt to process the script server-side and those of us blessed with such systems see either nothing or unintelligible garble with some of the funniest hyperlink behaviors I have seen in a while. In case anyone's curious, I am using Earthlink's webmail, which is a PHP3-based app (with several issues, particularly handling escaped characters and special characters in message replies). Am I one of very few persons experiencing this? If not, could we (or have we already) adopt some policy to enable those with this challenge to see code on postings? Regards, -- Barry C. Hawkins Systems Consultant All Things Computed [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unique ID
Make an autoincrement/primary column? Or keep a number stored and increase it one by one and using when derirable? I prefer the first one :-) -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 "Robert McPeak" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Could somebody share with me a simple way to create a unique numeric ID > for a new record in a mySQL db? > > Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and PDF?????
Does anyone have any *simple* examples of how I can go about taking a text file and converting it to a PDF using PHP's PDF functions? Looking at the documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the PDF functions is a bit confusing... I just want to take a text file and convert it to a PDF file, just that simple (I hope) :-) Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unique ID
Could somebody share with me a simple way to create a unique numeric ID for a new record in a mySQL db? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string...
Checkout the substr() function. You can do something like: if (substr($var, -9) = '_.jpg')) { // do something } -9 would be the staring position. I am not sure if this is the right number, so you will have to look at the manual :-) -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 "Jas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Here is an example of the files in the directory... > willies_0411.jpg > watson_0411.jpg > willies_logo.jpg > watson_logo.jpg > etc.. > When I remove the eregi() it works fine, all the files are displayed, > however I only want the files ending in _.jpg to be displayed in the > select box and well I did another one using a sting to filter out all files > except _logo.jpg and it works fine, I just can't get the _.jpg files to > display. Also the directory is fine, I have the same function being called > in two places one to display only *_logo.jpg files and the second to display > only *_.jpg files the number one doesnt seem to work so I may just > create two directories for the two types I need, but I would rather get this > sting function down so I can use it elsewhere on our site. Any help would > be great... > Jas > > "Erik Price" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > On Friday, April 12, 2002, at 01:50 AM, jas wrote: > > > > > Ok, I have tried all 3 examples and even tried a few variations that you > > > have given me and so far nothing is getting displayed, is there a way to > > > check for errors? here is the code I am working with: > > > > What happens if you get rid of that eregi() function? Does it show you > > all of your files? If so, then the problem is the regex in your eregi(). > > > > > > > // second selection for main image on main page > > > $dir_name = "/path/to/images/directory/"; > > > $dir = opendir($dir_name); > > > $file_lost .= " > > NAME=\"images\"> > > > "; > > > while ($file_names = readdir($dir)) { > > > if ($file_names != "." && $file_names !=".." && > > > eregi("^/*_[0-9]{4}\.jpg$", $file_name)) { > > ^^ > > This regex will match only files that obey the following rules: > > 1. may or may not start with a slash > > 2. next character must be an underscore > > 3. next 4 characters must be digits > > 4. next character must be a dot > > 5. next 3 characters must be "jpg" > > 6. case doesn't matter > > > > Are you sure you have files that meet the above 6 rules in your > > directory? If you don't, then nothing will be displayed. Are you sure > > that your "/path/to/directory" is a real path to a real directory? etc > > etc > > > > > > > $file_lost .= " > > NAME=\"$file_names\">$file_names"; > > > } > > > } > > > $file_lost .= " > > VALUE=\"select\">"; > > > closedir($dir); > > > > > > > > > > > > Erik > > > > > > > > > > > > Erik Price > > Web Developer Temp > > Media Lab, H.H. Brown > > [EMAIL PROTECTED] > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] alphabetizing titles when first word begins with 'The','A',etc.
Hi. Im using MySQL and as part of my tables I have titles (of stories). My question os in regards to outputing those titles. Some of the titles begin with words such as 'The', 'A', 'An', etc. Is there a way to order these particular titles based on the second word in the title?? ~Steph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scoping functions in PHP
> "Eric" == Eric Starr <[EMAIL PROTECTED]> writes: Eric> I am a Java programmer learning PHP. In Java you can have a Eric> class that contains public and private functions. Only the Eric> public functions are accessible outside of the class. Does Eric> PHP have a way to hide functions within a class (i.e. make Eric> the private)? Well, one thing which you could do is to use the scout's honor protocol: define all of your private methods or protected methods according to some naming convention, say, beginning with 'p' followed by two underbars (p__) for private methods. Then, use an 'honor lock'; only call such functions from authorized locii such as own classes for private methods or derived classes for protected functions and so forth... -l -- Share your feedback at Affero: http://svcs.affero.net/rm.php?r=leed_25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] constructors in derived classes
On Thursday, April 11, 2002, at 02:17 PM, Andrey Hristov wrote: > In PHP the programmer has to call the constructor of the super class. > The derived class has to know the name of his "super"(java syntax). > In PHP5 the constructor will have unified name, there will not be a > need the derived class to know super class name. Andrey, Thank you for the detailed explanation. So to sum it up, you need to call the base class's constructor from within the extended class's constructor if you want the effect of both constructors happening at once, as the extended class is instantiated into an object. I've noticed that it -is- possible to call the base class's constructor from the script, like this: // classes are Base and Extended $instance($arg1) = new Extended; // directly access the base class's constructor $instance->Base($arg2); and it seems to work. But this is really just shortchanging yourself the value of having a constructor in Base, since you are calling it as a method and not using its "automaticness" feature. Thanks again, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string...
On Friday 12 April 2002 14:32, jas wrote: > Here is an example of the files in the directory... > willies_0411.jpg > watson_0411.jpg > willies_logo.jpg > watson_logo.jpg > etc.. > When I remove the eregi() it works fine, all the files are displayed, > however I only want the files ending in _.jpg to be displayed in the > select box and well I did another one using a sting to filter out all files > except _logo.jpg and it works fine, I just can't get the _.jpg files to > display. Also the directory is fine, I have the same function being called > in two places one to display only *_logo.jpg files and the second to > display only *_.jpg files the number one doesnt seem to work so I may > just create two directories for the two types I need, but I would rather > get this sting function down so I can use it elsewhere on our site. Any > help would be great... preg_match("/.*_\d{4}\.jpg$/i", $file_name); ?? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* People will buy anything that's one to a customer. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorial on proper code formating
Yeah I know from my code, which often is just bs project, that with nesting lotsa crap it's a lot easier to follow the Original Method of: for($i=0;$iOn Friday 12 April 2002 02:50, Kevin Stone wrote: > >> On the other hand the Inline Method is clean. You can see at a glance >> where each block begins ends. But it is not compact. It spreads the code >> out over many lines. I recommend this method for modern programmers coding >> on large screens. Besides that I think it's just a better way to code. >> More whitespace = less confusion = faster debugs. >> >> / INLINE METHOD */ >> foreach ($mylist as $key => $val) >> { >> if ($key == $list_num) >> { >> for ($i=0; $i> { >> record_list($key[$i]); >> } >> } >> elseif ($key == $skip_val) >> { >> continue; >> } >> else >> { >> echo "INVALID ENTRY: "$key ." at ". $val . "\n"; >> } >> } >> // > > >I prefer this style because I know exactly where my if statement ends, >especially if you have a humungous nested if-elseif-else construct. > > >foreach ($mylist as $key => $val) { > if ($key == $list_num) { >for ($i=0; $i record_list($key[$i]); >}} > elseif ($key == $skip_val) { >continue; } > else { >echo "INVALID ENTRY: "$key ." at ". $val . "\n"; > } >} > > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * > >/* >Weiler's Law: > Nothing is impossible for the man who doesn't have to do it himself. >*/ > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > See Dave Matthews Band live or win a signed guitar http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] country ip recognition and php
On Friday 12 April 2002 03:04, Nick Wilson wrote: > Hi all > What functions do I need to be looking at if I want to determine from > what country a visitor is from? > > Is this problematical, I look at my logs shows that not all visitors > form .dk have that at the end of the refferer string... Short answer: you can't. Longer answer: you can subscribe to an IP mapping service. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* As Zeus said to Narcissus, "Watch yourself." */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set Global Variables
On Friday 12 April 2002 02:52, [EMAIL PROTECTED] wrote: > If I do that, won't the data that I fetch be duplicated in memory for each > user? I'm trying to have just one space in memory allocated for these > variables, sort of like the HTTP_SERVER_VARS. It seems that even if I do > an autoprepend that file is going to run each time a user visits the site > and a new memory space will be created for that variable. What I'm asking > is how to set those constant server-wide global variables. I don't think that's possible. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It has just been discovered that research causes cancer in rats. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorial on proper code formating
On Thursday, April 11, 2002, at 02:13 PM, Analysis & Solutions wrote: > Uch! Uch! Uch! I don't like their nesting ideas: >if (condition) // Comment >{ >} >else // Comment >{ >} Neither do I -- that doesn't look too easy to read, to me. > This is the standard I learned and find easier to read: >if (condition) { > # Comment >} else { > # Comment >} Say, that looks like my code! > > In essence, you'll find that tastes vary. > Exactly. I haven't actually read their style guide, I just saw it mentioned somewhere recently and it's the only PHP style guide I've ever heard of, so I figured I'd pass it on. The truth is that tastes vary, and unless everyone starts using Python (whose syntax I really like, though it was hard to get used to seeing "naked" variable names [no buck]), there will always be differences. To the original poster: One thing I've found, and have found is harder to achieve than it seems, is that the most important thing is to be consistent with your own style. But as I've learned more and more about programming over the past few months, my style has definitely changed -- even within this same project! I try to keep it consistent but I learn all kinds of new code-organizing techniques (like OOP), so it's not that easy. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorial on proper code formating
On Friday 12 April 2002 02:50, Kevin Stone wrote: > On the other hand the Inline Method is clean. You can see at a glance > where each block begins ends. But it is not compact. It spreads the code > out over many lines. I recommend this method for modern programmers coding > on large screens. Besides that I think it's just a better way to code. > More whitespace = less confusion = faster debugs. > > / INLINE METHOD */ > foreach ($mylist as $key => $val) > { > if ($key == $list_num) > { > for ($i=0; $i { > record_list($key[$i]); > } > } > elseif ($key == $skip_val) > { > continue; > } > else > { > echo "INVALID ENTRY: "$key ." at ". $val . "\n"; > } > } > // I prefer this style because I know exactly where my if statement ends, especially if you have a humungous nested if-elseif-else construct. foreach ($mylist as $key => $val) { if ($key == $list_num) { for ($i=0; $i Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Weiler's Law: Nothing is impossible for the man who doesn't have to do it himself. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] country ip recognition and php
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all What functions do I need to be looking at if I want to determine from what country a visitor is from? Is this problematical, I look at my logs shows that not all visitors form .dk have that at the end of the refferer string... Many thanks :-) - -- - --- www.explodingnet.com |Projects, Forums and +Articles for website owners - -- Nick Wilson -- |and designers. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8td4zHpvrrTa6L5oRAoVsAJ4uIgF6om76MwR4kuQa+DNLEwCfXgxl iaacgK8+oKXn4WLIQx5OAJY= =OgGc -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache 2.0.35 and php4.1
Ensure you're building PHP with the --apxs2=/path configure option. If you don't do that, it will not work in httpd2.0 If you DID do that, what glibc and gcc version is you're build environment using? On Thu, 2002-04-11 at 07:27, Markus Meixner wrote: > Hi, > > i installed the new Apache 2.0.35. > > When i want to load the php4 module apache doesn't starts. > > On Apache 1.3.22 it works fine. > > I find something on php.bugs.net. > > << If you use it with apache 2, you need a special SAPI module. Ask for > support on the [EMAIL PROTECTED] mailinglist >>> > > What should i do to use php in new Apache. > > thanx > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Austin Gonyou Systems Architect, CCNA Coremetrics, Inc. Phone: 512-698-7250 email: [EMAIL PROTECTED] "It is the part of a good shepherd to shear his flock, not to skin it." Latin Proverb signature.asc Description: This is a digitally signed message part
Re: [PHP] Tutorial on proper code formating
My vote goes to the inline method which I am the only one to use where I work :( But it is far cleaner even if it is less compact. Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Set Global Variables
If I do that, won't the data that I fetch be duplicated in memory for each user? I'm trying to have just one space in memory allocated for these variables, sort of like the HTTP_SERVER_VARS. It seems that even if I do an autoprepend that file is going to run each time a user visits the site and a new memory space will be created for that variable. What I'm asking is how to set those constant server-wide global variables. Thanks Roger -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 10:15 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Set Global Variables Set up an auto_prepend file that either simply sets these constant globals ot fetches them from the DB. -Rasmus On Thu, 11 Apr 2002 [EMAIL PROTECTED] wrote: > Is there a way to set a global variable that all users can access? I have > some values in a database that I'm reading at the beginning of the session > and carrying through out the session. The thing is, those values are the > same for every user and instead of having a memory space for each users > values I'd rather just use one memory space for all users. > > Thanks > > Roger Ramirez > Web Developer > LifeFiles.com Inc. > > > -- > 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] Tutorial on proper code formating
I disagree. The Inline Method may be less compact than the Traditional Method but it is much easier to read. The following are two identical code sniplets. One is formated with the Traditional Method and the other with the Inline Method. You make the decision which one you want to use. In my opinion the Traditional Method is a mess.. You can't tell where each block ends without thuroughly studying the code. But it is compact. I can see why this method would have been adopted by early programmers with large text on small screens. Question is would you need to be compact these days when you have 10 point type on a 1280x1024 (or larger) screen? /** TRADITIONAL METHOD **/ foreach ($mylist as $key => $val){ if ($key == $list_num){ for ($i=0; $i $val) { if ($key == $list_num) { for ($i=0; $i To: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 12:13 PM Subject: Re: [PHP] Tutorial on proper code formating > On Thu, Apr 11, 2002 at 01:33:40PM -0400, Erik Price wrote: > > > > http://utvikler.start.no/code/php_coding_standard.html > > Uch! Uch! Uch! I don't like their nesting ideas: >if (condition) // Comment >{ >} >else // Comment >{ >} > > This is the standard I learned and find easier to read: >if (condition) { > # Comment >} else { > # Comment >} > > http://www.perldoc.com/perl5.6/pod/perlstyle.html has some ideas too. > But it also calls for "uncuddled elses." > > Here's a link to another style guide > http://slashcode.com/docs/slashstyle. > > In essence, you'll find that tastes vary. > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > -- > 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] flush() doesn't seem to work for Windows PHP shell script
Hi. I have a PHP shell script running on Windows that I would like to display status on where it's at in the code because it takes a long time to finish. Using flush() doesn't seem to work as all the status messages still don't output to screen until the script finishes running even though I'm doing flush() right after echo. Is there another way to get status messages while the script is running? Thanks. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] constructors in derived classes
In PHP the programmer has to call the constructor of the super class. The derived class has to know the name of his "super"(java syntax). In PHP5 the constructor will have unified name, there will not be a need the derived class to know super class name. So base_var = $init;} } class Extended extends Base{ var $ext_var; function Extended($init){ $this->Base($init.$init); print "\n".$init." in Extended"; $this->ext_var =$init; } } $a = new Extended("FUBAR"); print "\n"; var_dump($a); ?> FUBAR in BASE FUBAR in Extended object(extended)(2) { ["base_var"]=> string(5) "FUBARFUBAR" ["ext_var"]=> string(5) "FUBAR" } base_var = $init;} } class Extended extends Base{ var $ext_var; function Extended($init){ //$this->Base($init.$init); print "\n".$init." in Extended"; $this->ext_var =$init; } } $a = new Extended("FUBAR"); print "\n"; var_dump($a); ?> FUBAR in Extended object(extended)(2) { ["base_var"]=> string(5) "empty" ["ext_var"]=> string(5) "FUBAR" } - Original Message - From: "Erik Price" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 9:04 PM Subject: [PHP] constructors in derived classes > I have another question about OO in PHP -- > > The manual (http://www.php.net/manual/en/language.oop.constructor.php) > does an excellent job of explaining how constructors in extended classes > work when there are constructors in base classes. I understand that no > problem. But at the bottom of the page is a cautionary note: > > > Neither PHP 3 nor PHP 4 call constructors of the base class > automatically from a constructor of a derived class. It is your > responsibility to propagate the call to constructors upstream where > appropriate. > > > This is where I am uncertain -- how do I call an upstream constructor > from an instance of an extended class, where I have a constructor in the > extended class? IOW: > > class ClassA > { > function ClassA($var) > { > print "ClassA object instantiated, argument is $var"; > } > } > > class ClassB > { > function ClassB($var) > { > print "ClassB object instantiated, argument is $var"; > } > } > > $instance = new ClassB(frank); > > // this should print "ClassB object instantiated, argument is frank" > > My question is, how do I call the constructor of ClassA? To see the > following results: > > // "ClassB object instantiated, argument is frank" > // "ClassA object instantiated, argument is bob" > > > > > Erik > > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > > -- > 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] Tutorial on proper code formating
On Thu, Apr 11, 2002 at 01:33:40PM -0400, Erik Price wrote: > > http://utvikler.start.no/code/php_coding_standard.html Uch! Uch! Uch! I don't like their nesting ideas: if (condition) // Comment { } else // Comment { } This is the standard I learned and find easier to read: if (condition) { # Comment } else { # Comment } http://www.perldoc.com/perl5.6/pod/perlstyle.html has some ideas too. But it also calls for "uncuddled elses." Here's a link to another style guide http://slashcode.com/docs/slashstyle. In essence, you'll find that tastes vary. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string...
On Friday, April 12, 2002, at 01:50 AM, jas wrote: > Ok, I have tried all 3 examples and even tried a few variations that you > have given me and so far nothing is getting displayed, is there a way to > check for errors? here is the code I am working with: What happens if you get rid of that eregi() function? Does it show you all of your files? If so, then the problem is the regex in your eregi(). > // second selection for main image on main page > $dir_name = "/path/to/images/directory/"; > $dir = opendir($dir_name); > $file_lost .= " NAME=\"images\"> > "; > while ($file_names = readdir($dir)) { > if ($file_names != "." && $file_names !=".." && > eregi("^/*_[0-9]{4}\.jpg$", $file_name)) { ^^ This regex will match only files that obey the following rules: 1. may or may not start with a slash 2. next character must be an underscore 3. next 4 characters must be digits 4. next character must be a dot 5. next 3 characters must be "jpg" 6. case doesn't matter Are you sure you have files that meet the above 6 rules in your directory? If you don't, then nothing will be displayed. Are you sure that your "/path/to/directory" is a real path to a real directory? etc etc > $file_lost .= " NAME=\"$file_names\">$file_names"; > } > } > $file_lost .= " VALUE=\"select\">"; > closedir($dir); > > Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pages compressed with zlib
It will only send compressed pages to browsers that support it so that's not a problem. Pro's are that pages load much faster. especially if your HTML output is big, images are already compressed so they stay the same. cons are minor, since the page is gzipped when loading on a browser it doesn't "cascade" onto your screen, it appears all at once when the transfer is complete, so the total load time is faster, but it's a little longer before the user see's anything. I'd also guess that gzipping every page will make the processor work harder. but I've never had a problem with that. test it out, we noticed big differences on modems to our site. On Thu, 2002-04-11 at 13:57, Levy Alves Carneiro Jr. wrote: > > Hello, > > inside php.ini file there's a special configuration: > > ; Transparent output compression using the zlib library > ; Valid values for this option are 'off', 'on', or a specific > ; buffer size to be used for compression (default is 4KB) > zlib.output_compression = On > > this way pages will be parsed, compressed, and then sent to the > browser. Does anybody know of pros & cons of using this > configuration? Which browsers support zlib compression? > > Thanks, > Levy > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php