RE: [PHP] MySQL and Array's REALLY simple question but I'm not GETTING it .. Ugh..

2002-09-06 Thread Steve Gaas

OK, this works.. This is wonderful.. But I don't get it.. I assigned two
separate variables to that array function..  I don't understand why this
works now, but thanks a lot for the help. 

I hope I don't inadvertently run into this again...

-steve


$sql2 = mysql_connect(localhost, eweb, dbfun)
or die(Could not connect using default username and password LINE
14 BR);

mysql_select_db(actionregs, $sql2);

$top_level = mysql_query(SELECT * FROM williams, $sql2)
or die(Could not do query sql1 to find username. Link might not
have been made. What's up? LINE 19 BR);

// $sql2_results = mysql_fetch_array($top_level);
$query_sql2_rows = mysql_num_rows($top_level);
$rows = 0;
echo $query_sql2_rows;


print table style=\font-family:Verdana; font-size:10pt\ border=0
cellpadding=4 width=90%;
print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
width=100Owner/thth width=250Technology/ththSummary/th/tr;

for ($counter=0; $counter  $query_sql2_rows; $counter++) {
$tabledata = mysql_fetch_array($top_level);
echo td$tabledata[0]/td;
echo td$tabledata[6]/td;
echo td$tabledata[2]/td;
echo td$tabledata[3]/td;
echo /tr;
}
print /table;
-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 06, 2002 3:34 PM
To: Steve Gaas
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL and Array's REALLY simple question but I'm not
GETTING it .. Ugh..

Well, when you run the command:

$sql2_results = mysql_fetch_array($top_level);

The first time, it automatically increments the result...
so you fetch the data bu do nothing with it...
so when you get to your loop, you are already at the second entry in 
your database..

So, remove the first instance of that and see how it works..
HTH
-Brad

Steve Gaas wrote:

Can anyone tell me what's wrong with my code?  All I get output from this
is
the LAST row of data from my Database.  There are 2 rows, how do I make it
pull data from all of the rows?  It's not going through the loop like it
should  I need to be able to tell the mysql_fetch_array which row I
want
in each it iteration of the for loop.  The For loop increments counter, but
there is no syntax to add $counter to the result_type.  The same goes with
fetch_row...  

What am I forgetting!!??  I know it's something simple


***

$sql2 = mysql_connect(localhost, eweb, dbfun)
   or die(Could not connect BR);

mysql_select_db(actionregs, $sql2);

$top_level = mysql_query(SELECT * FROM williams, $sql2)
   or die(Could not do query BR);

$sql2_results = mysql_fetch_array($top_level);
$query_sql2_rows = mysql_num_rows($top_level);

echo $query_sql2_rows;
// echo's 2 rows

print table style=\font-family:Verdana; font-size:10pt\ border=0
cellpadding=4 width=90%;

print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
width=100Owner/thth width=250Technology/ththSummary/th/tr;

for ($counter=0; $counter  $query_sql2_rows; $counter++) {
   $tabledata = mysql_fetch_array($top_level);
   echo td$tabledata[0]/td;
   echo td$tabledata[6]/td;
   echo td$tabledata[2]/td;
   echo td$tabledata[3]/td;
   echo /tr;
   }
print /table;

Thanks.



  



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL and Array's REALLY simple question but I'm notGETTING it .. Ugh..

2002-09-06 Thread Jed Verity

Hello, Steve,

When you call mysql_fetch_array the first time, you are accessing the data
from the first row of your results and then moving the pointer to the next
row. So, when you call mysql_fetch_array the second time, it is already
starting with the second row of your results. Try something like this
instead:

?
$sql2 = mysql_connect(localhost, eweb, dbfun)
or die(Could not connect BR);

mysql_select_db(actionregs, $sql2);

$top_level = mysql_query(SELECT * FROM williams, $sql2)
or die(Could not do query BR);

print table style=\font-family:Verdana; font-size:10pt\ border=0
cellpadding=4 width=90%;

print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
width=100Owner/thth width=250Technology/ththSummary/th/tr;

while ($tabledata = mysql_fetch_array($top_level)) {
echo tr;
echo td$tabledata[0]/td;
echo td$tabledata[6]/td;
echo td$tabledata[2]/td;
echo td$tabledata[3]/td;
echo /tr;
}
print /table;
?

You may need to pull the table data array items into variables before
echoing them. Does this work?

HTH!
Jed

On the threshold of genius, Steve Gaas wrote:

 Can anyone tell me what's wrong with my code?  All I get output from this is
 the LAST row of data from my Database.  There are 2 rows, how do I make it
 pull data from all of the rows?  It's not going through the loop like it
 should  I need to be able to tell the mysql_fetch_array which row I want
 in each it iteration of the for loop.  The For loop increments counter, but
 there is no syntax to add $counter to the result_type.  The same goes with
 fetch_row...  
 
 What am I forgetting!!??  I know it's something simple
 
 
 ***
 
 $sql2 = mysql_connect(localhost, eweb, dbfun)
 or die(Could not connect BR);
 
 mysql_select_db(actionregs, $sql2);
 
 $top_level = mysql_query(SELECT * FROM williams, $sql2)
 or die(Could not do query BR);
 
 $sql2_results = mysql_fetch_array($top_level);
 $query_sql2_rows = mysql_num_rows($top_level);
 
 echo $query_sql2_rows;
 // echo's 2 rows
 
 print table style=\font-family:Verdana; font-size:10pt\ border=0
 cellpadding=4 width=90%;
 
 print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
 width=100Owner/thth width=250Technology/ththSummary/th/tr;
 
 for ($counter=0; $counter  $query_sql2_rows; $counter++) {
 $tabledata = mysql_fetch_array($top_level);
 echo td$tabledata[0]/td;
 echo td$tabledata[6]/td;
 echo td$tabledata[2]/td;
 echo td$tabledata[3]/td;
 echo /tr;
 }
 print /table;
 
 Thanks.
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL and Array's REALLY simple question but I'm not GETTING it .. Ugh..

2002-09-06 Thread Brad Bonkoski

It doesn't matter what variables you assign to fetch the data, one of 
the effects of mysql_fetch_array() is to increment the database result 
variable.  It does this without you even knowing it.  check out the 
mysql_data_seek() function to see how you can make the adjustments 
yourself.  i.e. mysql_data_seek($result, 0) would set you back at the 
beginning, record one.

-Brad

Steve Gaas wrote:
 OK, this works.. This is wonderful.. But I don't get it.. I assigned two
 separate variables to that array function..  I don't understand why this
 works now, but thanks a lot for the help. 
 
 I hope I don't inadvertently run into this again...
 
 -steve
 
 
 $sql2 = mysql_connect(localhost, eweb, dbfun)
   or die(Could not connect using default username and password LINE
 14 BR);
 
 mysql_select_db(actionregs, $sql2);
 
 $top_level = mysql_query(SELECT * FROM williams, $sql2)
   or die(Could not do query sql1 to find username. Link might not
 have been made. What's up? LINE 19 BR);
 
 // $sql2_results = mysql_fetch_array($top_level);
 $query_sql2_rows = mysql_num_rows($top_level);
 $rows = 0;
 echo $query_sql2_rows;
 
 
 print table style=\font-family:Verdana; font-size:10pt\ border=0
 cellpadding=4 width=90%;
 print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
 width=100Owner/thth width=250Technology/ththSummary/th/tr;
 
 for ($counter=0; $counter  $query_sql2_rows; $counter++) {
   $tabledata = mysql_fetch_array($top_level);
   echo td$tabledata[0]/td;
   echo td$tabledata[6]/td;
   echo td$tabledata[2]/td;
   echo td$tabledata[3]/td;
   echo /tr;
   }
 print /table;
 -Original Message-
 From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 06, 2002 3:34 PM
 To: Steve Gaas
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL and Array's REALLY simple question but I'm not
 GETTING it .. Ugh..
 
 Well, when you run the command:
 
 $sql2_results = mysql_fetch_array($top_level);
 
 The first time, it automatically increments the result...
 so you fetch the data bu do nothing with it...
 so when you get to your loop, you are already at the second entry in 
 your database..
 
 So, remove the first instance of that and see how it works..
 HTH
 -Brad
 
 Steve Gaas wrote:
 
 
Can anyone tell me what's wrong with my code?  All I get output from this
 
 is
 
the LAST row of data from my Database.  There are 2 rows, how do I make it
pull data from all of the rows?  It's not going through the loop like it
should  I need to be able to tell the mysql_fetch_array which row I
 
 want
 
in each it iteration of the for loop.  The For loop increments counter, but
there is no syntax to add $counter to the result_type.  The same goes with
fetch_row...  

What am I forgetting!!??  I know it's something simple


***

$sql2 = mysql_connect(localhost, eweb, dbfun)
  or die(Could not connect BR);

mysql_select_db(actionregs, $sql2);

$top_level = mysql_query(SELECT * FROM williams, $sql2)
  or die(Could not do query BR);

$sql2_results = mysql_fetch_array($top_level);
$query_sql2_rows = mysql_num_rows($top_level);

echo $query_sql2_rows;
// echo's 2 rows

print table style=\font-family:Verdana; font-size:10pt\ border=0
cellpadding=4 width=90%;

print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
width=100Owner/thth width=250Technology/ththSummary/th/tr;

for ($counter=0; $counter  $query_sql2_rows; $counter++) {
  $tabledata = mysql_fetch_array($top_level);
  echo td$tabledata[0]/td;
  echo td$tabledata[6]/td;
  echo td$tabledata[2]/td;
  echo td$tabledata[3]/td;
  echo /tr;
  }
print /table;

Thanks.



 

 
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL and Array's REALLY simple question but I'm not GETTING it.. Ugh..

2002-09-06 Thread Chulkee Sung

 $sql2_results = mysql_fetch_array($top_level);

I guess this must be in a loop otherwise your $sq12_results keep getting
overwitten; thus,
the last record will be shown at the end.


 $query_sql2_rows = mysql_num_rows($top_level);
 
 echo $query_sql2_rows;
 // echo's 2 rows
 
 print table style=\font-family:Verdana; font-size:10pt\ border=0
 cellpadding=4 width=90%;
 
 print tr bgcolor=\#c0c0c0\th width=50Action ID/thth
 width=100Owner/thth width=250Technology/ththSummary/th/tr;
 
 for ($counter=0; $counter  $query_sql2_rows; $counter++) {
 $tabledata = mysql_fetch_array($top_level);
 echo td$tabledata[0]/td;
 echo td$tabledata[6]/td;
 echo td$tabledata[2]/td;
 echo td$tabledata[3]/td;
 echo /tr;
 }
 print /table;
 
 Thanks.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
i18n Engineer
SCO, Inc.
www.sco.com (801) 765-4999 x5647
355 South 520 West, Suit 100, Lindon, Utah 84042 USA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Further Security Clarifications [was: Simple Security Clarifcation]

2002-08-21 Thread Andre Dubuc

My main files are located in /var/www/html (the 'DOCUMENT_ROOT' in Apache, 
according to php.ini). All sensitive files have been moved to 
'/var/www/secure', but now I can't access them! (According to php.ini, the 
PHP core 'doc_root=none').

I'm totally confused. If I understand this correctly, I want the files in 
'/var/www/secure' to be served through php scripts that reside in the 
individual files that call them up in /var/www/html. So, the problem seems to 
be that either Apache or PHP doesn't know/can't access them. So, what am I 
doing wrong here?

I've also added a FILes ~\.sht$ directive to refuse all .sht files 
(they're .inc's). How do get access for php to the secure file directory, and 
exclude the hackers?

At this point, I'm about as confused as I've ever been since beginning PHP. 
Any clarifications that will guide back into the fold, will be greatly 
appreciated!

Tia,
Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Further Security Clarifications [was: Simple Security Clarifcation]

2002-08-21 Thread Bob Irwin

Usually the first thing you want to do here is check your error log.  Most
of the time, this sort of thing will be a permissions problem, as the apache
server runs the PHP scripts as a user (ie you), that user needs to have the
ability to execute those files.  If you aren't sure, make the file owner you
and give the files 777 and work backwards from there.  Don't forget to check
the directory permissions as well as the file permissions.  From a hosting
point of view, its different and a little more complicated if you have
multiple users on the server, if it's just you though, it makes it a little
easier.  Take note of what the file permissions/ownership are befor eyou
change them (in case this isn't the problem).

Another simple things to check - make sure you're using the full path, ie,
/var/www/secure/filename.php

How are you including them?  I use a

require(/pathtofile/filename.php);

Works for me assuming I have the right permissions.

Best Regards
Bob Irwin
Server Admin  Web Programmer
Planet Netcom
- Original Message -
From: Andre Dubuc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 22, 2002 11:19 AM
Subject: [PHP] Further Security Clarifications [was: Simple Security
Clarifcation]


 My main files are located in /var/www/html (the 'DOCUMENT_ROOT' in Apache,
 according to php.ini). All sensitive files have been moved to
 '/var/www/secure', but now I can't access them! (According to php.ini, the
 PHP core 'doc_root=none').

 I'm totally confused. If I understand this correctly, I want the files in
 '/var/www/secure' to be served through php scripts that reside in the
 individual files that call them up in /var/www/html. So, the problem seems
to
 be that either Apache or PHP doesn't know/can't access them. So, what am I
 doing wrong here?

 I've also added a FILes ~\.sht$ directive to refuse all .sht files
 (they're .inc's). How do get access for php to the secure file directory,
and
 exclude the hackers?

 At this point, I'm about as confused as I've ever been since beginning
PHP.
 Any clarifications that will guide back into the fold, will be greatly
 appreciated!

 Tia,
 Andre

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

 Scanned by PeNiCillin http://safe-t-net.pnc.com.au/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Further Security Clarifications [was: Simple Security Clarifcation]

2002-08-21 Thread Andre Dubuc

Thanks Bob,

Got a 404: File not Found. Checked the ssl_error_log as suggested, and found 
a rather interesting entry:

No such file: /var/www/html/var/www/secure/test.php

Obviously it's goes to DOCUMENT_ROOT (pre-pending the/var/www/html) and adds 
what I've asked for. So, how do I tell it where to look, and not the default 
setting?

How am I including them? Well, most of the action occurs from the menu so 
it's:

a href=https://localhost/var/www/secure/test.php;Testing for Bugs/a
(I've also tried /secure/test.php

Any ideas what I'm messing up?

Tioa,
Andre


On Wednesday 21 August 2002 09:26 pm, Bob Irwin wrote:
 Usually the first thing you want to do here is check your error log.  Most
 of the time, this sort of thing will be a permissions problem, as the
 apache server runs the PHP scripts as a user (ie you), that user needs to
 have the ability to execute those files.  If you aren't sure, make the file
 owner you and give the files 777 and work backwards from there.  Don't
 forget to check the directory permissions as well as the file permissions. 
 From a hosting point of view, its different and a little more complicated
 if you have multiple users on the server, if it's just you though, it makes
 it a little easier.  Take note of what the file permissions/ownership are
 befor eyou change them (in case this isn't the problem).

 Another simple things to check - make sure you're using the full path, ie,
 /var/www/secure/filename.php

 How are you including them?  I use a

 require(/pathtofile/filename.php);

 Works for me assuming I have the right permissions.

 Best Regards
 Bob Irwin
 Server Admin  Web Programmer
 Planet Netcom
 - Original Message -
 From: Andre Dubuc [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, August 22, 2002 11:19 AM
 Subject: [PHP] Further Security Clarifications [was: Simple Security
 Clarifcation]

  My main files are located in /var/www/html (the 'DOCUMENT_ROOT' in
  Apache, according to php.ini). All sensitive files have been moved to
  '/var/www/secure', but now I can't access them! (According to php.ini,
  the PHP core 'doc_root=none').
 
  I'm totally confused. If I understand this correctly, I want the files in
  '/var/www/secure' to be served through php scripts that reside in the
  individual files that call them up in /var/www/html. So, the problem
  seems

 to

  be that either Apache or PHP doesn't know/can't access them. So, what am
  I doing wrong here?
 
  I've also added a FILes ~\.sht$ directive to refuse all .sht files
  (they're .inc's). How do get access for php to the secure file directory,

 and

  exclude the hackers?
 
  At this point, I'm about as confused as I've ever been since beginning

 PHP.

  Any clarifications that will guide back into the fold, will be greatly
  appreciated!
 
  Tia,
  Andre
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
 
  Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Further Security Clarifications [was: Simple Security Clarifcation]

2002-08-21 Thread Bob Irwin


 Thanks Bob,

 Got a 404: File not Found. Checked the ssl_error_log as suggested, and
found
 a rather interesting entry:

 No such file: /var/www/html/var/www/secure/test.php

Ahhh - ok - I thought you were including them internally from PHP.  You are
actually linking to the file being SERVED by the web server in HTML.   IN
this case, all you need to do is reference to it as
https://secureserveraddress/filename.php

First of all, we need to understand this. We have two seperate servers here,
the unix server that apache is running on and the apache server (this runs
PHP, the secure server etc) itself.

So... your normal website (served by the apache server) is at
http://mywebsite.com/files.php

BUT 'files.php' is located ON THE UNIX SERVER as /var/www/html/files.php

The /var/www/html/ is the UNIX path to the file.  The users who are using
your APACHE server to get file do not see this in anyway.  All they see is
what is in the root directory, ie, /var/www/html from http://mywebsite.com/,
this is exactly the same for the secure server, except the served files are
encrypted.

Success in this depends on what you are trying to do.  Are you trying to
secure files that contain information like your database passwords?  Or are
you just trying to run PHP scripts that produce HTML on  a secure server (so
that you can take credit card details from the remote users?).

If you are trying to hide scripts with important information (ie, passwords)
then running a secure server will not work.  They will STILL be available
from the internet, just at https://mywebsite/myfilewithapassword.php.  This
is not easily explained and I don't want to spend time going into it if its
not what you're after, but if this is what you are doing, let me know and
I'll help out.

If you are just trying to encrypted the data from the server to the user,
then you are doing the right thing, you just need to lose the
/var/www/secure/ in the https:// address.




 Obviously it's goes to DOCUMENT_ROOT (pre-pending the/var/www/html) and
adds
 what I've asked for. So, how do I tell it where to look, and not the
default
 setting?

 How am I including them? Well, most of the action occurs from the menu so
 it's:

 a href=https://localhost/var/www/secure/test.php;Testing for Bugs/a
 (I've also tried /secure/test.php

 Any ideas what I'm messing up?


 Scanned by PeNiCillin http://safe-t-net.pnc.com.au/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Further Security Clarifications [was: Simple Security Clarifcation]

2002-08-21 Thread Andre Dubuc

Thanks again Bob,

First off, the site is still being debugged off-line, and part of the 
problem, as you suggested is my confusion over UNIX SERVER and the Apache 
Server. OK. Got that.

What I'm trying to do:

Any file that utilizes $_SESSION variables accessed through username/password 
validation is accessed via https. This includes the original signup screen, 
logins, etc. The only place for http files are static files that display 
non-sensitive info, and that do not require db access.

 If you are trying to hide scripts with important information (ie,
 passwords) then running a secure server will not work.  They will STILL be
 available from the internet, just at 
https://mywebsite/myfilewithapassword.php. 

If the user is not logged in, they get an error message, and can go no 
further since  $_SESSION['authenticate'] must match their username/password. 
All I'm trying to do is to provide an extra layer of security by shoving all 
sensitive files into the 'secure' directory, outside of the DOCUMENT_ROOT 
(but I have no idea what 'doc_root' in PHP is for??).

From what I'm trying to accomplish, do I really need to bother setting the 
'secure' directory outside of the document_root? Wouldn't the setup I've done 
so far suffice? At any rate, I've tried just setting :

https://localhost/secure/test.php  -- it still gives a 404

Tia,
Andre



On Wednesday 21 August 2002 10:12 pm, Bob Irwin wrote:
  Thanks Bob,
 
  Got a 404: File not Found. Checked the ssl_error_log as suggested, and

 found

  a rather interesting entry:
 
  No such file: /var/www/html/var/www/secure/test.php

 Ahhh - ok - I thought you were including them internally from PHP.  You are
 actually linking to the file being SERVED by the web server in HTML.   IN
 this case, all you need to do is reference to it as
 https://secureserveraddress/filename.php

 First of all, we need to understand this. We have two seperate servers
 here, the unix server that apache is running on and the apache server (this
 runs PHP, the secure server etc) itself.

 So... your normal website (served by the apache server) is at
 http://mywebsite.com/files.php

 BUT 'files.php' is located ON THE UNIX SERVER as /var/www/html/files.php

 The /var/www/html/ is the UNIX path to the file.  The users who are using
 your APACHE server to get file do not see this in anyway.  All they see is
 what is in the root directory, ie, /var/www/html from
 http://mywebsite.com/, this is exactly the same for the secure server,
 except the served files are encrypted.

 Success in this depends on what you are trying to do.  Are you trying to
 secure files that contain information like your database passwords?  Or are
 you just trying to run PHP scripts that produce HTML on  a secure server
 (so that you can take credit card details from the remote users?).

 If you are trying to hide scripts with important information (ie,
 passwords) then running a secure server will not work.  They will STILL be
 available from the internet, just at
 https://mywebsite/myfilewithapassword.php.  This is not easily explained
 and I don't want to spend time going into it if its not what you're after,
 but if this is what you are doing, let me know and I'll help out.

 If you are just trying to encrypted the data from the server to the user,
 then you are doing the right thing, you just need to lose the
 /var/www/secure/ in the https:// address.

  Obviously it's goes to DOCUMENT_ROOT (pre-pending the/var/www/html) and

 adds

  what I've asked for. So, how do I tell it where to look, and not the

 default

  setting?
 
  How am I including them? Well, most of the action occurs from the menu so
  it's:
 
  a href=https://localhost/var/www/secure/test.php;Testing for Bugs/a
  (I've also tried /secure/test.php
 
  Any ideas what I'm messing up?
 
 
  Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] my PHP scripts hangs over a simple error

2002-07-08 Thread Joseph Szobody

Folks:

I just setup a Redhat/Apache/PHP box for testing purposes as I develop some PHP 
websites. The weird thing, is that the server takes FOREVER to respond when I make a 
very simple error in the code. On other servers it comes up with a 'Parse Error' 
message immediately, but not so with this box.

For example, I made a page with the following code:

?
echo I'm making a purposeful mistake;
echo The semi-colon is missing at the end of this line
echo Now I'm going on;
?

When I requested this page with my browser, I started my stopwatch and waited. The 
little blue progress bar started moving, but ever so slowly. 3 minutes later () I 
got the error message:

Parse error: parse error, expecting `','' or `';'' in /var/www/html/test.php on line 4

Now why didn't that come up immediately?! Any help is appreciated.

Thanks,

Joseph


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Increment alphabetical character (simple question)

2002-02-12 Thread Philip Hallstrom

Take a look at the ord() and chr() functions.  They'll do what you want.

On Tue, 12 Feb 2002, phantom wrote:

 How do I get the ASCII value of a character increment it by one...
 and convert back to a character.

 For example:

 I want to grab a char such as C and increment it to D ???




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Increment alphabetical character (simple question)

2002-02-12 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 How do I get the ASCII value of a character increment it by one...
 and convert back to a character.
 
 For example:
 
 I want to grab a char such as C and increment it to D ???

ord() and chr() will do this.

$oldchar = C;
$newchar = chr(ord($oldchar) + 1);

should be close to the mark. NB untested!!

-- 
David Robley
Temporary Kiwi!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP GuestBook - KISGB (Keep It Simple Guestbook) Version 3.0 Released

2001-12-30 Thread Gaylen Fraley

I have released version 3.0 of my KISGB.

KISGB is a PHP guestbook program that does not require sessions, cookies, or
an rdbms. Can be Public or Private through HTTP Authentication. Automated
install script, fully customizable, clean, and fast. Separate multiple
logging capabilty for tracking anything! Includes web-based password
protected Admin functionality, along with email notification, greeting, ip
logging, ip banning, bad word filter, smileys, allowable html tags in
comments, next/previous, etc. Themes for controlling appearance that allow
for background colors, images, animations, etc. Language support for Dutch,
English, French, German, Polish, Portuguese, Spanish, and Surinam.

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com/
PHP KISGB v3.0 Guest Book http://www.gaylenandmargie.com/phpwebsite/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Regular Expressions - A relatively simple search...

2001-09-06 Thread Mike Gifford

Hello,

I'm trying to replace a couple of lines of code:

$dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.'));
$extension = substr($userfile_name, $dotpos);

with a simpler regular expression:
$extension = eregi_replace( /.*, , $userfile_name);

However it isn't working..

What I'd like to do is to find the extension of a file name and place that in a 
variable.  So in 
'/home/mike/test.txt', I want to have the statement return 'txt'

Any help would be appreciated..

Mike
-- 
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] *IF* it was that simple

2001-05-17 Thread Tarrant Costelloe

Ok here is a simple IF statement I am messing around with, yet the parser is
sending back an error message of which I cannot see the cause:

Code:


?php
if ($name == tarrant  $username == costtar  $password ==
password);
{
print(Your are now logged in $name, thank you.);
}
else
{
print(Access Denied! IP Logged);
}
?

Error:


Parse error: parse error in C:\locahost\parser.php on line 16

Line 16 being the line which contains else (line 6).


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] *IF* it was that simple

2001-05-17 Thread Jeroen van Wolffelaar

Loose the ; after the if

Jeroen

Tarrant Costelloe [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ok here is a simple IF statement I am messing around with, yet the parser
is
 sending back an error message of which I cannot see the cause:

 Code:
 

 ?php
 if ($name == tarrant  $username == costtar  $password ==
 password);
 {
 print(Your are now logged in $name, thank you.);
 }
 else
 {
 print(Access Denied! IP Logged);
 }
 ?

 Error:
 

 Parse error: parse error in C:\locahost\parser.php on line 16

 Line 16 being the line which contains else (line 6).


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] super simple....... but!

2001-04-21 Thread andreas \(@work\)


try


HTMLBODY
?php
echo "starting...";
if ( mysql_connect("localhost","php","php") )
  { echo "ok"; }
else {
echo "error!";
}
?
/BODY/HTML



- Original Message -
From: "Francois Boucher" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 21, 2001 10:34 PM
Subject: [PHP-DB] super simple... but!


I wrote this code but nothing append.  If i look de code in the browser it's
stopping to starting!

What is the problme?


HTMLBODY
?php
echo "starting...";
if ( mysql_connect("localhost","php","php") )
  { echo "ok"; }
else
echo "error!";

?
/BODY/HTML

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=   Franois Boucher  =-
-=  [EMAIL PROTECTED]=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] super simple....... but!

2001-04-21 Thread andreas \(@work\)


try


HTMLBODY
?php
echo "starting...";
if ( mysql_connect("localhost","php","php") )
  { echo "ok"; }
else {
echo "error!";
}
?
/BODY/HTML



- Original Message -
From: "Francois Boucher" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 21, 2001 10:34 PM
Subject: [PHP-DB] super simple... but!


I wrote this code but nothing append.  If i look de code in the browser it's
stopping to starting!

What is the problme?


HTMLBODY
?php
echo "starting...";
if ( mysql_connect("localhost","php","php") )
  { echo "ok"; }
else
echo "error!";

?
/BODY/HTML

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=   Franois Boucher  =-
-=  [EMAIL PROTECTED]=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help with this simple problem

2001-03-22 Thread adam

i tryed it and it ended up having an error that was caused originally by a
lack of a $ on the 3rd line variable... after i fixed that it said wrong
perameter count for fopen() on the third line, and "Warning: Supplied
argument is not a valid File-Handle resource" for the remaining lines below
that in that block of code.

i'm sorry, i'm kinda new to this : (

"Stewart Taylor" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You need to copy the contents of the current file.
 Then recreate the file by writing the new message then writing back the
 original contents.

 e.g.
 $fname = basename($PHP_SELF). ".comment";
 $fsize = filesize($fname);
 fp = fopen(basename($fname));
 $data = fread($fp,fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 -Stewart

 -Original Message-
 From: adam [mailto:[EMAIL PROTECTED]]
 Sent: 22 March 2001 11:17
 To: [EMAIL PROTECTED]
 Subject: [PHP] please help with this simple problem


 i am coding a simple script to post a text area into a file. it works, but
 it posts it at the bottom and i wanted to have it post to the top of the
 text already there..

 here's a snip of the important part of the script:

 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  fwrite ($fp, $message);
  fclose ($fp);
  }

 any help would be much appreciated



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help with this simple problem

2001-03-22 Thread rui


you haven't specified the open type (a = append, w = write, r = read only , etc
etc)

solution

$fp=fopen(basename($fname), "a");

just to match your example.

On 22-Mar-2001 adam wrote:
 i tryed it and it ended up having an error that was caused originally by a
 lack of a $ on the 3rd line variable... after i fixed that it said wrong
 perameter count for fopen() on the third line, and "Warning: Supplied
 argument is not a valid File-Handle resource" for the remaining lines below
 that in that block of code.
 
 i'm sorry, i'm kinda new to this : (
 
 "Stewart Taylor" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You need to copy the contents of the current file.
 Then recreate the file by writing the new message then writing back the
 original contents.

 e.g.
 $fname = basename($PHP_SELF). ".comment";
 $fsize = filesize($fname);
 fp = fopen(basename($fname));
 $data = fread($fp,fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 -Stewart

 -Original Message-
 From: adam [mailto:[EMAIL PROTECTED]]
 Sent: 22 March 2001 11:17
 To: [EMAIL PROTECTED]
 Subject: [PHP] please help with this simple problem


 i am coding a simple script to post a text area into a file. it works, but
 it posts it at the bottom and i wanted to have it post to the top of the
 text already there..

 here's a snip of the important part of the script:

 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  fwrite ($fp, $message);
  fclose ($fp);
  }

 any help would be much appreciated



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] please help with this simple problem

2001-03-22 Thread Stewart Taylor


Sorry I missed "w+" from the fopen function

$fname = basename($PHP_SELF). ".comment";
$fsize = filesize($fname);
$fp = fopen(basename($fname),"w+");   --- added "w+"
$data = fread($fp,$fsize);
fwrite($fp,$message);
fwrite($fp,$data);
fclose($fp)

-Stewart

-Original Message-
From: adam [mailto:[EMAIL PROTECTED]]
Sent: 22 March 2001 12:00
To: [EMAIL PROTECTED]
Subject: Re: [PHP] please help with this simple problem


i tryed it and it ended up having an error that was caused originally by a
lack of a $ on the 3rd line variable... after i fixed that it said wrong
perameter count for fopen() on the third line, and "Warning: Supplied
argument is not a valid File-Handle resource" for the remaining lines below
that in that block of code.

i'm sorry, i'm kinda new to this : (

"Stewart Taylor" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You need to copy the contents of the current file.
 Then recreate the file by writing the new message then writing back the
 original contents.

 e.g.
 $fname = basename($PHP_SELF). ".comment";
 $fsize = filesize($fname);
 fp = fopen(basename($fname));
 $data = fread($fp,fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 -Stewart

 -Original Message-
 From: adam [mailto:[EMAIL PROTECTED]]
 Sent: 22 March 2001 11:17
 To: [EMAIL PROTECTED]
 Subject: [PHP] please help with this simple problem


 i am coding a simple script to post a text area into a file. it works, but
 it posts it at the bottom and i wanted to have it post to the top of the
 text already there..

 here's a snip of the important part of the script:

 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  fwrite ($fp, $message);
  fclose ($fp);
  }

 any help would be much appreciated



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help with this simple problem

2001-03-22 Thread adam

it works now, only it's earasing everything and then writing to the file.
i think we have almost got this figured out. here's what the code looks like
for the entire tag...
---

?
if ($message)
 {
 /* uncomment the next two lines to strip out html from input */
 $name = strip_tags($name);
 /* $message = strip_tags($message); */
 $message = ereg_replace("\r\n\r\n", "\nP", $message);
 $date = date("l, F j Y, h:i a");
 $message = "font size=2 face=verdanaba href=mailto:$email$name/a
/bfont size=1 -- $date/font\n
 blockquote\n
  $message\n
 /blockquote/font\nhr noshade color=white size=1 width=100%\n";

 $fname = basename($PHP_SELF) . ".comment";
 $fsize = filesize($fname);
 $fp = fopen(basename($fname),"w+");
 $data = fread($fp,$fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 }
@readfile(basename(($PHP_SELF . ".comment")));
?






""adam"" [EMAIL PROTECTED] wrote in message
99cmfj$mai$[EMAIL PROTECTED]">news:99cmfj$mai$[EMAIL PROTECTED]...
 i am coding a simple script to post a text area into a file. it works, but
 it posts it at the bottom and i wanted to have it post to the top of the
 text already there..

 here's a snip of the important part of the script:

 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  fwrite ($fp, $message);
  fclose ($fp);
  }

 any help would be much appreciated



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help with this simple problem

2001-03-22 Thread adam

it works now, only it's earasing everything and then writing to the file.
i think we have almost got this figured out. here's what the code looks like
for the entire tag...
---

?
if ($message)
 {
 /* uncomment the next two lines to strip out html from input */
 $name = strip_tags($name);
 /* $message = strip_tags($message); */
 $message = ereg_replace("\r\n\r\n", "\nP", $message);
 $date = date("l, F j Y, h:i a");
 $message = "font size=2 face=verdanaba href=mailto:$email$name/a
/bfont size=1 -- $date/font\n
 blockquote\n
  $message\n
 /blockquote/font\nhr noshade color=white size=1 width=100%\n";

 $fname = basename($PHP_SELF) . ".comment";
 $fsize = filesize($fname);
 $fp = fopen(basename($fname),"w+");
 $data = fread($fp,$fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 }
@readfile(basename(($PHP_SELF . ".comment")));
?








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Walking Through Array Values, Simple?

2001-01-11 Thread JB

Well... I think I probably owe most of the people on this list some serious cash in 
consulting fees by now. But we're opensource, so I guess I'm off the hook, right? =)

Anyways, another question for you people. I'm on the last leg of designing this 
e-commerce site. All I have left to design is the shopping cart.

How I've set it up to add items is quite simple. The data is posted add to cart and 
stored like this:

$cart[$prodid] = $my_qty;

cart is the registered variable in my sessions. prodid is the product id, and my_qty 
is the quantity. now say a user wants 2 items with the id of 111 and 1 item with the 
id of 898. it should have the data stored as so:

$cart[111] = 2
$cart[898] = 1

now.. had i been more experienced with arrays, this would not be hard. but.. i'm not 
sure when the user goes to check out how to walk through the data. 

basically i need to pull out each index (which is the product id number) as it's own 
variable and the qty that corresponds with it as it's own variable.

From there, although irrelevant to what the array, there variables will be passed in 
a mysql query to get the info to display in the basket (ie- name, description, price).

so, i figure i am going to have to loop the array to extract the info. this would 
probably be best since i'm going to be making seperate queries on it as well.

loop until all indexes have been accounted for---
get prod id and qty from next instance in array, into $prodid and $qty
query the db with the prodid
display results
end loop -- 

so.. i'm fine with the query and display, i just need to know how to get each instance 
into a variable in a loop.

thanks a lot




<    1   2