Website Login

Results 1 to 11 of 11
  1. #1
    Account Upgraded | Title Enabled! dellyoung is offline
    MemberRank
    Aug 2007 Join Date
    271Posts

    Website Login

    Can anyone post a tutorial on how to make a Log in for Gunz in php??? i would appreciate it very much.


  2. #2

    Re: Website Login

    Use an existing one and learn from it.

  3. #3
    Account Upgraded | Title Enabled! dellyoung is offline
    MemberRank
    Aug 2007 Join Date
    271Posts

    Re: Website Login

    is there any other way becuse i cant figure out it 100 percent

  4. #4
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: Website Login

    Through mysql / mssql database or just 1 username and password to login ?

  5. #5
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Website Login

    PHP Code:
    <?php
    //catch the post variables
    $sUsername //cleaned $_POST
    $sPassword //cleaned $_POST
    $rQuery odbc_exec($rDBConnect"SELECT AID FROM Login WHERE UserID = '" $sUsername "' AND Password = '" $sPassword "'");
    $iAID = (int)odbc_result($rQuery1);
    if (
    $iAID == 0) {
        
    //Login failed
    }
    else {
        
    //welcome
    }
    ?>

  6. #6
    Account Upgraded | Title Enabled! Forgiven is offline
    MemberRank
    Jul 2008 Join Date
    CanadaLocation
    301Posts

    Re: Website Login

    Quote Originally Posted by Wizkidje View Post
    PHP Code:
    <?php
    //catch the post variables
    $sUsername //cleaned $_POST
    $sPassword //cleaned $_POST
    $rQuery odbc_exec($rDBConnect"SELECT AID FROM Login WHERE UserID = '" $sUsername "' AND Password = '" $sPassword "'");
    $iAID = (int)odbc_result($rQuery1);
    if (
    $iAID == 0) {
        
    //Login failed
    }
    else {
        
    //welcome
    }
    ?>
    Hmm 0_0, so would where you exactly put that. My login goes like this.

    PHP Code:
    <form action="" method="POST"
    Username :<br/> 
    <
    tr><td class=list align=left></td><td class=list><input name="login" type="text" /></td></tr><br/> 
    Password :<br/> 
    <
    tr><td class=list align=left></td><td class=list><input name="pass" type="password" /></td></tr><br/> 
    <
    tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center
    </
    form
    </
    center
    Last edited by Forgiven; 17-01-10 at 05:39 PM.

  7. #7

    Re: Website Login

    Quote Originally Posted by zapman13 View Post
    Hmm 0_0, so would where you exactly put that. My login goes like this.

    PHP Code:
    <form action="" method="POST"
    Username :<br/> 
    <
    tr><td class=list align=left></td><td class=list><input name="login" type="text" /></td></tr><br/> 
    Password :<br/> 
    <
    tr><td class=list align=left></td><td class=list><input name="pass" type="password" /></td></tr><br/> 
    <
    tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center
    </
    form
    </
    center
    PHP Code:
    <?php
    // Your PHP code
    ?>
    <!-- HTML Code -->

  8. #8
    Account Upgraded | Title Enabled! Forgiven is offline
    MemberRank
    Jul 2008 Join Date
    CanadaLocation
    301Posts

    Re: Website Login

    PHP Code:
    <?php
    //catch the post variables
    $sUsername //cleaned $_POST
    $sPassword //cleaned $_POST
    $rQuery odbc_exec($rDBConnect"SELECT AID FROM Login WHERE UserID = '" $sUsername "' AND Password = '" $sPassword "'");
    $iAID = (int)odbc_result($rQuery1);
    if (
    $iAID == 0) {
        
    //Login failed
    }
    else {
        
    //welcome
    }
    ?>
    <form action="" method="POST"> 
    Username :<br/> 
    <tr><td class=list align=left></td><td class=list><input name="Username" type="Username" /></td></tr><br/> 
    Password :<br/> 
    <tr><td class=list align=left></td><td class=list><input name="Password" type="Password" /></td></tr><br/> 
    <tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center> 
    </form> 
    </center>
    SO just to clarify that would be it? And then all I have to do is make a config then include it?

    Ok so I get this error

    Code:
    Warning: odbc_exec() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index1.php on line 58
    
    Warning: odbc_result() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index1.php on line 59
    Last edited by Forgiven; 18-01-10 at 10:54 PM.

  9. #9
    Account Upgraded | Title Enabled! PaulBub is offline
    MemberRank
    Apr 2009 Join Date
    316Posts

    Re: Website Login

    You have to connect to database before.

  10. #10
    Account Upgraded | Title Enabled! Forgiven is offline
    MemberRank
    Jul 2008 Join Date
    CanadaLocation
    301Posts

    Re: Website Login

    I did. As a test Im putting this in my index file where to login is. It should work. here it is.
    PHP Code:
    <?php
    //MSSQL Connection
    $con mssql_connect("*******\SQLEXPRESS","*****","******");
    if (!
    $con)
        {
        die(
    'Couldnt not connect: ' mssql_error());
        }
       
    mssql_select_db("GunzDB");
    ?>
    Ye i stared it out :)
    Last edited by Forgiven; 18-01-10 at 11:39 PM.

  11. #11
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: Website Login

    Quote Originally Posted by zapman13 View Post
    I did. As a test Im putting this in my index file where to login is. It should work. here it is.
    PHP Code:
    <?php
    //MSSQL Connection
    $con mssql_connect("*******\SQLEXPRESS","*****","******");
    if (!
    $con)
        {
        die(
    'Couldnt not connect: ' mssql_error());
        }
       
    mssql_select_db("GunzDB");
    ?>
    Ye i stared it out :)
    Your config is for mssql.

    Add this one :

    PHP Code:
    $host ""//host
    $user "sa";
    $pass ""//pw
    $dbname "GunzDB";
    $connect odbc_connect("Driver={SQL Server}; Server={$host}; Database={$dbname}"$user$pass) or die("Can't connect to the Server. Please contact the webmaster !"); 
    Last edited by Trilest; 22-01-10 at 08:27 AM.



Advertisement