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 6 of 6

Thread: Login

  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Login

    Hi,
    I would like to create my own login... on my website...
    with PHP and MySQL, I've created a database called dieknights, with a table called memb_info
    and now I want to have a login on my index.php, how do I do that?
    1. create link to login.php ?
    or
    2. put the login on index.php with include();
    or
    3. put the login on index.php in a frame?
    or
    ...

    now my example:
    I've sepereated it:
    //index.php
    <a href="login.php">To the Login</a>
    __________________________________
    //login.php
    <form action="loggedin.php" method="post">
    Name: <input type="text" name="membid"><br>
    Passwort:<input type="text" name="pwid"><br>
    <input type="submit" value="Login">
    </form>
    __________________________________
    //loggedin.php
    <?php
    //Variable
    $name = $_POST['membid'];
    $pw = $_POST['pwid'];
    //Check:
    if (isset($name) && $pw != "")
    {
    //SQL query(code):
    what goes here? I think:
    if $pw = pwd_id("SELECT * FROM memb_info WHERE memb_id=$name");
    or something...
    ?>

    what do i need to put at the sql query i mean how can i make a check if the $name exists and if yes, check if the $pw is the right one....

    I would be very thankful for help!
    Last edited by [V]enom; 07-07-2007 at 12:30 PM.

  • #2
    New Coder
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    nobody?

    nobody got a clue?

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by [V]enom View Post
    nobody got a clue?
    If I knew how I'd be glad to help but just googling pointed me to this:

    http://www.trap17.com/forums/php-sim...ial-t7887.html

    Here's another really easy one:

    http://www.tutorialized.com/tutorial...in-script/9963
    Last edited by unrelenting; 07-07-2007 at 03:15 PM.

  • #4
    New Coder
    Join Date
    Jul 2007
    Location
    UK
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is how i have mine, which will show the users info:

    Code:
    <?php
    
    $username="*****";
    $password="*****";
    $database="*****";
    
    mysql_connect('******',$username,$password);
    @mysql_select_db($database) or die("Unable to select database");
    
    $query = "SELECT * FROM users"; 
    	 
    $result = mysql_query($query) or die(mysql_error());
    
    
    while($row = mysql_fetch_array($result)){
    
    echo 
    '<table border="1" width="650" bordercolor="#c0c0c0"><tr><td width="80">'.$row['id']. '</td>'. 
    '<td width="120">'.$row['loginname']. '</td>'.
    '<td width="120">'.$row['password']. '</td>'. 
    '<td width="120">'.$row['createdate']. '</td>'.
    '<td width="120">'.$row['name']. '</td>'.
    '<td width="30">'.$row['age']. '</td>'. 
    '<td width="150">'.$row['email']. '</td>'.
    '<td width="30">'.$row['warn']. '</td></tr></table>';
    
    echo "";
    }
    ?>
    Just change the stuff to what you need, i have a full working login /registering thing if you would like any code for that just say? BY PMING ME, I MAY NOT COME HERE AGAIN!!
    Last edited by SMGames; 07-07-2007 at 04:08 PM.
    http://www.smgames.staticfire.co.uk Under construction, Currently hiring mods and admins anyone interested pm me.

  • #5
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts
    Here is an outline of how I do this in PHP:

    1. Login.php is a link on my home page. If the user wants to login then they click on this link and it displays the login.php page.

    2. User logs in with username and pw. The login.php script calls login.dispatcher.php which processes the login data at the server:
    a. checks login username and pw vars to make sure they not empty (strlen() == 0)
    b. open database and find username entered on login page. If not found dispatcher script calls login.usernotfound.php page.
    c. open database and fetch password. Decrypt password using PHP's Mcrypt module. Compare DB pw to login pw. If no match dispatcher script calls login.badpw.php script.
    d. If password matches then dispatcher sets valid user pw variable (or however you plan to determine pw is valid) and calls what ever page you want next to be displayed.

    Notes: For testing, you'll have to write two stub php scripts:
    create_pw.php
    display_pw.php

    These two test scripts will allow you to create a pw and store it encrypted into the DB and then read it back out, decrypt it, to make sure you can get an encrypted pw into the DB and back out again.
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #6
    New Coder
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    secure?

    is it secure?
    antispam? antihack?

    btw thanks!

    i needed this for my project,
    im trying to program a webborwser based game, like:
    www.tribalwars.net
    has anyone got a clue, what else i need?
    Last edited by [V]enom; 07-07-2007 at 06:20 PM.


  •  

    Posting Permissions

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