<? setcookie("cookie", "Job Postings Psyc... Created by Kondwani Mkandawire", time()+3600); session_start(); session_register("MySession"); $counter=0;?>
<?php $file = fopen(basename($PHP_SELF), "r+"); if((SomeCondition is Satisfied)&&($counter < 4)){ echo '<form name="formName" action = "ThisSamePHPFile.php" method="post">'; if(empty($verif)){ Display Some message... $counter++; fputs($file, "<?\r\nsetcookie(\"cookie\", \"Created by Kondwani Mkandawire\", time()+3600);\n"); fputs($file, "session_start();\n"); fputs($file, "session_register(\"MySession\");\n"); fputs($file, "\$counter=$counter;?>\r\n"); } else{ Display SomeOther message... $counter++; fputs($file, "<?\r\nsetcookie(\"cookie\", \"Created by Kondwani Mkandawire\", time()+3600);\n"); fputs($file, "session_start();\n"); fputs($file, "session_register(\"MySession\");\n"); fputs($file, "\$counter=$counter;?>\r\n"); } } else{ reset counter to 0 destroy session... } I want this set up such that given someone hits the close button on the browser, the counter is set to 0... Coz at the moment if someone gets fed up of trying and closes the browser, the next person has less than 4 attempts to login in... Any idea of how I can go about using this sessions idea coupled with the self modifying code to achieve this? I can't exactly stick in an: if(session_is_registered) statement, coz it appears as though the session is restarted every time the code is modified.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php