• I am trying to set up a login procediure and adjusted the code in something I picked up on the Net. So, now I have a file that connects to the server and checks if the login info is valid. So far, so good. What I can′t understand is how does that php file know where to get the input data from, as there is nothing in it pointing to the html file where the actual login form is (inside the index.html). I guess that I have to change that code to point it to the new php file. Is that it?

    Help…

Viewing 4 replies - 1 through 4 (of 4 total)
  • What I can′t understand is how does that php file know where to get the input data from

    Go through your database tables and see if you have such info over there.

    Thread Starter qim

    (@qim)

    Yes the table in the database is fine. My registry setup workd fine.
    Right now I want to connect what needs to be connected as far as the different files are converned. I came to the conclusion that it is the other way round: i have to tell the html file where the vivitor’s input is created to Post the data to the other file, which apparently and surprisimngly does not need to know where the data is comimng from…

    It is like this, yes?

    Thread Starter qim

    (@qim)

    I’ve managed to get to work, partly but I am stuck on a part of the code I picked up: I’ve introduced echoes “so far” and “so good” and they print out but then I get a white page. I’m womdering if the code $count=mysql_num_rows($result); must also reflect something in my table as I have not changed that.

    // Mysql_num_row is counting table row
     $count=mysql_num_rows($result);
    
    echo "so good";
    
    // If result matched $user and $password, table row must be 1 row
    
    if($count==1)
    
    {
    
    // Register $username, $password and redirect to file "login_success.php"
     session_register("user");
     session_register("password");
    header("/Pinto/login_success.php");
     }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thread Starter qim

    (@qim)

    well, i’ve now changed $result to $active in the line
    $count=mysql_num_rows($result);
    which is the field that changes from 0 to 1 when the visitor confirms the email address, and now I get as far as wrong name and password.

    I will paste the code again as it seems to have been truncated above

    $sql="SELECT * FROM $tbl_name WHERE user='$user' and password='$password'";
     $result=mysql_query($sql);
    
    echo "So far";
    
    // Mysql_num_row is counting table row
     $count=mysql_num_rows($active);
    
    echo "so good";
    
    // If result matched $user and $password, table row must be 1 row
    
    if($count==1)
    
    {
    
    // Register $username, $password and redirect to file "login_success.php"
     session_register("user");
     session_register("password");
    header("/Pinto/login_success.php");
     }
    
     else {
     echo "Wrong Username or Password";
     }
     ?>
    
     </body>
    </html>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Login procedure’ is closed to new replies.