[PHP] Re: Help!

2001-12-11 Thread Raivo

I generate random key and put it on the hidden input. When I get submit from
client, I compare, is this key actual or old.

?php
session_start();
session_register('key');

if ($user_key == $key){
 echo Normal submitbr;
}else{
 echo Refresh;
}

mt_srand((double)microtime()*100);
$key = md5(mt_rand(0,999));

$html  = FORM action=\test.php\ method=\post\\n.
   INPUT type=\text\ name=\text\ /br\n.
   INPUT type=\submit\ /\n.
   INPUT type=\hidden\ name=\user_key\ value=\$key\ /\n.
   /FORM\n;
echo $html;
?

Raivo Tali

Ryan Adorable [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

I created a poll program for my homepage. When i vote some field in my
database gets incremented, but after successfully voting when i clicked on
reload/refresh of my browser the said field is also incremented. How can I
fix/avoid this problem?

Hoping for a reply.
Thanks

 Ryan

 _
 Sign up for FREE email from FloppyDisk at http://www.floppydiskonline.com



-- 
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: Redirect + SESSION question!!!

2001-12-11 Thread Raivo

I am same problem. I use PHP4.0.6, Apache 1.3.20 and WindowsNT.
My code looks like this:

ob_start();
session_start();
session_register('is_logon');
if (!$HTTP_SESSION_VARS['is_logon')
{
header('Location: logon.php');
ob_end_flush();
die();
}

If I try to execute this code, I get Dr.Watson from Apache ???

Raivo Tali



Mehmet Kamil Erisen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello All,
 I have switched hosting companies.  previous server was
 php4.04pl1 now I am on a server that is php4.06.

 I have a file (functions.php) that stores all my SESSION
 and other functions.  A Header file, that has the general
 feel and look of the site. In brief most of my pages have
 include(functions.php);
 include(header.php);

 I also use the Header(Location: mysite.com) kind of
 functions a lot.

 Well, it worked fine in the prev server, now it does not. I
 read the documentation
 (http://download.php.net/manual/en/function.header.php)
 , and it suggests to use of the ob_start() and
 ob_end_clean() etc...  I used those. I can redirect, but
 now, my SESSION does not work!!!

 Anybody had a similar experience? Please help...
 thanks.
 erisen

 __
 Do You Yahoo!?
 Check out Yahoo! Shopping and Yahoo! Auctions for all of
 your unique holiday gifts! Buy at http://shopping.yahoo.com
 or bid at http://auctions.yahoo.com



-- 
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]