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.
Printable View
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.
Wow, it works perfectly. Thank you very much thetestingsite, I'm sure I'll be back with a new problem soon. :p
Tim