Results 1 to 10 of 17

Thread: Help with php.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Veteran
    Join Date
    Jul 2013
    Location
    Hallandale, FL
    Posts
    159

    Question Help with php.

    <HTML>
    <html>
    <head>
    <title>login page</title>
    </head>
    <body bgcolor="black" style="color:gray">
    <form action="index.php" method=get>
    <h1 align="center" style="color:gray" >Welcome to the Login page</h1>
    <?php
    session_start();
    if( $_SESSION["logging"]&& $_SESSION["logged"])
    {
    print_secure_content();
    }
    else {
    if(!$_SESSION["logging"])
    {
    $_SESSION["logging"]=true;
    loginform();
    }
    else if($_SESSION["logging"])
    {
    $number_of_rows=checkpass();
    if($number_of_rows==1)
    {
    $_SESSION[user]=$_GET[userlogin];
    $_SESSION[logged]=true;
    print"<h1>you have logged in successfully</h1>";
    print_secure_content();
    }
    else{
    print "wrong pawssword or username, please try again";
    loginform();
    }
    }
    }

    function loginform()
    {
    print "please enter your login information to proceed with our site";
    print ("<table border='2'><tr><td>username</td><td><input type='text' name='userlogin' size'20'></td></tr><tr><td>password</td><td><input type='password' name='password' size'20'></td></tr></table>");
    print "<input type='submit' >";
    print "<h3><a href='registerform.php'>register now!</a></h3>";
    }

    function checkpass()
    {
    $servername="localhost";
    $username="root";
    $conn= mysql_connect($servername,$username)or die(mysql_error());
    mysql_select_db("dbUsers",$conn);
    $sql="select * from users where name='$_GET[userlogin]' and password='$_GET[password]'";
    $result=mysql_query($sql,$conn) or die(mysql_error());
    return mysql_num_rows($result);
    }






    There is an error in this php script. Help!
    </HTML>
    Last edited by Niko; 11-05-2013 at 08:06 PM.

Tags for this Thread

Posting Permissions

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