Ok, how to fix it? I'm confused by what you said. It outputs: Resource id #1dfg then same screwed up login.php. Why can't it open it correctly?
EDIT: I take that back, it did nothing to login.php. I just left up the bad copy on accident.
Ok, how to fix it? I'm confused by what you said. It outputs: Resource id #1dfg then same screwed up login.php. Why can't it open it correctly?
EDIT: I take that back, it did nothing to login.php. I just left up the bad copy on accident.
OK, try this for register.php (of course, edit to your liking, but I highlighted the function parts that will read and write the file with success)
Apparently, there was an issue with the fopen command using the mode r+. When I tried using just r, it read the file but did not write to it. The above code is tested and should work (as long as the file to be written to has the correct permissions on it).Code:$user=$_POST['user']; $pass=$_POST['pass']; $email=$_POST['email']; $data2="elseif(\$user==\"$user\" && \pass==\"$pass\") { session_start(); \$_SESSION['user']='$user'; \$_SESSION['pass']='$pass'; \$_SESSION['logged']='yes'; \$_SESSION['email']='$email'; else {";$data = file_get_contents('login.php'); $data = str_replace("else {", $data2, $data); $newfile = fopen('login.php', 'w'); fwrite($newfile, $data); fclose($newfile);print("dfg");
Hope this helps.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Wow, it works perfectly. Thank you very much thetestingsite, I'm sure I'll be back with a new problem soon.
Tim
Bookmarks