PHP Series – Building A PHP MySQL Forum Tutorial Series Part 1 – User Login




Follow me on Twitter @ http://twitter.com/tktutorials Check out my website @ http://www.timkipptutorials.com This is part one of this tutorial series. In part one we …

source


37 responses to “PHP Series – Building A PHP MySQL Forum Tutorial Series Part 1 – User Login”

  1. THIS DOESNT FUCKING WORK Access denied for user 'root'@'localhost' (using password: NO) THAT IS WHAT THE FUCK IT GIVES ME WHEN I TRY THE FUCKING LOGIN SYSTEM NOW GODDAMN IT WHAT THE FUCK IS WRONG EITHER TELL ME OR TAKE DOWN THIS SHITTY FUCKING SERIES

  2. I know its a bit late, but i have a problem:
    if i try to log in with my information from within the database i keep getting Invalid login information…
    this is my code:
    if(isset($_POST['username'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    $sql = "SELECT * FROM users WHERE username = ' " .$username . " ' AND password = ' " . $password . " ' LIMIT 1";
    $res = mysqli_query($conn, $sql);
    $rowcount = mysqli_num_rows($res);

    if($rowcount == 1) {
    $row = mysqli_fetch_assoc($res);
    $_SESSION['uid'] = $row['id'];
    $_SESSION['username'] = $row['username'];
    header("Location: index.php");
    exit();
    } else {
    echo "Invalid login information.";
    exit();
    }
    }
    Someone here to help?
    would appreciate 🙂

  3. when i log in it says:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'(my ip is censored)' (using password: NO) in /home/korvasie/public_html/connect.php on line 7
    Access denied for user 'root'@'(my ip is censored)' (using password: NO)

  4. why is my "echo" is written in green :/ you got your echo in blue wtf :/ i'm also using dreamweaver
    this is my code:
    <?php

    if (!isset($_SESSION['uid0'])){
        echo"<form action='login_parse.php' method='post'>
        Username:<input type='text' name='username' />&nbsp;
        Password:<input type='password' name='password' />&nbsp;
        <input type='submit' name='submit' value='Log In' />";
    }else{    
            echo "<p>You are logged is as ".$_SESSION['username']."&bull;<a href='logout_parse.php'>Logout</a>";
        }
    ?>

  5. Code:<?php
    if (!isset($_SESSION['uid'])){
    echo "<form action='login_parse.php' method='post'>
    name:<input type='text' name='username'/>&nbsp;
    password:<input type='password' name='password' /> &nbsp;
    <input type='submit' name='submit' value='Log in'/>
    ";

    }
    else {
    echo "<p> you are logged in as ".$_SESSION ['username']. "$bull; <a href='logout_parse.php'>Logout <a/>";
    }
    ?>

    OUTPUT:
    "; } else { echo "
    you are logged in as ".$_SESSION ['username']. "$bull; Logout "; } ?>

    the result
    Username and password is working fine
    I dont know what's wrong with my code I cant get . Please help.

  6. +TimKippTutorials This is a snipet of my code…
        $res = mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($res) == 1) {
            $row = mysql_fetch_assoc($res);
            $_SESSION['uid'] = $row['id'];
            $_SESSION['username'] = $row['username'];
            header("Location: index.php");
            exit();
    And when pressing login on the page I got this error…
    Parse error: syntax error, unexpected 'uid' (T_STRING) in A:xampphtdocsnewlogin_parse.php on line 13

    I'm using MySql and Apache and everything (don't really think that matters). I did everything like it was said in the video 🙁

    Any help? 🙂

    If you wanna test it out, go to here : panel.alzdoesmc.com/new <– EDIT: this is broken too 🙁 Sigh

  7. line 13 – $_SESSION['uid'] = $row['id'];
    line 14 – $_SESSION['username'] = $row['username'];

    Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:xampphtdocsnew_forumlogin_parse.php on line 13

    help me

  8. Hi, I have got a database with godaddy and it sends me to the php my admin site. What do I put in the host part I tried local host and it does not work could you please help me out thanks!

Leave a Reply