Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: PHP and Access

  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP and Access

    Hi all. i have a dilemna question here. i have created an access database with the username and password tables. I have the ODBC connection which linked PHP to Access. I have created a PHP login form using Dreamweaver:

    <form method="post" action="process.php">
    Username
    <input type="text" name="user" />
    <br />
    Password
    <input type="password" name="pass" />
    <br />
    <input type="submit" name="submit" value="Login" />
    </form>

    Now i want to be able to login using from via getting the details from the access database. Somebody said to me to use process.php:
    <?
    //get variables from form
    $user = $_GET['user'];
    $pass = $_GET['pass'];

    How do i use this?

    After logging in, the user should be redirected to a website (this should be done using javascript client side checking). Also the login should be able to cope with users forgetting thier passwords and should be able to perform server side checking. Does anyone know i to go about this? Thanks in advance

  • #2
    New Coder
    Join Date
    Jan 2004
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ignore the earlier question this is where i am at: i have connected PHP to Access and created a login screen

    <?
    $odbc = odbc_connect ('PHP Login', 'root', '') or die( "Could Not Connect to ODBC Database!" );
    ?>
    <?
    //get variables from login screen.mdb
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $sql = "SELECT * FROM login screen WHERE username_column = '" . $_POST['username'] . "' AND password_column = '" . $_POST['password'] . "'"

    also do u know how i can do a process.php script as i dont know if what i am doing is a process.php? Also how can i verify users and redirect them to a website? thanx

  • #3
    New Coder
    Join Date
    Jan 2004
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <form method="post" action="process.php">
    Username
    <input type="text" name="user" />
    <br />
    Password
    <input type="password" name="pass" />
    <br />
    <input type="submit" name="submit" value="Login" />
    </form>
    <?
    //get variables from login screen.mdb
    $user = $_POST['user'];
    $pass = $_POST['pass'];

    if (odbc_num_rows($query)) {
    header("Location: process.php");
    exit();
    } else {
    echo "you can't log in.";
    }
    ?>

    I have done the process PHP but how can i validate users? When i run the code it comes up with the following errors:

    Warning: odbc_num_rows(): supplied argument is not a valid ODBC result resource in c:\phpdev5\www\tmpa3fcbrhqz1.php on line 15
    you can't log in.

    Can someone help me please

  • #4
    New Coder
    Join Date
    Jan 2004
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ahh forget it u all. no thanks n i have worked it out myself


  •  

    Posting Permissions

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