|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Authentication
I have a script that is working perfect. The script contains a form which loads information into the text area from a text file when you first goto it. Then you can make changes to the form and submit the changes to the text file.
It works perfect until I add any Authentication (login) script to it. It will load fine but when I hit submit, I get kicked out of the system without the changes taking affect and I must login again. I have tried three popular scripts today without any luck. Please see the code below and see what may be kicking me out and is there a way to correct it? <?php //require_once("adminOnly.php"); if(isset($_POST["company"])) { $file = "company.txt"; $fp0 = fopen("$file","w"); fputs($fp0, $_POST["company"]); fclose($fp0); } $stuff1 = implode("",file("company.txt")); ?> <body> <form method=post> <p><font face="Arial, Helvetica, sans-serif">Company Name:</font></p> <p> <textarea name="company" cols="30" rows="1"> <?php echo (htmlspecialchars(stripslashes($stuff1))); ?> </textarea> </p> <input type=submit> </form> </body> |
|
#2
|
|||
|
|||
|
RE: Authentication
for one, i don't see that your form has any action
|
|
#3
|
|||
|
|||
|
RE: Authentication
U got to open it with w+, don't U? w will only delete the content of the file, the filesize will be set to zero!
and yes ur form needs an action like 'action="test.php"' |
|
#4
|
|||
|
|||
|
RE: Authentication
w or w+ are identical except that w+ will read as well as write.
|
|
#5
|
|||
|
|||
|
RE: Authentication
How bout letting us see adminOnly.php? More than likely something there is screwing with the process.
If you don't include an action in your forms, in HTML 4, at least, they submit to themselves via GET (actually, it might be post, I can't remember). That should not be the problem, although you should fix it for the sake of clean programming. |
|
#6
|
|||
|
|||
|
RE: Authentication
maybe you should learn from that scripts, or read authentification tutorial, and code in yourself?
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Authentication |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|