-1

I've created my website with a registration form, that validates and inserts information into a database at the end. The thing I need to do now is have the user be able to access the account he or she registered with. I'm as new as they come to user registration websites so I don't really know what I'm supposed to do or where I should start to get the account access half of my website up and running.

If anyone has some good tutorials please let me know, i've been trying to find them but none of them are really what I want.

Currently my database is mysql database, and my page is mainly jquery although the database access is done all through php.

John Bernal
  • 230
  • 5
  • 21

2 Answers2

2

If this is something that is not one of your strong suits, you should look into Google Identity Toolkit. They give you all of the code for everything you need to do, you just paste it into place and give it your database information, but it will walk you though it step by step.

https://developers.google.com/identity-toolkit/v1/javaguide

Case
  • 4,244
  • 5
  • 35
  • 53
0

This one of the simple coding I made:-

 <?php

    // CONNECTION TO DATABASE

$mysqli = new mysqli('localhost','USERNAME','PASSWORD','DATABASE'); 

// CHECK CONNECTION

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$username = $_POST['username'];
$password   = $_POST['password'];

$username = $mysqli->real_escape_string($username);
$password = $mysqli->real_escape_string($password);

// WRITING SQL QUERY
$query = "SELECT * from TABLENAME WHERE username= '".$username."'  AND password= '".$password. "' ";

$stmt = $mysqli->query($query);

    /* determine number of rows result set */
    $row_cnt = $stmt->num_rows;

if ($row_cnt > 0)
{
//IF CORRECT DO WHAT?
}

else
{
//IF WRONG DO WHAT?

}
    ?>

    <br />
    <form action="testexecute.php" method="post">
    <input type="text" name="username" />
    <br />
    <input type="text" name="password" />
    <input type="submit" />
    </form>
Furry
  • 340
  • 1
  • 4
  • 22