Jump to content

Search the Community

Showing results for tags 'login php script'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, Currently having an issue with php login script. The login script works fine and logs in the correct user, but the problem is, is that any link I click regardless whether it is the log out button, it seems to end the session and logs me back out again. Total newbie to php, can I have some help please? Also, is there a way to display the users' name from the user table inside the echo "you logged in as", I can only seem to get the ID? Thank you for your help. Login form (in page header): <div class="loginform"> <?php if ($_SESSION['id'] > 0){ echo "You are logged in as"; ?> <?php print $GLOBALS['user']->name; ?> <a href="logout.php">Logout</a> <?php }else{ echo "<p>Login:</p>\n"; ?> <form name="loginform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <b>Username:</b> <input type="text" name="liusername"> <b>Password:</b> <input type="password" name="lipassword"> <input type="submit" name="lisubmit" value="Login"> </form> </div> PHP authenticate (in page top) <?php if (isset($_POST['lisubmit'])); $query = "SELECT user_id, user_password FROM user WHERE user_username = '".$_POST['liusername']."'"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); if ($row['user_password'] == $_POST['lipassword']){ $_SESSION['loggedin'] = true; $_SESSION['id'] = $row['user_id']; }else{ $_SESSION['loggedin'] = false; $_SESSION['id'] = 0; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.