SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    log in page in php

    hi i am new to php,i am creating php login page if user is log in successfully the page must redirect to another page if failed to log in i has to show error msg here is my code but some thing going wrong here pls help me
    PHP Code:
    <?php

    $username
    ="root";
    $password="******";
    $hostname="localhost";

    $dbhandle=mysql_connect($hostname,$username,$password);
    $selected=mysql_select_db("ninepixel",$dbhandle);

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

    $username=stripslashes($username);
    $password=stripslashes($password);

    $query="select * from users where username='$username' and password='$password'";
    $result=mysql_query($query);

    if(
    mysql_num_rows($result)==1){
    header('location:userpage.php');
    exit();
    }
    else{
    header('location:signinform.php');
    exit();
    }

    ?>
    Last edited by SpacePhoenix; Feb 25, 2013 at 00:37. Reason: placed php tags around php code


Tags for this Thread

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
  •