Re: [PHP] Error(Newbie)
I got that auto add slashes thing on. is it enough? If not how should I go about adding them? like this? $_SERVER['REMOTE_HOST'] = addslashes($_SERVER['REMOTE_HOST']); What sort of effects could an attack have? I am intergrating stats into a site. What other vars could I gather info from? Thanks, JJ Harrison [EMAIL PROTECTED] www.tececo.com BTW I have fixed the error now. - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, June 23, 2002 2:11 PM Subject: Re: [PHP] Error(Newbie) $query = INSERT INTO `stats` (`vid`, `id`, `vn`, `time`, `host`, `referrer`, `browser`) VALUES ('', '$id', '$_COOKIE ['tececo_stats']', '$time', '$_SERVER['REMOTE_HOST']', '$_SERVER['HTTP_REFERER']', '$_SERVER ['HTTP_USER_AGENT']'); ; I hope you are using addslashes on your $_COOKIE and $_SERVER vars, too, otherwise your query is wide open to some attacks... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] netscape 4.x problem
Hi, I'm having trouble getting a script working right in netscape 4.x and was wondering if anybody knew a workaround, or fix. If I have a script called sendheader.php with the following: ? if (! isset($GLOBALS[sendheader])) { header(Location: http://blah.com/sendheader.php;); exit; } echo blah; ? Load the script in netscape 4.x with http://blah.com/sendheader.php?sendheader=0. Then load the script like http://blah.com/sendheader.php and netscape returns Document contains no data. It seems to break netscape 4.x if the Location header == current script name. Does anyone know how to get around this? Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: emailing html file
you can do this with the regular mailfunction. Take a look at http://www.php.net/mail Andy -- http://www.globosapiens.net Global Travellers Network! M.E. Suliman [EMAIL PROTECTED] schrieb im Newsbeitrag 000b01c219b8$afb448e0$13b81fc4@b1s0n2">news:000b01c219b8$afb448e0$13b81fc4@b1s0n2... Hi I've created a form and a bit of code that processes the form and directs to a confirmation page asking the user to confirm if the details they entered are correct. Once they hit the confirm button how would I send that confirmation page as an html file attached to their email. I know its got something to do with MIME email but not too sure. Thanks in advance Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error(Newbie)
Yeah, magic_quotes will be enough, but it only handles GET, POST, and COOKIE data. I'm not sure what SERVER variables can be trusted, so it wouldn't hurt to addslash them... There isn't much of a risk to your query, but someone could still mess things up. If they formatted a cookie like $_COOKIE['tececo_stats'] = bad_data','bad_time','bad_host','bad_referrer','bad_agent')#; it would allow them to insert bad data into your table... ---John Holmes... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 23, 2002 2:50 AM Subject: Re: [PHP] Error(Newbie) I got that auto add slashes thing on. is it enough? If not how should I go about adding them? like this? $_SERVER['REMOTE_HOST'] = addslashes($_SERVER['REMOTE_HOST']); What sort of effects could an attack have? I am intergrating stats into a site. What other vars could I gather info from? Thanks, JJ Harrison [EMAIL PROTECTED] www.tececo.com BTW I have fixed the error now. - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, June 23, 2002 2:11 PM Subject: Re: [PHP] Error(Newbie) $query = INSERT INTO `stats` (`vid`, `id`, `vn`, `time`, `host`, `referrer`, `browser`) VALUES ('', '$id', '$_COOKIE ['tececo_stats']', '$time', '$_SERVER['REMOTE_HOST']', '$_SERVER['HTTP_REFERER']', '$_SERVER ['HTTP_USER_AGENT']'); ; I hope you are using addslashes on your $_COOKIE and $_SERVER vars, too, otherwise your query is wide open to some attacks... ---John Holmes... -- 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] PHP 4.2
I've written a small freeware script that gets installed on a variety of different platforms running various PHP versions. I've read through the manual about the super global arrays and how post and get vars are no longer registered by default, but am confused about when it would be a good idea to upgrade the script. If I change everything in the script and use $_GET and $_POST etc. then those people who are still using earlier versions won't be able to upgrade. Does anyone know what the uptake of the latest version is? What is everyone else doing about this? If I were developing for one client it wouldn't be a problem as obviously you'd know what you were developing for. I'd just like some feedback on when would be a good time to upgrade the scripts while causing the minimum disruption and maintaining maximum happy users. Thanks Zim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 23 Jun 2002 11:45:02 -0000 Issue 1422
php-general Digest 23 Jun 2002 11:45:02 - Issue 1422 Topics (messages 103432 through 103452): Re: Very slow pg access 103432 by: Frank 103436 by: Uros Gruber Re: cookies 103433 by: Chris Shiflett 103434 by: Paul O'Neil PHP 4.2.1 reading PAM/Shadowed passwords? 103435 by: Matthew Nock Error(Newbie) 103437 by: webmaster.tececo.com 103438 by: 1LT John W. Holmes 103441 by: 1LT John W. Holmes 103443 by: Leif K-Brooks 103448 by: webmaster.tececo.com 103451 by: 1LT John W. Holmes getaddrinfo failed 103439 by: Pag 103440 by: 1LT John W. Holmes Re: UPDATE mysql 103442 by: 1LT John W. Holmes Re: Get difference between strings. 103444 by: Jason Wong Re: PLEASE HELP-Unable to get off this list 103445 by: Jason Wong Re: Nested Menu Help 103446 by: Jason Wong Re: is there a function like javascript's window.open in PHP 103447 by: Jason Wong netscape 4.x problem 103449 by: Thomas E. Ruth Re: emailing html file 103450 by: Andy PHP 4.2 103452 by: Simon Troup Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I find it impossible that PHP should be slow. PHP's Pg functions are - and shouldn't be - nothing more or else than a frontend to the Pg API. The problem is most likely that you are not comparing the same values. I think the analyze values are calculated internal values that has little to do with real life through an API. Postgres is very fast - but a connect and 3 queries in 0.002 ms? Hmmm! The 0.1 s looks more like a real value to me. Best Frank At 00:51 22/6/2002 +0200, you wrote: Hi! i made some benchmarks because my script is somehow very slow. In this script i execute 3 queries to PostgreSQL server and one connect string. I connect to socket. I check this queries in pg with explain analyze and i have result 1.18ms so i add a little and let say that for those 3 queries need 2ms. (1 simple select, 1 delete, 1 insert) When i check from PHP i use microtime() to check times. Here is results 0.0443 for connect 0.0343 1 querydelete 0.0034 2 queryselect 0.0049 3 queryTHIS ONE is INSERT OR UPDATE 0.087 TOTAL so complete time is about 0.090 s this is 90ms against 2ms. I thik that this is not normal. or is PHP so slow or there is something wrong with libraries I use PHP 4.1.2 and pg 7.2.1 Any thoughts. -- tia, Uros mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Hi! Sunday, June 23, 2002, 1:21:07 AM, you wrote: F I find it impossible that PHP should be slow. PHP's Pg functions are - F and shouldn't be - nothing more or else than a frontend to the Pg API. F The problem is most likely that you are not comparing the same values. I F think the analyze values are calculated internal values that has little F to do with real life through an API. F Postgres is very fast - but a connect and 3 queries in 0.002 ms? Hmmm! i didn't say 0.002 ms i say 0.002 s this is 2ms, but from php that time was 90ms I also use one patch for realtimer in pg, it say max 10ms. without connect, but i don't thik that for connection is user like 80ms, I thik that here must be something wrong, or with some lib, I realy don't know, so i'm asking on that list for help to solve this. Btw computer is PII300MHz with 128MB RAM, but in this table is for now from 0 to 15 entries. -- lp, Urosmailto:[EMAIL PROTECTED] ---End Message--- ---BeginMessage--- This is sometimes a confusing issue for people, but remember that cookies work like this: 1) client requests a resource from a Web server 2) Web server returns a response to the client including a request to set cookies (Set-Cookie header) 3) client requests another page from the Web server and includes the cookies (Cookie header) in the request Some people want to know how they can tell whether the client accepts cookies after step 1 (during the processing that results in step 2). This is simply impossible. However, you can adequately tell whether someone has cookies enabled after you receive a second HTTP request from that person. On this second page, simply test to see whether the cookie that you previously set exists (isset is a good function for this). If it doesn't exist, the client does not accept cookies. Some developers want this check to appear as if it were performed on a single transaction and force the client to make the second request. Chris Paul O'Neil wrote: If a browser has cookies blocked , anyone have code if unable to set cookie
[PHP] Insert an array into MySQL
Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP 4.2
You can use the HTTP_*_VARS for now, but they are depreciated. They will work right now on most any version of PHP. I would just maintain two different versions, one for PHP 4.2+ and one for earlier versions. Sure, it's a little more of a pain...though... ---John Holmes... -Original Message- From: Simon Troup [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:46 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP 4.2 I've written a small freeware script that gets installed on a variety of different platforms running various PHP versions. I've read through the manual about the super global arrays and how post and get vars are no longer registered by default, but am confused about when it would be a good idea to upgrade the script. If I change everything in the script and use $_GET and $_POST etc. then those people who are still using earlier versions won't be able to upgrade. Does anyone know what the uptake of the latest version is? What is everyone else doing about this? If I were developing for one client it wouldn't be a problem as obviously you'd know what you were developing for. I'd just like some feedback on when would be a good time to upgrade the scripts while causing the minimum disruption and maintaining maximum happy users. Thanks Zim -- 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] Insert an array into MySQL
Your second method should work, but it's dependent on what your form looks like and how your table was created. You obviously have a key set for this column and you're trying to insert the same value twice, which makes an error. Show us what your form looks like, not the whole thing, just for the checkboxes. Also, what does your CREATE TABLE look like for the table your trying to insert this data into? ---John Holmes... -Original Message- From: Rob Packer [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Insert an array into MySQL Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.2
At 6/23/2002, you wrote: I've written a small freeware script that gets installed on a variety of different platforms running various PHP versions. I've read through the manual about the super global arrays and how post and get vars are no longer registered by default, but am confused about when it would be a good idea to upgrade the script. If I change everything in the script and use $_GET and $_POST etc. then those people who are still using earlier versions won't be able to upgrade. Does anyone know what the uptake of the latest version is? What is everyone else doing about this? If I were developing for one client it wouldn't be a problem as obviously you'd know what you were developing for. I'd just like some feedback on when would be a good time to upgrade the scripts while causing the minimum disruption and maintaining maximum happy users. Hi, I have used if (isset($_SERVER)) $PHP_SELF = $_SERVER['PHP_SELF']; to make $PHP_SELF work on all PHP's. Then you have to use $HTTP_GET_VARS and $HTTP_POST_VARS to pass vars. This way the script will work with globals on and off. I really hate the way PHP 4.2 introduced the new default installation with globals off, as they knew it will instantly force almost all coders to update their code. It took two weeks to make those changes on my rather large application. Most virtual server users have no means to set PHP.INI to their liking so changes like that should be done in longer time span to let developers update the software _before_ changes in PHP happen. Pekka http://photography-on-the.net/ - Pekka Saarinen http://photography-on-the.net - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.2
on 23/06/02 11:06 PM, Pekka Saarinen ([EMAIL PROTECTED]) wrote: Most virtual server users have no means to set PHP.INI to their liking so changes like that should be done in longer time span to let developers update the software _before_ changes in PHP happen. The changes and recommendations to make changes to your code were made in the release notes of 4.1.0 I think, which was AGES ago. My best guess is mid-February 2002, but it may have been earlier. http://www.php.net/release_4_1_0.php If you do a clean install, yes, register globals will default to OFF, but for an upgrade install of 4.2.x, it *should* pick up your old php.ini setting of ON. It took me a week or so to update my code as well, but I look at it as a good move... my code is now more secure for starters. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert an array into MySQL
John Holmes [EMAIL PROTECTED] wrote in message 001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango... Your second method should work, but it's dependent on what your form looks like and how your table was created. You obviously have a key set for this column and you're trying to insert the same value twice, which makes an error. Show us what your form looks like, not the whole thing, just for the checkboxes. Also, what does your CREATE TABLE look like for the table your trying to insert this data into? ---John Holmes... -Original Message- From: Rob Packer [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Insert an array into MySQL Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert -- 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] Insert an array into MySQL
oops, sorry about the other post (I've got a baby that likes the keyboard)... Hi, This is the form, which I had doubts about, but it seemed to put things into the array correctly when I tested it by printing it out. I can't see how, it will print key=0 value=index.html key=1 value=about.html key=2 value=whats_new.html when I test it and then have a duplicate key. It's saying that I have 2 $pagetype[0] correct? Anyhow, here's the form... INPUT TYPE=hidden NAME=pagetype[] VALUE='index.html'Home Page br INPUT TYPE=checkbox NAME=pagetype[] VALUE='about.html'About Page br INPUT TYPE=checkbox NAME=pagetype[] VALUE='whats_new.html'What's New Pagebr INPUT TYPE=checkbox NAME=pagetype[] VALUE='contact.html'Contact Pagebr INPUT TYPE=checkbox NAME=pagetype[] VALUE='favorite_links.html'Favorite Links br The CREATE TABLE is this: I define the table name from user input. $query_links=CREATE TABLE $username_links (id INT(4) not null, links VARCHAR(20) not null, UNIQUE (id)); if(mysql_query($query_links,$connection)){ echo Links table created!br; }else{ echo no links table madeBR; } thanks, Rob John Holmes [EMAIL PROTECTED] wrote in message 001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango... Your second method should work, but it's dependent on what your form looks like and how your table was created. You obviously have a key set for this column and you're trying to insert the same value twice, which makes an error. Show us what your form looks like, not the whole thing, just for the checkboxes. Also, what does your CREATE TABLE look like for the table your trying to insert this data into? ---John Holmes... -Original Message- From: Rob Packer [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Insert an array into MySQL Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert -- 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] Profiling
Hello all, Does PHP have any built in functions to do simple profiling on a page? Or should I just use $time1=time(); do_stuff(); $time2=time(); echo $time2-$time1;? Thanks, Jim Drabb -- - Never ask a geek why, just nod your head and slowly back away - James Drabb JR Programmer Analyst [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Profiling
Yes, that's what I use, except I use microtime(); Justin French on 23/06/02 11:49 PM, James Drabb ([EMAIL PROTECTED]) wrote: Hello all, Does PHP have any built in functions to do simple profiling on a page? Or should I just use $time1=time(); do_stuff(); $time2=time(); echo $time2-$time1;? Thanks, Jim Drabb -- - Never ask a geek why, just nod your head and slowly back away - James Drabb JR Programmer Analyst [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getaddrinfo failed
So what's on /usr/home/pagon/www/index.php on line 497 at a few lines before it? on line 497 theres the line: $linha=file('downs.txt'); then the rest of the script as below. Before this line theres simple, very simple, html. I dont understand the error. Pag ? $linha=file('downs.txt'); $t=count($linha); $l = $t - 1; $fim = $l - 3; if ($l 3) { $fim=$l - 3; } else { $fim = 0; } for ($i = $l; $i = $fim ; $i--) { $array=explode(|,$linha[$i]); print(div align=\left\); print(span class=\data\$array[0]/span); print(br$array[1]br); print(/divimg src=\spacer.gif\ height=\3\); } ? But from time to time, and with absolutely no visible reason, i get this error: Warning: php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /usr/home/pagon/www/index.php on line 497 Warning: file(downs.txt) - Bad file descriptor in /usr/home/pagon/www/index.php on line 497 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whos online at the moment in PHP
Is it possible to code in PHP a small indicator on a site saying how many people are viewing that page at the moment? Sorry if its a silly question, but i am a newbie at PHP. If it is, could you point me in the good direction? i mean, some function or something. Thanks. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output_buffering
I was running some speed tests on a page that returns 1000 records from a db and spits them into a table. I have output_buffering Off in my php.ini file because of the statement below: ; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (ex., output_buffering=4096). output_buffering = Off However the page takes 7 seconds to load with output_buffering = Off and 1 second with output_buffering = On! What is up with that? Have most of you found output buffering faster? Jim Drabb -- - Never ask a geek why, just nod your head and slowly back away - James Drabb JR Programmer Analyst [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with Apache2/PHP4.2.1
I have upgraded from Apache 1.3.26 to 2.0.39 with PHP 4.2.1. I am running FreeBSD 4.6 and everything was installed from ports. I have a PHP script called go (filename is without the .php extension) and it is located in the root of my domain name: http://www.mydomain.com/go It's a script that my users launch with special arguments much like this: http://www.mydomain.com/go/arg1/arg2/arg3 To get this to work, I've changed AllowOverride to All in apache2's httpd.conf and I've added this to mydomain.com .htaccess: FilesMatch go$ ForceType application/x-httpd-php /FilesMatch This same approach has worked perfectly for me in apache 1.3.26, and it correctly launched script go when someone opened URL such as http://www.mydomain.com/go/something/somewhere Unfortunately, with Apache 2.0.39 only http://www.mydomain.com/go works okay, but http://www.mydomain.com/go/bla/bla results in a 404 error. (it looks as if Apache treats 'go' as directory, not as a script - despite the settings in .htaccess - and therefore it can't find the location) I want http://www.mydomain.com/go/bla/bla to launch the go script, just as it did with Apache 1.3.26. I have even tried using the old 1.3.26 httpd.conf with Apache 2.0.39 (after making the minor changes to make it compatible with apache2), but it still won't work - same problem :(( The only other config lines that IMHO could be possibly related with this issue are: RewriteEngine On RewriteCond %{HTTP:Host} ^mydomain.com RewriteRule ^(.*)$ http://www.mydomain.com$1 [L,R] Am I missing something here? Thanks! = Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whos online at the moment in PHP
Well, traditionally this would be done with sessions, and it's not exactly the easiest topic for a newbie to get their head around. It also never going to be a science -- how do you know when a user closes their browser window or click onto another page? You need to have clean-out routines for logged in users who haven't had any activity for a while and all sorts of other goodies. Traditionally, most sites achieve things like 45 users and 12 guests online kinda thing using sessions, but I don't know if I've seen 45 users looking this page right now anywhere. Hrm... a VERY NON SCIENTIFIC approach on a page-by-page basis would be to log each hit on the page, and the time() that the hit was... boldly assume that people will look at your page for 30 seconds or something, and keep a counter of all hits within the last 30 seconds. Like I said, not very geek at all, not in any way scientific, but it's a quick fake. Essentially, it's more of a counter saying 48 hits in the last 30 seconds than 48 people looking at this page right now. If you want to achieve this properly though, it's going to take you a few hours to get your head around sessions, which can only be a good learning experience any way. Justin French on 23/06/02 11:53 PM, Pag ([EMAIL PROTECTED]) wrote: Is it possible to code in PHP a small indicator on a site saying how many people are viewing that page at the moment? Sorry if its a silly question, but i am a newbie at PHP. If it is, could you point me in the good direction? i mean, some function or something. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error(Newbie)
The only data returned by a browser in a Cookie header is the name/value pairs. So, your example would not pose a threat of any sort. The Referer and User-Agent are separate headers, but like all data from the client, they should also not be trusted. If you have magic quotes enabled, you're probably safe. It is actually best not to just addslashes() again to be sure for any data. Rather, echo the value of your data to the screen during development, and test to be sure that your single quotes are escaped like you think they should be. Chris 1LT John W. Holmes wrote: Yeah, magic_quotes will be enough, but it only handles GET, POST, and COOKIE data. I'm not sure what SERVER variables can be trusted, so it wouldn't hurt to addslash them... There isn't much of a risk to your query, but someone could still mess things up. If they formatted a cookie like $_COOKIE['tececo_stats'] = bad_data','bad_time','bad_host','bad_referrer','bad_agent')#; it would allow them to insert bad data into your table... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] output_buffering
What exactly are you measuring and how? -Original Message- From: James Drabb [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 9:09 AM To: php-general Subject: [PHP] output_buffering I was running some speed tests on a page that returns 1000 records from a db and spits them into a table. I have output_buffering Off in my php.ini file because of the statement below: ; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (ex., output_buffering=4096). output_buffering = Off However the page takes 7 seconds to load with output_buffering = Off and 1 second with output_buffering = On! What is up with that? Have most of you found output buffering faster? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested Menu Help
From: [EMAIL PROTECTED] When I am in page A (or one of it's children) I wish to show it's one level of children like so: Page A Child 1 Child 2 etc... Page B When I am in page B (or one of it's children) I wish to show it's one level of children like so: Page A Page B Child 1 Child 2 etc... Do you get the picture? I have a db with link url, id, parent id and title does any one know of a simple function or something to do this for one level? I wrote the code below for a menu system like this on a recent project: -- // declare class (s)elect (l)ist class sl { var $query; var $result; var $row; function set_query($new_value) { $this-query = $new_value; } } // create object (c)ategory (s)elect (l)ist $csl = new sl(); // create object (s)ubcategory (s)elect (l)ist $ssl = new sl(); // set query for object csl to display main categories $csl-set_query(SELECT ID, Name FROM Categories WHERE ParentID=0); $csl-result = mysql_query($csl-query); // display the menu while ($csl-row = mysql_fetch_array($csl-result)) { $ParentCatID=$csl-row[ID]; if ($csl-row[ID] == $MainCatID) { echo(p class=\menuselected\ . a href=$PHP_SELF?MainCatID=$ParentCatID . $csl-row[Name] . /a/p\n); // set query for object (s)ubcategory (s)elect (l)ist $ssl-set_query(SELECT ID, Name, ParentID FROM Categories . WHERE ParentID=$MainCatID); $ssl-result = mysql_query($ssl-query); // display subcategories (submenu) while ($ssl-row = mysql_fetch_array($ssl-result)) { $ParentCatID = $ssl-row[ParentID]; $ChildCatID = $ssl-row[ID]; if ($ssl-row[ID] == $SubCatID) { echo(p class=\submenuselected\ . a href=$PHP_SELF?MainCatID= . $ParentCatIDSubCatID=$ChildCatID . $ssl-row[Name] . /a/p\n); } else { echo(p class=\submenu\ . a href=$PHP_SELF?MainCatID= . $ParentCatIDSubCatID=$ChildCatID . $ssl-row[Name] . /a/p\n); } } } // finish main category display else { echo(p class=\menu\ . a href=$PHP_SELF?MainCatID=$ParentCatID . $csl-row[Name] . /a/p\n); } } -- Main menu categories have a ParentID assignment of 0 in the db. A select is done of all ID Name in the Categories table where ParentID=0. The menu is displayed with names linked to recalling the script and passing the variable $MainCatID -- the ID of the category. When the script is called with $MainCatID set (when a main menu category is selected), the menu name with ID matching $MainCatID is assigned a style class to distinguish visually that it's selected. Also at this point another selection is done from Categories where ParentID=$MainCatID, thus creating the list of subcategories for the selected main category. The subcategories are also displayed with links back to the script passing the variable $MainCatID again plus the variable $SubCatID. When the script is called with $SubCatID set, the submenu name with ID equal to $SubCatID is also class-styled to indicate the selection. The main page display (in this case for a products catalog) is generated by other selection queries based on $MainCatID and $SubCatID. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] netscape 4.x problem
When you see document contains no data like that, the most likely cause is an endless loop. So, for whatever, reason, it seems that your conditional statement is returning true every time. Remove the Location header for now, and replace that line with: echo h1Redirecting to http://blah.com/sendheader.php/h1; exit; This will allow you to see whether you are returning that Location header to the client under the different cases. My guess is that you will see this on the screen even when you don't expect to. That should give you a starting point for debugging. Chris Thomas E. Ruth wrote: Hi, I'm having trouble getting a script working right in netscape 4.x and was wondering if anybody knew a workaround, or fix. If I have a script called sendheader.php with the following: ? if (! isset($GLOBALS[sendheader])) { header(Location: http://blah.com/sendheader.php;); exit; } echo blah; ? Load the script in netscape 4.x with http://blah.com/sendheader.php?sendheader=0. Then load the script like http://blah.com/sendheader.php and netscape returns Document contains no data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whos online at the moment in PHP
Most questions like this depend more on your ability to think creatively than your experience with PHP, so don't let inexperience discourage you from exploring on your own. First, decide what you consider to be online exactly. If I, for example, requested a page 30 seconds ago, you would probably consider me to be online, even though I could theoretically have closed my browser and gone to dinner since then. If you're familiar with using a database, consider using the PHPSESSID (look into PHP sessions for more information on this) as a primary key in a table where the timestamp is kept and updated on each page request. To determine who is online, you could simply run a query on this table using your threshhold of idle time that you've determined to count as online. There are plenty of different ways to approach this, and my early-morning example is probably not the best. Hopefully it gives you an idea though of what you need to accomplish. Chris Pag wrote: Is it possible to code in PHP a small indicator on a site saying how many people are viewing that page at the moment? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remote cgi script function
Hi, I am new to php, I would like to create a function that when called sends text from a text box as a query to a remote cgi script ,e.g http://www.anydomain.com/cgi-bin/script.cgi, and return the results as a variable so that i can echo the returned variable to an html page. I would appreciate any help on this Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is there a way to track downloads
Hey all, I would like to place some files on my site and use PHP to track how many users have downloaded those files. Is this possible? Is the PHP code only placed on this one page? I don't know PHP all that well, but my host supports it, and I want to track downloads, also to be able ot have them shown on the page (if possible) Thanks for any help, Kevin J -- http://www.wishpocket.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a way to track downloads
On Sun, 23 Jun 2002, Kevin J wrote: Hey all, I would like to place some files on my site and use PHP to track how many users have downloaded those files. Is this possible? Approach the problem logically: 1) You have a series of files that you want people to download. 2) You want to track which files are downloaded. 3) You don't want people accessing the files directly. So, a file called download.php. Accepts a parameter - the file name to make available. Logs an entry of IP and file (and whatever else) to a file / database / whatever. Makes the file available to the user - but the path is hidden / created on the fly so that a particular file cannot be pulled without going through the script. The actual code is left as an excercise for the reader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a way to track downloads
Hello, My fault, I didn't state that i was a complete Newbie to PHP. I am looking at scripts and realize that I need to use a database for this, etc... so I am just gonna forget the whole thing. Thanks anyways Kevin J Duncan Hill [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sun, 23 Jun 2002, Kevin J wrote: Hey all, I would like to place some files on my site and use PHP to track how many users have downloaded those files. Is this possible? Approach the problem logically: 1) You have a series of files that you want people to download. 2) You want to track which files are downloaded. 3) You don't want people accessing the files directly. So, a file called download.php. Accepts a parameter - the file name to make available. Logs an entry of IP and file (and whatever else) to a file / database / whatever. Makes the file available to the user - but the path is hidden / created on the fly so that a particular file cannot be pulled without going through the script. The actual code is left as an excercise for the reader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] is there a way to track downloads
KJ I am looking at scripts and realize that I need to use a database for this, KJ etc... so I am just gonna forget the whole thing. Unfortunate, that giving up so easily! You can also do exactly the same type of tracking in a plain text file, if you do not have access to a db. Substitute opening a file and writing a line, for inserting a record into a db. Plenty of examples in the manual. (ok, at least 1) - Julie -- Julie Meloni -- [EMAIL PROTECTED] -- www.thickbook.com Find Sams Teach Yourself MySQL in 24 Hours at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] is there a way to track downloads
Well see I don't know where to begin all this. I have a plain html page, with links to the songs: ../music/song.mp3 And I woudn't know where to start, in creating a php track file, or a text file to keep track. I am able to have MySQL on the hosting server, which I am going to enable... and from there I am lost. Sorry for giving up, but it seems to hard for me, plus I only have about 2 weeks to learn PhP, if I wanted to implement this... I don't think that is possible. Kevin J Julie Meloni [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... KJ I am looking at scripts and realize that I need to use a database for this, KJ etc... so I am just gonna forget the whole thing. Unfortunate, that giving up so easily! You can also do exactly the same type of tracking in a plain text file, if you do not have access to a db. Substitute opening a file and writing a line, for inserting a record into a db. Plenty of examples in the manual. (ok, at least 1) - Julie -- Julie Meloni -- [EMAIL PROTECTED] -- www.thickbook.com Find Sams Teach Yourself MySQL in 24 Hours at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] is there a way to track downloads
On Sun, 23 Jun 2002, Kevin J wrote: Sorry for giving up, but it seems to hard for me, plus I only have about 2 weeks to learn PhP, if I wanted to implement this... I don't think that is possible. The manual abounds with examples on how to a) connect to a database b) read / write data in files Of course, the simpler way is to just analyse the web server logs for hits on the files in question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] about file permissions + cuteftp
hi, how come when i make a dir thus mkdir($basedir,0777); cute can't then chmod or delete said dir. also vice versa : when i create a dir with cute with 777 access php can't do anything with it. it's very annoying.
RE: [PHP] is there a function like javascript's window.open in PHP
This is a common question, related to the lack of understanding of client/server architectures I believe. PHP is all server side - a browser is all client side. Servers can send data only to the browser, nothing else. The server can inquire and gather data from text files and databases, but it will format the data into a particular protocol (HTTP most often) and send it to the browser. The data may even include lines of text from a language that the browser understands, like JavaScript. Or it might be XML data and the corresponding XSLT instructions. But ... it can't affect the browser directly. Only the embedded instructions that the browser understands can actually affect anything on the browser. The browser looks at the stream of data provided by the server and decides on-the-fly what to do with it. If it sees JavaScript instructions, it may decide to interpret them and do some particular action. Or it may decide that it doesn't want to play with JavaScript today and just ignore them. It may see the XML/XSLT and decide to do something - but it doesn't have to. This, of couse, is the bane of Web programmers everywhere. What does the browser understand, and what does it do with the data. PHP allows us to write programs eaisy on the server to make some decisions on what to send a browser, but it cannot act directly on the browser. We must depend (somehow) on the browser interpreting what we tell it and then acting in a particular way. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 12:17 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] is there a function like javascript's window.open in PHP On Sunday 23 June 2002 07:21, Burak Delice wrote: hi, I wonder that is there a PHP function like window.open() into Javascript? No. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* One thought driven home is better than three left on base. */ -- 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] Smarty compared to Roadsend?
Anyone has any comparative info between Smarty and Roadsend frameworks? I saw them mentioned on an email, along with horde and binarycloud, and they look interesting. I have looked at horde and found it difficult to get even the basics due to lacking documentation and configuration files which I felt were not well organized. BinaryCloud seems very large and with a very big learning curve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert an array into MySQL
Nevermind, I got it. I had Unique for a field which made it mad. Rob Packer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... oops, sorry about the other post (I've got a baby that likes the keyboard)... Hi, This is the form, which I had doubts about, but it seemed to put things into the array correctly when I tested it by printing it out. I can't see how, it will print key=0 value=index.html key=1 value=about.html key=2 value=whats_new.html when I test it and then have a duplicate key. It's saying that I have 2 $pagetype[0] correct? Anyhow, here's the form... INPUT TYPE=hidden NAME=pagetype[] VALUE='index.html'Home Page br INPUT TYPE=checkbox NAME=pagetype[] VALUE='about.html'About Page br INPUT TYPE=checkbox NAME=pagetype[] VALUE='whats_new.html'What's New Pagebr INPUT TYPE=checkbox NAME=pagetype[] VALUE='contact.html'Contact Pagebr INPUT TYPE=checkbox NAME=pagetype[] VALUE='favorite_links.html'Favorite Links br The CREATE TABLE is this: I define the table name from user input. $query_links=CREATE TABLE $username_links (id INT(4) not null, links VARCHAR(20) not null, UNIQUE (id)); if(mysql_query($query_links,$connection)){ echo Links table created!br; }else{ echo no links table madeBR; } thanks, Rob John Holmes [EMAIL PROTECTED] wrote in message 001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango... Your second method should work, but it's dependent on what your form looks like and how your table was created. You obviously have a key set for this column and you're trying to insert the same value twice, which makes an error. Show us what your form looks like, not the whole thing, just for the checkboxes. Also, what does your CREATE TABLE look like for the table your trying to insert this data into? ---John Holmes... -Original Message- From: Rob Packer [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Insert an array into MySQL Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert -- 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] Cc / Bcc don't work on win2k but on linux???
You could use the mail class by Manuel Lemos on php.upperdesign.com if you need cc/bcc and attachments. I've been using it for quite some time now with good results. Christoph Lance wrote: ok. thanks for the info. guess i have to wait till it hit stable version before deploying it on live server. for now, it's byebye to CC/BCC/Attachments. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formatting phone numbers
Hi, I'd like to write a function that will take a string of characters and output it in a phone number format (xxx)xxx- and one for credit cards ---. What I have below will currently remove non-numeric characters from the string, but I'm not sure how to do the rest of the formatting. Any help would be appreciated. By the way, any recommendations for good php tutorials for beginners? Thanks, Corinne html head title/title /head body ? function formatPhoneNum($prmValue) { $retrunValue=''; for($i=0; $istrlen($prmValue); $i++) { if(ereg('[0-9]', substr($prmValue, $i,1))) $returnValue.=substr($prmValue,$i,1); } return $returnValue; } ? ? $phoneNum= '415123kjdf4567'; ? pPhone Number: ?=formatPhoneNum($phoneNum)?/p /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JPGraph errors
I have gotten JPGraph to work if I suppress the output of errors. I am using the example of backgroundex02.php. If I add the line error_reporting(0); at the top, I get the graph, if I remove it...I get the following error; Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in ../jpgraph.php on line 474 Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in ../jpgraph.php on line 475 Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in ../jpgraph.php on line 495 Warning: Cannot add header information - headers already sent by (output started at ../jpgraph.php:474) in ../jpgraph.php on line 4257 ?PNG I assume this is a variable for Local Time, but I don't know where to set it. Can anyone help me please. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formatting phone numbers
Hi Corinne, Maybe you have a look at the sprintf function in PHP http://www.php.net/manual/nl/function.sprintf.php It returns a string produced according to a formatting string (i.e. phonenumber) format. Also have look at the other formatting functions in PHP. Bye, Sacha Telgenhof Corinne Shea [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I'd like to write a function that will take a string of characters and output it in a phone number format (xxx)xxx- and one for credit cards ---. What I have below will currently remove non-numeric characters from the string, but I'm not sure how to do the rest of the formatting. Any help would be appreciated. By the way, any recommendations for good php tutorials for beginners? Thanks, Corinne html head title/title /head body ? function formatPhoneNum($prmValue) { $retrunValue=''; for($i=0; $istrlen($prmValue); $i++) { if(ereg('[0-9]', substr($prmValue, $i,1))) $returnValue.=substr($prmValue,$i,1); } return $returnValue; } ? ? $phoneNum= '415123kjdf4567'; ? pPhone Number: ?=formatPhoneNum($phoneNum)?/p /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Shot in the dark
[EMAIL PROTECTED] (Jtjohnston), il 06 lug 2002, trasse un profondo sospiro e disse: [cut] Check your date. Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Remote cgi script function
I am new to php, I would like to create a function that when called sends text from a text box as a query to a remote cgi script ,e.g http://www.anydomain.com/cgi-bin/script.cgi, and return the results as a variable so that i can echo the returned variable to an html page. ? $contents = ; $text = whatever...; $ftext = urlencode($text); $fp = fopen(http://www.example.com/cgi-bin/script.cgi?text=; . $ftext, r); while($data = fread($fp,1000)) { $contents .= $data; } fclose ($fd); ? The response is now in $contents. Adapt to your needs. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error(Newbie)
The only data returned by a browser in a Cookie header is the name/value pairs. So, your example would not pose a threat of any sort. The Referer and User-Agent are separate headers, but like all data from the client, they should also not be trusted. If you have magic quotes enabled, you're probably safe. It is actually best not to just addslashes() again to be sure for any data. Rather, echo the value of your data to the screen during development, and test to be sure that your single quotes are escaped like you think they should be. Exactly... the name would be tececo_stats and the value would be bad_data','bad_time','bad_host','bad_referrer','bad_agent')# If slashes are not getting added to that data, either by magic quotes or by addslashes(), then he's open to getting bad data inserted into his table... If magic_quotes_gpc is ON, then you're fine... ---John Holmes... Chris 1LT John W. Holmes wrote: Yeah, magic_quotes will be enough, but it only handles GET, POST, and COOKIE data. I'm not sure what SERVER variables can be trusted, so it wouldn't hurt to addslash them... There isn't much of a risk to your query, but someone could still mess things up. If they formatted a cookie like $_COOKIE['tececo_stats'] = bad_data','bad_time','bad_host','bad_referrer','bad_agent')#; it would allow them to insert bad data into your table... -- 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] Whos online at the moment in PHP
Hi, I've ma some atuh system to do such thing beside other special functions, u have to store some session ids in some db and then refresh timestamp for those session wich is still active other delete after 30min or some other time. -- bye, Urosmailto:[EMAIL PROTECTED] Sunday, June 23, 2002, 3:53:46 PM, you wrote: P Is it possible to code in PHP a small indicator on a site saying how many P people are viewing that page at the moment? P Sorry if its a silly question, but i am a newbie at PHP. If it is, could P you point me in the good direction? i mean, some function or something. P Thanks. P Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to put a new line character with fputs($birthday_file, $content);
Hi, I am saving the result of a query on a text file. Then I want to open it with excel. At the moment, when I open it with excel, all results appear in one very long line. How could I insert a new line character at the end of each record? Thanks Alfredo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a function like javascript's window.open in PHP
Mark, thankyou very very much your detailed explanations about my complexity. And thank you for gave your time to write it. I think, I have to start first step about scripts :) Mark Charette [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This is a common question, related to the lack of understanding of client/server architectures I believe. PHP is all server side - a browser is all client side. Servers can send data only to the browser, nothing else. The server can inquire and gather data from text files and databases, but it will format the data into a particular protocol (HTTP most often) and send it to the browser. The data may even include lines of text from a language that the browser understands, like JavaScript. Or it might be XML data and the corresponding XSLT instructions. But ... it can't affect the browser directly. Only the embedded instructions that the browser understands can actually affect anything on the browser. The browser looks at the stream of data provided by the server and decides on-the-fly what to do with it. If it sees JavaScript instructions, it may decide to interpret them and do some particular action. Or it may decide that it doesn't want to play with JavaScript today and just ignore them. It may see the XML/XSLT and decide to do something - but it doesn't have to. This, of couse, is the bane of Web programmers everywhere. What does the browser understand, and what does it do with the data. PHP allows us to write programs eaisy on the server to make some decisions on what to send a browser, but it cannot act directly on the browser. We must depend (somehow) on the browser interpreting what we tell it and then acting in a particular way. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 12:17 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] is there a function like javascript's window.open in PHP On Sunday 23 June 2002 07:21, Burak Delice wrote: hi, I wonder that is there a PHP function like window.open() into Javascript? No. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* One thought driven home is better than three left on base. */ -- 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] How to put a new line character with fputs($birthday_file,$content);
On Fri, 21 Jun 2002, Alfredo wrote: Hi, I am saving the result of a query on a text file. Then I want to open it with excel. At the moment, when I open it with excel, all results appear in one very long line. How could I insert a new line character at the end of each record? Unix considers a line feed to be \n Windows/DOS use \r\n -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to put a new line character with fputs($birthday_file,$content);
\n is a newline character, \r is a carriage return. $line = This is a line with a newline character.\n; You can find it in the manual here: http://www.php.net/manual/en/language.types.string.php mh. On Fri, 21 Jun 2002, Alfredo wrote: Hi, I am saving the result of a query on a text file. Then I want to open it with excel. At the moment, when I open it with excel, all results appear in one very long line. How could I insert a new line character at the end of each record? Thanks Alfredo -- 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] php or mysql db update
I am trying to sort some old data files that have turned up, records of who lived where in my town, they are quite incomplete, and I have to reformat the information in a 20k line database, and could really do with a little help the tables and basic data is like this: ID , Address, Name, Relation 1, market st, fred waters, head 2, market st, mrs waters, wife 3, market st, paul waters, son 4, market st, jim wheeler, head 5, market st, mrs wheeler, wife 6, market st, ann wheeler, dau my problem is that about 5k of the address's are not unique I.e. there may be a whole street of people with their address listed as 'Market Street' and there isn't a good way to tell a whole household of people in the street from the next-door household, except that each 'household' only has 1 'Head' as its value in the 'relation' column, and these records are almost all correctly formatted. so, I want to alter the database table to be ID , Address, Name, Relation, household this will allow me to count and number the relation tables 'Heads' entries, I want to keep the same count number for all relations/visitors of that 'Household' until the next instance of 'Head' in the 'Relation' column, so that the household count would increment as below: ID , Address, Name, Relation, household 1, market st, fred waters, head, 1 2, market st, mrs waters, wife, 1 3, market st, paul waters, son, 1 4, market st, jim wheeler, head, 2 5, market st, mrs wheeler, wife, 2 6, market st, ann wheeler, dau, 2 by dong this, I can easily search and find all the people that are a 'family unit', in any particular house, even if the address field, isn't unique, i.e. ,market st, instead of #4 market st. so, I know what I want to do, but am totally at a loss how to do it. I know I need to cycle through the whole of the 20k records, updating the new 'household' table with a number that increments by +1 and use that number for all entries until after each instance of the data being 'head'. when if its incremented by +1, it will be another family unit. Can anyone help me with how to do this, I am not sure whether it will need php to read and insert the incrementing number, or if its possible with just a mysql statement ? any help at all will be appreciated Steven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formatting phone numbers
Corinne Shea wrote: Hi, I'd like to write a function that will take a string of characters and output it in a phone number format (xxx)xxx- and one for credit cards ---. This is actually very easy to do if all you want to do is format, meaning you have already validated the data and can be assured that you have ten digits (or 16 for credit cards). $phone_num=8005551212; $formatted_phone_num=( . substr($phone_num, 0, 3) . ) . substr($phone_num, 3, 3) . - . substr($phone_num, 6, 4); I'm sure there are other ways to achieve the same result, but you basically want to look at string functions that allow you to slice a phone number into whatever parts you want (area code, prefix, suffice for US numbers) and then create a string formatted however you want. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is this a BUG?
Hi all, A couple of days ago, Ive been starting to organize all my scripts into functions within libraries, and got into a problem this morning. Now, I dont know if this is a bug or its just me getting confused. I got the problem when calling two functions one gets variables from the other within the same page. That is, I have a mainusers.php page, which only calls for functions instead of writing them all together inside that page. At one step, it calls for an adduser function which brings a table that let the administrator insert a new user. After the submit button is pressed, it calls for a function called useradded which resides in the same library as the adduser function. This useradded function queries the database, inserting the user. The problem is that it does not get the HTTP_POST_VARS although they are being passed according to phpinfo.php. The structure is this: Project directory Library Directory addlib.php adduser() function useradded() function Pages directory mainusers.php first calls for adduser() and then for useradded() Now, the thing is if I, instead of calling the function, write the query directly in the mainusers.php page, the variables are get well and written into the database. I dont know if this makes much sense, but the thing is Isnt PHP forced to pass those variables before the function is called so when theyre needed they can be get through HTTP_POST_VARS or just $var_name which I like using? Thanks Cesar Aracena mailto:[EMAIL PROTECTED] CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621
[PHP] retaining keys in array_splice
I can't seem to figure out how to use array_splice to replace an element while retaining the key... instead it replaces the key with 0 for example... $foo=array(color=blue,fruit=apple,foo=bar); array_splace($foo,1,1,array(car=pinto)); yields... Array ( [color] = blue [0] = pinto [foo] = bar ) instead of Array ( [color] = blue [car] = pinto [foo] = bar ) ... Is there a quick and dirty way to do this? or does it require chopping the array up into to parts and merging them back together again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to put a new line character with fputs($birthday_file, $content);
I think you can also use \t to separate the data into the various columns needed by excel - Original Message - From: Alfredo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 21, 2002 7:55 PM Subject: [PHP] How to put a new line character with fputs($birthday_file, $content); Hi, I am saving the result of a query on a text file. Then I want to open it with excel. At the moment, when I open it with excel, all results appear in one very long line. How could I insert a new line character at the end of each record? Thanks Alfredo -- 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] solution
I figured it out, not what i'd wanted it to be, but it works, if anyone can improve upon it, please let me know. ?php function array_key_replace($foo,$original,$replacement,$replacement_value) { $bar=array(); foreach($foo as $key=$value) { if ($key==$original) { $bar[$replacement]=$replacement_value; } else $bar[$key]=$value; } return $bar; } $foo=array(color=blue,fruit=apple,foo=bar); $foo=array_key_replace($foo,fruit,car,pinto); ? Enjoy! ;) Austin W. Marshall wrote: I can't seem to figure out how to use array_splice to replace an element while retaining the key... instead it replaces the key with 0 for example... $foo=array(color=blue,fruit=apple,foo=bar); array_splace($foo,1,1,array(car=pinto)); yields... Array ( [color] = blue [0] = pinto [foo] = bar ) instead of Array ( [color] = blue [car] = pinto [foo] = bar ) ... Is there a quick and dirty way to do this? or does it require chopping the array up into to parts and merging them back together again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this a BUG?
In article 000c01c21b02$4b69e1b0$1aed0dd1@gateway, [EMAIL PROTECTED] (César aracena) wrote: I have a mainusers.php page, which only calls for functions instead of writing them all together inside that page. At one step, it calls for an adduser function which brings a table that let the administrator insert a new user. After the submit button is pressed, it calls for a function called useradded which resides in the same library as the adduser function. This useradded function queries the database, inserting the user. The problem is that it does not get the HTTP POST VARS although they are being passed according to phpinfo.php. Without an example to look at, I may be mis-understanding your situation. But it sounds like this may be a scoping issue: trying to use a global ($HTTP_POST_VARS) within a function without using the special global keyword. This won't work: function adduser() { echo LOCAL SCOPE: . $HTTP_POST_VARS['user']; } adduser(); This will: function adduser() { global $HTTP_POST_VARS['user']; echo GLOBAL SCOPE: . $HTTP_POST_VARS['user']; } adduser(); If this is the problem you're having, you can find more information at: http://php.net/variables.scope http://php.net/global -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php install in win32
I just download apache 1.3.x latest, php latest andmy sql latest. (win32 env) Which packages I need to download now to enable gd-library for graphics ? and zlib ? I wanna enable png creation . . where can I find the compiled dlls for those ? I found a dll called gds32.dll in the dlls dir of php is that one for the gd library ? In the php file then you have to enable the extensions... shall i add gds32.dll then in the list there ? Thanks in advance... -- Sapilas/dev/pinkeye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this a BUG?
If the code is in a function then don't you need to call global $HTTP_POST_VARS; at the top of the function so that it knows you can use that varible? Andrew - Original Message - From: César Aracena [EMAIL PROTECTED] To: PHP General List [EMAIL PROTECTED] Sent: Sunday, June 23, 2002 11:06 PM Subject: [PHP] Is this a BUG? Hi all, A couple of days ago, I've been starting to organize all my scripts into functions within libraries, and got into a problem this morning. Now, I don't know if this is a bug or it's just me getting confused. I got the problem when calling two functions - one gets variables from the other - within the same page. That is, I have a mainusers.php page, which only calls for functions instead of writing them all together inside that page. At one step, it calls for an adduser function which brings a table that let the administrator insert a new user. After the submit button is pressed, it calls for a function called useradded which resides in the same library as the adduser function. This useradded function queries the database, inserting the user. The problem is that it does not get the HTTP_POST_VARS although they are being passed according to phpinfo.php. The structure is this: Project directory Library Directory addlib.php adduser() function useradded() function Pages directory mainusers.php first calls for adduser() and then for useradded() Now, the thing is if I, instead of calling the function, write the query directly in the mainusers.php page, the variables are get well and written into the database. I don't know if this makes much sense, but the thing is. Isn't PHP forced to pass those variables before the function is called so when they're needed they can be get through HTTP_POST_VARS or just $var_name which I like using? Thanks. Cesar Aracena mailto:[EMAIL PROTECTED] CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a way to track downloads
i have a opensource redirect script that can easily be adapted to track downloads - just need to replace a absolute url for a file name. check it out at http://user:[EMAIL PROTECTED]/lab cheers Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 23 Jun 2002 23:59:53 -0000 Issue 1423
php-general Digest 23 Jun 2002 23:59:53 - Issue 1423 Topics (messages 103453 through 103505): Insert an array into MySQL 103453 by: Rob Packer 103455 by: John Holmes 103458 by: Rob Packer 103459 by: Rob Packer 103482 by: Rob Packer Re: PHP 4.2 103454 by: John Holmes 103456 by: Pekka Saarinen 103457 by: Justin French Profiling 103460 by: James Drabb 103461 by: Justin French Re: getaddrinfo failed 103462 by: Pag Whos online at the moment in PHP 103463 by: Pag 103466 by: Justin French 103471 by: Chris Shiflett 103491 by: Uros Gruber output_buffering 103464 by: James Drabb 103468 by: Mark Charette Problem with Apache2/PHP4.2.1 103465 by: Simon Grabowski Re: Error(Newbie) 103467 by: Chris Shiflett 103490 by: John Holmes Re: Nested Menu Help 103469 by: Lowell Allen Re: netscape 4.x problem 103470 by: Chris Shiflett Remote cgi script function 103472 by: Haddad Said 103489 by: John Holmes is there a way to track downloads 103473 by: Kevin J 103474 by: Duncan Hill 103475 by: Kevin J 103476 by: Julie Meloni 103477 by: Kevin J 103478 by: Duncan Hill 103505 by: Henry about file permissions + cuteftp 103479 by: Adrian Murphy Re: is there a function like javascript's window.open in PHP 103480 by: Mark Charette 103493 by: Burak Delice Smarty compared to Roadsend? 103481 by: Francisco Reyes Re: Cc / Bcc don't work on win2k but on linux??? 103483 by: Christoph Grottolo Formatting phone numbers 103484 by: Corinne Shea 103486 by: S.P. Telgenhof Oude Koehorst 103487 by: Paul Roberts 103497 by: Chris Shiflett JPGraph errors 103485 by: Christopher J. Crane Re: Shot in the dark 103488 by: Numero 6 How to put a new line character with fputs($birthday_file, $content); 103492 by: Alfredo 103494 by: Duncan Hill 103495 by: Mark Heintz PHP Mailing Lists 103500 by: hugh danaher php or mysql db update 103496 by: Steven Dowd Is this a BUG? 103498 by: César Aracena 103502 by: CC Zona 103504 by: Andrew Brampton retaining keys in array_splice 103499 by: Austin W. Marshall solution 103501 by: Austin W. Marshall php install in win32 103503 by: Septic Flesh Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code while(list($key,$value)=each($pagetype)){ //echo $value.br;//test $links=INSERT INTO $username_links (links) VALUES ('$value'); $insert=mysql_query($links,$connection); } // Second code attempt $number=count($pagetype); for($a=0;$a$number;$a++){ $links=INSERT INTO $username_links (links) VALUES ('$pagetype[$a]'); $insert=mysql_query($links) or die(mysql_error()); //echo $pagetype[$a];//test } Thanks in advance...Robert ---End Message--- ---BeginMessage--- Your second method should work, but it's dependent on what your form looks like and how your table was created. You obviously have a key set for this column and you're trying to insert the same value twice, which makes an error. Show us what your form looks like, not the whole thing, just for the checkboxes. Also, what does your CREATE TABLE look like for the table your trying to insert this data into? ---John Holmes... -Original Message- From: Rob Packer [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Insert an array into MySQL Hi, I've seen a few post for this same thing but I can't seem to get it working. What I'm doing is taking a form with check boxes and putting them into an array. Then I'm attempting to INSERT them into the db, one checkbox value per row. Okay, well I've tries 2 ways that I think should work and they only insert the first value. They both produce this error Duplicate entry '0' for key 1 (which I don't understand) Anyway here is the code I'm trying... (I'm not trying to use both blocks of code, just one or the other) // First code
[PHP] Using Oracle Data base store procedure (function, procedure, package)
Dear pals, how can we execute Oracle Data base store procedure (function, procedure, package) and retrieve the result/s via PHP ? any example ? TIA, edyk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using Oracle Data base store procedure (function, procedure, package)
by looking in the manual :) there is someinfo there.. -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 11:24 AM To: php general Subject: [PHP] Using Oracle Data base store procedure (function, procedure, package) Dear pals, how can we execute Oracle Data base store procedure (function, procedure, package) and retrieve the result/s via PHP ? any example ? TIA, edyk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to remove item from cart
I have a shopping cart where users have added a list of documents for purchase. I want to allow users to remove documents from the cart before checkout. There are no quantities involved-- this is a yes I want $docID or no I don't situation. I thought the easiest way might be to have a checked checkbox before each item (. . . name=checkbox value=true checked) with instructions to uncheck the box and click on a save changes button to refresh the cart. I've spent many hours trying to get this scheme to work. Before I spend more time beating my head against the same 'ol wall, I thought I'd ask those more knowledgeable if a checkbox is the best method of achieving this. If so, this is the code I tried to use (the $save variable is passed as a hidden form field, $cart is an array and a registered session variable) if($save) { if($checkbox != true) unset($cart[$docID]); else $cart[$docID] = $$docID; } (I should say this is the latest version. I've tried lots of way, but none have worked. I've tried foreach in lots of ways, but I may not understand this construct properly. For example I've tried: if($save) { foreach ($cart as $docID = $checkbox) { if($checkbox != true) unset($cart[$docID]); else $cart[$docID] = $$docID; } ) If you can suggest code that works, that would be great, or at least point me in the right direction if I'm on the wrong track with checkboxes. If you haven't noticed already, I'm very, very new to PHP and haven't quite got the hang of it yet. :=) Thanks, Vicki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Limiting text inputs by character count?
Is there a way to limit the number of characters that may be inputed into: a) a input type=text . . . input b) a textarea . . . input I would like to control the maximum number of characters for each of these inputs. Any suggestions of where to look, or how to do it, if it's possible, would be greatly appreciated. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limiting text inputs by character count?
a) maxlength=xx b) use javascript (document.forms[frm_name].elements[textarea].value.length) (I think you need the .value bit) -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 11:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Limiting text inputs by character count? Is there a way to limit the number of characters that may be inputed into: a) a input type=text . . . input b) a textarea . . . input I would like to control the maximum number of characters for each of these inputs. Any suggestions of where to look, or how to do it, if it's possible, would be greatly appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limiting text inputs by character count?
for standard text input use input name=textfield type=text size=10 maxlength=10 that will only allow 10 characters not sure if that will also work for text area's -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 11:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Limiting text inputs by character count? Is there a way to limit the number of characters that may be inputed into: a) a input type=text . . . input b) a textarea . . . input I would like to control the maximum number of characters for each of these inputs. Any suggestions of where to look, or how to do it, if it's possible, would be greatly appreciated. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using Oracle Data base store procedure (function, procedure, package)
very thanksful if you could refering to me what part (kinda) manual that shows my case ? i've ever read the PHP manual in english, but i can't find what i need. please.. sincerely, edyk - Original Message - From: Peter [EMAIL PROTECTED] Subject: RE: [PHP] Using Oracle Data base store procedure (function, procedure, package) by looking in the manual :) there is someinfo there.. -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] Dear pals, how can we execute Oracle Data base store procedure (function, procedure, package) and retrieve the result/s via PHP ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using Oracle Data base store procedure (function, procedure, package)
have a look here ... this would be a good starting point... http://www.php.net/manual/en/ref.oracle.php I am sure this would be available in many other languages apart from just english :) -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 12:20 PM To: Peter; php general Subject: Re: [PHP] Using Oracle Data base store procedure (function, procedure, package) very thanksful if you could refering to me what part (kinda) manual that shows my case ? i've ever read the PHP manual in english, but i can't find what i need. please.. sincerely, edyk - Original Message - From: Peter [EMAIL PROTECTED] Subject: RE: [PHP] Using Oracle Data base store procedure (function, procedure, package) by looking in the manual :) there is someinfo there.. -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] Dear pals, how can we execute Oracle Data base store procedure (function, procedure, package) and retrieve the result/s via PHP ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Limiting text inputs by character count?
Thanks Peter, That'll fix it. Regards, Andre On Sunday 23 June 2002 10:04 pm, you wrote: for standard text input use input name=textfield type=text size=10 maxlength=10 that will only allow 10 characters not sure if that will also work for text area's -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 11:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Limiting text inputs by character count? Is there a way to limit the number of characters that may be inputed into: a) a input type=text . . . input b) a textarea . . . input I would like to control the maximum number of characters for each of these inputs. Any suggestions of where to look, or how to do it, if it's possible, would be greatly appreciated. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using Oracle Data base store procedure (function, procedure, package)
Peter, Thanks for your ASAP response, Have you ever touch with oracle scripting ? The manual doesn't show how we can execute kind of oracle store procedure .. I thought that PHP only supporting for SQL - query only but not supported to retrieve PL-SQL, When I do the samething with Oracle developer in PHP environment so I have to convert my PL-SQL which stored in Oracle DB to PHP script. In my mind it shows that PHP only use Oracle just only 'data storage', could not retrieve many additional features of oracle itself. CMIIW, edyk - Original Message - From: Peter [EMAIL PROTECTED] Subject: RE: [PHP] Using Oracle Data base store procedure (function, procedure, package) have a look here ... this would be a good starting point... http://www.php.net/manual/en/ref.oracle.php I am sure this would be available in many other languages apart from just english :) -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] procedure, package) very thanksful if you could refering to me what part (kinda) manual that shows my case ? i've ever read the PHP manual in english, but i can't find what i need. please.. sincerely, edyk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using Oracle Data base store procedure (function, procedure, package)
I don't know ... am only just starting to use php oracle today :) -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 12:46 PM To: Peter; php general Subject: Re: [PHP] Using Oracle Data base store procedure (function, procedure, package) Peter, Thanks for your ASAP response, Have you ever touch with oracle scripting ? The manual doesn't show how we can execute kind of oracle store procedure .. I thought that PHP only supporting for SQL - query only but not supported to retrieve PL-SQL, When I do the samething with Oracle developer in PHP environment so I have to convert my PL-SQL which stored in Oracle DB to PHP script. In my mind it shows that PHP only use Oracle just only 'data storage', could not retrieve many additional features of oracle itself. CMIIW, edyk - Original Message - From: Peter [EMAIL PROTECTED] Subject: RE: [PHP] Using Oracle Data base store procedure (function, procedure, package) have a look here ... this would be a good starting point... http://www.php.net/manual/en/ref.oracle.php I am sure this would be available in many other languages apart from just english :) -Original Message- From: èdy kurniawan [mailto:[EMAIL PROTECTED]] procedure, package) very thanksful if you could refering to me what part (kinda) manual that shows my case ? i've ever read the PHP manual in english, but i can't find what i need. please.. sincerely, edyk
[PHP] === and @
What exactly happens when you put three equal-signs together instead of just one or two? I've seen this in other people's code, then search php.net and found nothing. Also, what happens when you put a thingy in front of a function? Does it surpress the errors? Thanks!!
Re: [PHP] === and @
http://php.net/operators which would take you to: http://www.php.net/manual/en/language.operators.comparison.php and http://www.php.net/manual/en/language.operators.errorcontrol.php It's all there. -Rasmus On Sun, 23 Jun 2002, Phil Schwarzmann wrote: What exactly happens when you put three equal-signs together instead of just one or two? I've seen this in other people's code, then search php.net and found nothing. Also, what happens when you put a thingy in front of a function? Does it surpress the errors? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] === and @
on 24/06/02 12:46 PM, Phil Schwarzmann ([EMAIL PROTECTED]) wrote: What exactly happens when you put three equal-signs together instead of just one or two? I've seen this in other people's code, then search php.net and found nothing. http://www.php.net/manual/en/language.operators.comparison.php ( I did a search php.net/comparison and got it straight away ) Also, what happens when you put a @ thingy in front of a function? Does it surpress the errors? Yes, or perhaps allows you to form your own errors with: or die ('something'); Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Time Delay using phpscript
Hello, Can anyone please clear my doubt I need to display some strings one by one after some specific time..In javascript we can use setTimeout() function.Is there any function like this in phpscript ???.. Thanks Regards Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time Delay using phpscript
maybe while(true) { echo word; flush(); sleep(1); } but I don't think that's exactly what you want, is it? -Original Message- From: Uma Shankari T. [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 1:14 PM To: PHP Subject: [PHP] Time Delay using phpscript Hello, Can anyone please clear my doubt I need to display some strings one by one after some specific time..In javascript we can use setTimeout() function.Is there any function like this in phpscript ???.. Thanks Regards Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limiting text inputs by character count?
The best way to do this is server side with strlen(). You can use javascript or maxlength, but if a user wants to get around it, they can. ---John Holmes... -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 9:47 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] Limiting text inputs by character count? a) maxlength=xx b) use javascript (document.forms[frm_name].elements[textarea].value.length) (I think you need the .value bit) -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 11:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Limiting text inputs by character count? Is there a way to limit the number of characters that may be inputed into: a) a input type=text . . . input b) a textarea . . . input I would like to control the maximum number of characters for each of these inputs. Any suggestions of where to look, or how to do it, if it's possible, would be greatly appreciated. Tia, Andre -- 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] about file permissions + cuteftp
Because when you use php to make a file/directory, the webserver makes the owner the webserver (usually nobody). Unless you log in as nobody (or whatever respective name), you will not be able to modify the permissions or delete the file/dir. However, when logging in and making a file with 777 permissions, php and the webserver should be able to modify the file... --- Adrian Murphy [EMAIL PROTECTED] wrote: hi, how come when i make a dir thus mkdir($basedir,0777); cute can't then chmod or delete said dir. also vice versa : when i create a dir with cute with 777 access php can't do anything with it. it's very annoying. __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time Delay using phpscript
I need to display some strings one by one after some specific time..In javascript we can use setTimeout() function.Is there any function like this in phpscript ???.. No, not really. PHP just evaluates the script and sends the output to the browser. It has no control over the display at all. Best you could do is output some JavaScript along with your HTML and attempt to control it that way. Basically, since you already know how to do it with JavaScript, have PHP write the JavaScript for you... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Time Delay using phpscript
Why would you want to do this? All it will achieve is delaying the output of the entire file to the browser... If a page would usually take .5 seconds to parse, and you have 10 seconds of delays in the script, then the browser will get the page in around 10.5 seconds... the user will just see a delay, NOT a page with new things every few seconds in the already-rendered page. Once again, PHP is a SERVER SIDE language, and EVERYTHING happens before the page is sent to the browser. If you want stuff to happen on the CLIENT SIDE, like displaying a new line every few seconds, then this needs to be achieved in the BROWSER, with JavaScript or something. If you View source on a PHP script in your browser, all you'll see is HTML code... no PHP -- it's all parsed on the server. Justin French on 24/06/02 1:14 PM, Uma Shankari T. ([EMAIL PROTECTED]) wrote: I need to display some strings one by one after some specific time..In javascript we can use setTimeout() function.Is there any function like this in phpscript ???.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copying the structure of a blank table in mysql
Anyone have a link (or the code) to copy the structure of a blank table to a new table using mysql? Thanks!!
[PHP] rounding a number
I want to round a number to the nearest decimal place... if the number is 4.623, I want it to display 4.6 if the number is 2.36, I want it to display 2.7 Is there a function that does this? round(), ceil(), floor() don't do this and I've checked through all the math functions in my handy-dandy PHP Functions reference book. Thanks for your help!!! Or..if it's too hard to do that, I could just use a function that chops off the end of some decimals, like... if the number is 2.343234, I want just 2.3 or if the number is 2.545434534534534534, I want just 2.5 Thanks!!
RE: [PHP] rounding a number
according to the pdf version of the manual I have, round() is what you need float round(float val[, int precision]) have another look that the man page -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 1:35 PM To: [EMAIL PROTECTED] Subject: [PHP] rounding a number I want to round a number to the nearest decimal place... if the number is 4.623, I want it to display 4.6 if the number is 2.36, I want it to display 2.7 Is there a function that does this? round(), ceil(), floor() don't do this and I've checked through all the math functions in my handy-dandy PHP Functions reference book. Thanks for your help!!! Or..if it's too hard to do that, I could just use a function that chops off the end of some decimals, like... if the number is 2.343234, I want just 2.3 or if the number is 2.545434534534534534, I want just 2.5 Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] rounding a number
I think what you're looking for is number_format() - you can set decimal places with it and used in combo with round(), ceil(), and/or floor(), you should be able to achieved the desired result. http://www.php.net/manual/en/function.number-format.php HTH, Jason Soza -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 7:35 PM To: [EMAIL PROTECTED] Subject: [PHP] rounding a number I want to round a number to the nearest decimal place... if the number is 4.623, I want it to display 4.6 if the number is 2.36, I want it to display 2.7 Is there a function that does this? round(), ceil(), floor() don't do this and I've checked through all the math functions in my handy-dandy PHP Functions reference book. Thanks for your help!!! Or..if it's too hard to do that, I could just use a function that chops off the end of some decimals, like... if the number is 2.343234, I want just 2.3 or if the number is 2.545434534534534534, I want just 2.5 Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding a number
On Monday 24 June 2002 11:34, Phil Schwarzmann wrote: I want to round a number to the nearest decimal place... if the number is 4.623, I want it to display 4.6 if the number is 2.36, I want it to display 2.7 You don't really mean 2.36 -- 2.7 ?? Is there a function that does this? round(), ceil(), floor() don't do this and I've checked through all the math functions in my handy-dandy PHP Functions reference book. round() seems to work. What's the problem you're having? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* That's no moon... -- Obi-wan Kenobi */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] netscape 4.x problem
Hi Tom: On Sun, Jun 23, 2002 at 01:24:57AM -0600, Thomas E. Ruth wrote: If I have a script called sendheader.php with the following: ? if (! isset($GLOBALS[sendheader])) { header(Location: http://blah.com/sendheader.php;); exit; } echo blah; ? Dude, what IS the point of this? If the $sendheader variable isn't set, you're sending the person back to the same page w/o setting the sentheader variable first... So, you've created an infinite loop. Do you mean to be doing: header('Location: http://blah.com/sendheader.php?sendheader=y'); Some other tips: When array keys are strings, put them in quotes ($GLOBALS['sendheader']) Use single quotes rather than double quotes when dealing with strings that are not being evaluated for variables in them. --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] php or mysql db update
Steven: On Sun, Jun 23, 2002 at 10:30:56PM +0100, Steven Dowd wrote: ID , Address, Name, Relation 1, market st, fred waters, head 2, market st, mrs waters, wife 3, market st, paul waters, son 4, market st, jim wheeler, head 5, market st, mrs wheeler, wife 6, market st, ann wheeler, dau ID , Address, Name, Relation, household 1, market st, fred waters, head, 1 2, market st, mrs waters, wife, 1 3, market st, paul waters, son, 1 4, market st, jim wheeler, head, 2 5, market st, mrs wheeler, wife, 2 6, market st, ann wheeler, dau, 2 so, I know what I want to do, but am totally at a loss how to do it. I know I need to cycle through the whole of the 20k records, updating the new 'household' table with a number that increments by +1 and use that number for all entries until after each instance of the data being 'head'. when if its incremented by +1, it will be another family unit. But, what's the guarantee that the head is always the first record in the group? Similarly, what's even guaranteeing that the houeholds even have their members in consecutive rows? Anyway, you'd be wise to normalize your table structure. At a minimum, the relation should not be a text field, but rather a tiny integer, with the actual names of the type of relation in a separate table which you'd join to in your queries. Okay, back to your question, assuming everything is miraculously ordered and grouped correctly... Write and execute your main query. Then start a while loop to go through each record. Assuming you're using MySQL... In that while loop, have an if statement checking if you're looking at the head of the household. In case you are, bump up the counter. Regardless, make a query string to run later updating the current record. Lastly, loop through the array of update queries, executing each as you go along. Here's some untested code for you to try: $Queries = array(); $Counter = 0; while ( $Record = mysql_fetch_array($resource, MYSQL_ASSOC) ) { if ($Record['Relation'] = 'head') { $Counter++; } $Queries[] = UPDATE table SET Household=$Counter WHERE ID= . $Record['ID']; } while ( list(,$Val) = each($Queries) ) { mysql_query($Val); } Any questions? Read the PHP manual for the particular function. 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
Re: [PHP] How to remove item from cart
Hi Vicki: On Sun, Jun 23, 2002 at 09:30:39PM -0400, Vicki wrote: I have a shopping cart where users have added a list of documents for purchase. I want to allow users to remove documents from the cart before checkout. There are no quantities involved-- this is a yes I want $docID or no I don't situation. The whole process starts with the form. If that's not made correctly, you aren't going to get anywhere in your checkout. From your code, I have a hunch that's where your first problem lies. form input type=checkbox name=item[124] checked / input type=checkbox name=item[268] checked / /form Now, the receiving script: if ( !empty($_POST['save']) ) { if ( empty($_POST['item']) OR !is_array($_POST['item']) ) { echo HEY! You haven't selected any items!; } else { while ( list($ID,) = each($_POST['item']) ) { $cart[$ID]; } } } This doesn't delete stuff from the cart. It just creates a new $cart array containing only the things the person wants. Note, I'm using empty() a lot to avoid Warnings in the event the variables aren't set at all. Also using the $_POST[] superglobal array, assuming you're using a version of PHP = 4.1.0. 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: UPDATE mysql
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I can't get UPDATE to work properly when querying MySQL. $query = UPDATE $table SET field1='$var1' WHERE id='$id'; I want to update one field of one row in a table. Is this syntax correct? if id is an int type, no. You only need to quote values being passed to [var]char or text type fields. -- 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] copying the structure of a blank table in mysql
Phil: On Sun, Jun 23, 2002 at 11:14:22PM -0400, Phil Schwarzmann wrote: Anyone have a link (or the code) to copy the structure of a blank table to a new table using mysql? It's far simpler to do this from a command line on the system using the utilities of the database vendor, such as mysqldump, and then importing the stuff into the database, again from the command line. Look at the documentation of the database you're using. --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] Run two separate version of Apache and Php
Hello php-general, I need to run a separate version of Apache on the same server I also what to use a different copy of the php.ini file with that version of apache. I am aware that I can override most of the php.ini settings in the httpd.conf file. But this is not what I want to do. Php will be running as a DSO with apache. So is the only way I can do this is to install a different copy of php to run with this version of Apache. Or is there a way I can get the httpd.conf file to read a different copy of php.ini -- Best regards, rdkurth mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: UPDATE mysql
On Monday 24 June 2002 13:03, David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I can't get UPDATE to work properly when querying MySQL. $query = UPDATE $table SET field1='$var1' WHERE id='$id'; I want to update one field of one row in a table. Is this syntax correct? if id is an int type, no. You only need to quote values being passed to [var]char or text type fields. I don't know whether it is 'correct', but it works with or without quotes. For consistency I would use the quotes. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's easier to take it apart than to put it back together. -- Washlesky */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php