Re: [PHP] session_destroy AND reload a page

2007-11-25 Thread Chris
Ronald Wiplinger wrote: If my user wants to logout, I want that the session will be destroyed and that he must start with the first page again (index.php) and a new session. Whatever I try he always gets the old sessions or he does not come to the first page. What code do you have? -- Postgre

[PHP] session_destroy AND reload a page

2007-11-25 Thread Ronald Wiplinger
If my user wants to logout, I want that the session will be destroyed and that he must start with the first page again (index.php) and a new session. Whatever I try he always gets the old sessions or he does not come to the first page. How can I solve that? bye Ronald -- PHP General Mailing L

Re: [PHP] How to ask "if private IP"?

2007-11-25 Thread mike
i did this once $ip = sprintf("%u",intval(ip2long($_SERVER['REMOTE_ADDR']))); and then did checks to see if it was between the ranges for 10.0.0.0, 192.168 etc... apparently i lost that code. but it was pretty simple. http://www.faqs.org/rfcs/rfc1918.html 10.0.0.0- 10.255.255.255

RE: [PHP] How to ask "if private IP"?

2007-11-25 Thread Andrés Robinet
$remoteIP = $_SERVER['REMOTE_ADDR']; $parts = explode('.', $remoteIP); // Get IP bytes in an array $isPrivateIP = false; /* single class A */ $classA = $parts[0] == 10; /* 16 contiguous class Bs */ $classB = $parts[0] == 172 && $parts[1] >= 16 && $parts[1] <= 31; /* 256 contiguous class Cs */ $cla

[PHP] How to ask "if private IP"?

2007-11-25 Thread Ronald Wiplinger
I use $aa=$_SERVER["REMOTE_ADDR"]; and if(($aa=="192.168.2.108") || ($aa=="192.168.2.34")) { $aa="61.64.101.101";// for testing put in a public IP } However, I would like to cover all private IPs (192.168.x.x and 10.x.x.x and 172.??.x.x). How can I do that simple? bye Ronald

Re: [PHP] URL Parsing...

2007-11-25 Thread Chris
Richard Heyes wrote: well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? How does this: /\.cfm$/ take into account that? $ in regex's means 'end of

Re: [PHP] Performance question for table updating

2007-11-25 Thread Chris
Eventually, I wind up with a query similar to: UPDATE table_01 SET field_a = 'New value here', updated=CURDATE() WHERE primary_key=12345 Even though you've solved it one way to work out the problem here would be to change it to a select query (unfortunately mysql can't explain

Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote: >> well if you take a string (filename) and wish to change the end of it >> somone >> then I don't think str_replace() is the correct function. what's to >> say a script >> doesn't exist called 'my.cfm.php'? > > How does this: > > /\.cfm$/ > > take into account that? WTF >

Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes
well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? How does this: /\.cfm$/ take into account that? -- Richard Heyes +44 (0)800 0213 172 http://www.webs

Re: [PHP] Adv. photo scripts

2007-11-25 Thread PHP-General
Thanks for all the replys. I should have warned you in advance that I am new ;) "Casey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Nov 24, 2007 11:16 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: On Sun, 2007-11-25 at 01:59 -0500, PHP-General wrote: > Not sure if I'm at

Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote: >> one of these should give you something to go on: >> >> echo preg_replace('\.cfm$', '-meta.cfm', >> parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n"; >> echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), >> "\n"; >> echo preg_replace('\.cfm$', '-met

Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes
one of these should give you something to go on: echo preg_replace('\.cfm$', '-meta.cfm', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n"; echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), "\n"; echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']), "