[PHP-DB] Storing IP into DB

2003-01-30 Thread web man

Hi,
I wondered if anyone could help me.
I would like to store the user IP only once
per multiple visits.
The code below store the user IP on every visit
which is not my intention.
Please I would like to have the IP stored at once upon
repetitive visits of the user.
Thank
Below is my code

?

$ip_address = getenv (REMOTE_ADDR); 
$the_date = date(Y-m-D);
$connect = mysql_connect(localhost, user, pass) or die(Cant Connect!);
mysql_select_db(ipvisits)or die(Cant Connect To Database);
mysql_query(INSERT into visitorsips (ip, date) VALUES ('$ip_address', '$the_date'));
mysql_close($connect);

?




-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] Storing IP into DB

2003-01-30 Thread web man

Hi,
I wondered if anyone could help me.
I would like to store the user IP only once
per multiple visits.
The code below store the user IP on every visit
which is not my intention.
Please I would like to have the IP stored at once upon
repetitive visits of the user.
Thank
Below is my code

?

$ip_address = getenv (REMOTE_ADDR); 
$the_date = date(Y-m-D);
$connect = mysql_connect(localhost, user, pass) or die(Cant Connect!);
mysql_select_db(ipvisits)or die(Cant Connect To Database);
mysql_query(INSERT into visitorsips (ip, date) VALUES ('$ip_address', '$the_date'));
mysql_close($connect);

?




-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] Connecting to Mysql Server

2003-01-29 Thread web man

Hi,

How can I change the default connecting port using php script.

Thanks



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] Basic HTTP authentication

2003-01-24 Thread web man
hi GUys
Please this may sound too elementary but 
I need your help.
How can I configure apache httpd.con file in
order to support the use of Basic HTTP authentication.
I am using apache 1.3.26 on windows.
Thanks 



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] Basic HTTP authentication

2003-01-24 Thread web man
hi GUys
Please this may sound too elementary but 
I need your help.
How can I configure apache httpd.con file in
order to support the use of Basic HTTP authentication.
I am using apache 1.3.26 on windows.
Thanks 



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] using Flat File

2003-01-22 Thread web man

Hi,

I have posted my question to this list before but I did not get a help that I was 
expected.

All I wanted to do is to give access for the users to view a page in which the below 
code is embedded. The user will enter his/her username and password.

But the code is not working.

I don't know what to think. 

I need your help guys. Don't let me die on this code 

?php

 $auth = false;
 if (isset( $PHP_AUTH_USER )   isset($PHP_AUTH_PW)) {


 $filename = 'c:\\php_data\\file.txt';
 $f = @fopen($filename, r);
  if ($f != FALSE)
  {$a = @fread($f, filesize($filename));
 fclose($f);
  }
  else
  {
   echo Could not open file;
  }



 $lines = explode ( \n, $file_contents );



 foreach ( $lines as $line ) {

 list( $username, $password ) = explode( ':', $line );

 if ( ( $username == $PHP_AUTH_USER ) amp;amp;
  ( $password == $PHP_AUTH_PW ) ) {




 $auth = true;
 break;

 }
 }

 }

 if ( ! $auth ) {

 header( 'WWW-Authenticate: Basic realm=Private' );
 header( 'HTTP/1.0 401 Unauthorized' );
 echo 'Authorization Required.';
 exit;

 } else {

 echo 'PYou are authorized!/P';
 }

 ?






-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] using Flat File

2003-01-21 Thread web man

Hi Guys,

i wondered if there any assistance you could do for me on this code.

I have called on God many times to assist me but He did not respond.

I hope you would.

What I am trying to do is to allow certain users to view a certain page . I stored 
their names and passwords in a file.txt

But the is not working is there any help??

?php  

$auth = false;  
if (isset( $PHP_AUTH_USER ) amp;amp; isset($PHP_AUTH_PW)) {  


$filename = 'c:\\php_data\\file.txt'; 
$f = @fopen($filename, r);  
 if ($f != FALSE)  
 {$a = @fread($f, filesize($filename)); 
fclose($f);  
 }  
 else  
 {  
  echo Could not open file;  
 }  



$lines = explode ( \n, $file_contents );  



foreach ( $lines as $line ) {  

list( $username, $password ) = explode( ':', $line );  

if ( ( $username == $PHP_AUTH_USER ) amp;amp;  
 ( $password == $PHP_AUTH_PW ) ) {  

 
   

$auth = true;  
break;  

}  
}  

}  

if ( ! $auth ) {  

header( 'WWW-Authenticate: Basic realm=Private' );  
header( 'HTTP/1.0 401 Unauthorized' );  
echo 'Authorization Required.';  
exit;  

} else {  

echo 'PYou are authorized!/P';  
}  

?  





-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now