Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Registration

  1. #11
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    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.

  2. #12
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    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)

    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");
    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).

    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

  3. #13
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Wow, it works perfectly. Thank you very much thetestingsite, I'm sure I'll be back with a new problem soon.

    Tim

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •