SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Login Problem

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    uganda
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Login Problem

    I am having a problem with this login script. when i input the right details it brings a blank page. and when i input the wrong details it brings what i want which is the error message. below is the code for my login script.

    PHP Code:
    <?php
    session_start
    ();
    require_once 
    "../connection.php";

    if(!isset(
    $adminName) && !isset($adminPass)) {
    HTML Code:
    <html>
    <head>
    <title>  </title>
    </head>
    <body>
    <p align="right"><strong><font color="#ff6600" face="Verdana" size="1"><br>
    Admin Login</font></strong>
    <hr color="#ff6600" SIZE="1">
    <center>
    <p>You must log in to access this area of the site.<br>
    <p><form method="post" action="<?=$PHP_SELF?>">
    <table>
    <tr>
    <td>Username</td>
    <td align=right> <input type="text" name="adminName" size="15" ></td>
    </tr>
    
    <tr>
    <td>Password</td>
    <td align=right><input type="password" name="adminPass" SIZE="15" ></td>
    </tr>
    
    <tr>
    	<td colspan=2 align=right><input type="submit" value="Login"></td>
    </tr>
    
    </table>
    </form></p>
    </center>
    </body>
    </html>

    PHP Code:
    <?php
    session_register
    ("adminName");
    session_register("adminPass");


    $sql "SELECT * FROM Admin WHERE
            adminName = '
    $adminName' AND adminPass = '$adminPass'";
    $result mysql_query($sql);

    if (!
    $result// second if clause begin
    {

     include 
    "link.php";
      echo 
    "A database error occurred while checking your login details. If this error persists, please Contact Ashaba Anthony at 078495738";

    }if (
    mysql_num_rows($result) == && $adminName <> ""&& $adminPass <> "") {
      
    session_unregister("adminName");
      
    session_unregister("adminPass");
      


    ?>

    HTML Code:
    <html>
    <head>
    <title>Access Denied </title>
    </head>
    <body>
     
    <font face=verdana>
    <h1> Access Denied</h1>
    <p>The Username and Password you specified do not match  or you are do not have access to this resource.<br><br> To try logging in again, click
    <a href="<?=$PHP_SELF?>">here</a> </p>
    </body>
    </html>
    PHP Code:
    <? php
    ?>
    what i want is that if the right login details are given let it bring another page.

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the problem is your if statement. you might check your logic again. syntax is correct its just misplacement of your if statement.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    uganda
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Login problem

    hello jaswinder_rana, i would like you to help me do that. what i need is i would like to include a file say links.php. such that if the right password is input it takes me to links.php.

  4. #4
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok first, please post the whole code.
    the code right now is in blocks and i don't know if the whole code or code from different pages.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    uganda
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    login problem.

    yes that is the whole code.


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
  •