[PHP] RE: [PHP-WIN] HELP! with PHP extension
Hi all, Here is the situation. I have Windows 2000 SP2, IIS5 running PHP 4.1.1 using CGI. My PHP folder is C:\php Extension Folder is: C:\php\extension PHP.INI file: extention_dir = C:\php\extension\ Are you sure the foldername is extension? Just asking you to doublecheck since the default would be extensions. /Martin -- 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] bug in str_replace() ?
Bug in str_replace(), PHP 4.0.6 $text = hello world; $out = str_replace( , ,$text); echo $out; Expected output: hello world Actual output: hello world Of course, this is what happens if str_replace() does replacements on input, but not on the soon-to-be output it is working on. Is this to be expected, or would it be ok to modify the functionality of str_replace()? /Martin -- 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] how to decrease serverload easily?
We're developing a web platform based on PHP, running under Apache. We have realized that we need a way of split up the serverload to multiple machines if it gets too high. We've come up with PHP solutions to the problem but are looking for better ones, especially in Apache configuration. Is there any easy way of doing this? Anyone have previous experience? Software versions and OS'es is of no concern, we'll use what's required. /Martin -- 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] what directory should put the php.ini?
Hi all, I have just rename the php.ini-dist to php.ini from the installation directoy but am not sure where to place it in order for php to rea,, any help?? thanks What OS are you running PHP on? /Martin -- 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] Get Info From Database Without Refreshing the Page! Pretty Neat!
you could load all nessecary data once and put in a javascript array or something, not sure i understand what you have done here and what's so special about it tho /Martin I used a Microsoft Object Control to get data from the database and display it on the page without refreshing the page!This saves alot of browsing time ! Now there is a little bit of a problem ! I dont know if anyone have done this before exept me and microsoft. I did it in php microsoft did it in asp! Microsoft can get the data without refreshing the page and use next , previous buttons, I can't get the buttons thingy's to work ! If anyone know how to do this please leave some info! I know how to do it by refreshing the page but if i can do it without refreshing it would really kick some ass! Coenraad Steenkamp -- 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] how to set session expiration
hello everyone, how can i set the expiration of my sessions with or without the cookies enabled? say if a user idles for some time, the session will now expire. TIA! jessie I'm using a solition that's something like this: first, each time a user logs in to the site, a timestamp is added to his user entry in the database. then, at top of each page view, you call a function like this $username=getUserName($db_handle,$sess_id); //$sess_id is my own created 30 char-random letter string if(!$username) { echo You're not logged in, die!; die; } This function returns the username assigned with the current session id, and also checks wether last timestamp is older than X minutes, if it's not, it updates it, if it is, it throws the user out. Here's the function (60*20 gives user max 20 minutes time of idling, then he/she must log in again): --snip-- function getUserName($db,$sessionID) { $query_idd = mysql_query(SELECT * FROM tblUsers WHERE ID='$sessionID', $db); if (mysql_num_rows($query_idd) == 0) { return ; } else { $row = mysql_fetch_array($query_idd); $diff = time() - $row[lastlogin]; if ($diff (60*20) ) { echo Connection timed outbr; die; } $newstamp = time(); $updatestamp = mysql_query(UPDATE tblUsers SET lastlogin='$newstamp' WHERE username='.$row[username].', $db); return $row[username]; } } --snip-- and here's the function i use to create a random id: function getRandomID($db,$table) { srand((double)microtime()*100); do { $b=; for($a=0; $a30; $a++) { $tmp=rand(0,2); switch($tmp) { case 0: $b.=chr(rand(97,122)); break; //a-z case 1: $b.=chr(rand(65, 90)); break; //A-Z case 2: $b.=chr(rand(48, 57)); break; //0-9 } } } while (mysql_query(SELECT * FROM .$table. WHERE ID='$b',$db)===TRUE); return $b; } hope this helps! /Martin -- 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] how to set session expiration
oh, i forgot to mention, i create new session id on each login, and pass it on in the url, something like /page.php?sess=$sess_id If you want, you could also assign the user's ip with the current session for a little higher security, i havent bothered as i feel this is safe enough. /Martin -Original Message- From: Martin Lindhe Sent: Wednesday, September 12, 2001 5:34 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] how to set session expiration hello everyone, how can i set the expiration of my sessions with or without the cookies enabled? say if a user idles for some time, the session will now expire. TIA! jessie I'm using a solition that's something like this: first, each time a user logs in to the site, a timestamp is added to his user entry in the database. then, at top of each page view, you call a function like this $username=getUserName($db_handle,$sess_id); //$sess_id is my own created 30 char-random letter string if(!$username) { echo You're not logged in, die!; die; } This function returns the username assigned with the current session id, and also checks wether last timestamp is older than X minutes, if it's not, it updates it, if it is, it throws the user out. Here's the function (60*20 gives user max 20 minutes time of idling, then he/she must log in again): --snip-- function getUserName($db,$sessionID) { $query_idd = mysql_query(SELECT * FROM tblUsers WHERE ID='$sessionID', $db); if (mysql_num_rows($query_idd) == 0) { return ; } else { $row = mysql_fetch_array($query_idd); $diff = time() - $row[lastlogin]; if ($diff (60*20) ) { echo Connection timed outbr; die; } $newstamp = time(); $updatestamp = mysql_query(UPDATE tblUsers SET lastlogin='$newstamp' WHERE username='.$row[username].', $db); return $row[username]; } } --snip-- and here's the function i use to create a random id: function getRandomID($db,$table) { srand((double)microtime()*100); do { $b=; for($a=0; $a30; $a++) { $tmp=rand(0,2); switch($tmp) { case 0: $b.=chr(rand(97,122)); break; //a-z case 1: $b.=chr(rand(65, 90)); break; //A-Z case 2: $b.=chr(rand(48, 57)); break; //0-9 } } } while (mysql_query(SELECT * FROM .$table. WHERE ID='$b',$db)===TRUE); return $b; } hope this helps! /Martin -- 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] How to pass variables to php functions from url's?
I need to solve the following problem, but I can't figure out how: Let's assume we have a server called www.test.com When a user access http://www.test.com/path/username, I want a php script to execute, as if the url entered was http://www.test.com/path.php?value=username. I'm running PHP 4.0.6 on Apache 1.3.20. I've looked at both PHP and Apache documentation about this, but i havent found any information or examples on how this could be solved, so I'm asking the question here in hope for help. Thanks! /Martin Lindhe -- 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]
SV: [PHP] How to pass variables to php functions from url's?
Try method=GET in Your form to submit if You want to url be like url?var=value. Or php function header( 'Location: ' .rul . 'var=value' ); No, i'm not using a form, and i cant execute any php scripts whatsoever if there are no php script specified to execute. That's all You need I hope. Sorry but Your question is not good explained. Please read my mail again, I tried to described my problem as good as possible. Martin Lindhe wrote: I need to solve the following problem, but I can't figure out how: Let's assume we have a server called www.test.com When a user access http://www.test.com/path/username, I want a php script to execute, as if the url entered was http://www.test.com/path.php?value=username. I'm running PHP 4.0.6 on Apache 1.3.20. I've looked at both PHP and Apache documentation about this, but i havent found any information or examples on how this could be solved, so I'm asking the question here in hope for help. Thanks! /Martin Lindhe -- 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] Re: How to pass variables to php functions from url's?
Hi Martin, Take a look at the Apache mod_rewrite docs. http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html Thanks alot! I made a similar solution which works RewriteEngine on RewriteRule ^/x/(.*) http://www.server2.com/users/$1; takes www.server1.com/x/martin to www.server2.com/users/martin Great! I'm also wondering wether i can hide this redirect, as of now the redirected url is shown to the user, but i want this redirect to be unknown, so user is visually on same server. I figure i can solve this with a little script a frame or something, but it's not a good solution, is it possible to do in any other way? /Martin -- 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] Re: How to pass variables to php functions from url's?
I think I remember doing it a while ago. But I think you need to use mod_alias instead. Take a look here: http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect The Redirect/RedirectMatch/RedirectTemp might do it. RedirectMatch permanent ^/x/(.*) http://www.test.com/y/test.php?val=$1; seems to work somewhat equal to the RewriteRule, it also visibly show the redirect url. Thanks anyway /Martin -- 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] Re: How to pass variables to php functions from url's?
useful link: http://www.apache.org/docs-2.0/misc/rewriteguide.html RewriteEngine on RewriteRule ^/x/(.*)http://www.server2.com/users/$1 [P] Hm, what does the [P] do? I played around a bit and figured that a [T] does the trick for me, thanks! /Martin -- 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]