Jump to content

Search the Community

Showing results for tags 'php login'.

  • 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 There I am trying to create a login screen within a framed site that when you log in it takes you to a new page for the portal. When I enter the login credentials the frame I am working in goes blank and does not take me to the portal. Can someone please help me out with the coding I have. The coding itself has 2 parts... 1) login and 2) if already logged in gives you a button to open to portal. <? if(isset($_POST['submit'])){ //protect the posted value then store them to variables $Username = protect($_POST['Username']); $Password = protect(sha1($_POST['Password'])); //Check if the username or password boxes were not filled in if(!$Username || !$Password){ //if not display an error message echo "<center>Please enter your <b>Username</b> and <b>Password</b>!</center>"; }else{ //if the were continue checking //select all rows from the table where the username matches the one entered by the user $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."'"); $num = mysql_num_rows($res); //check if there was not a match if($num == 0){ //if not display an error message echo "<center>The <b>Username</b> or <b>Password</b> you supplied is incorrect!</center>"; }else{ //if there was a match continue checking //select all rows where the username and password match the ones submitted by the user $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."' AND `Password` = '".$Password."'"); $num = mysql_num_rows($res); //check if there was not a match if($num == 0){ //if not display error message echo "<center>The <b>Username</b> or <b>Password</b> you supplied is incorrect!</center>"; }else{ //if there was continue checking //split all fields fom the correct row into an associative array $row = mysql_fetch_assoc($res); //check to see if the user has not activated their account yet if($row['Active'] != 1){ //if not display error message echo "<center>Your login has been <b>deactivated</b>, Please contact Website Administrator for assistance.</center>"; }else{ //if they have log them in //set the login session storing there id - we use this to see if they are logged in or not $_SESSION['uid'] = $row['id']; //show message echo "<center>You have successfully logged in!</center>"; //update the online field to 50 seconds into the future $time = date('U')+50; mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); //redirect them to the usersonline page echo"<a target=\'_blank\" href='portal/index2.php'></a>";?> <?php if(isset($_POST['submit2'])){ //update the online field to 50 seconds into the future $time = date('U')+50; mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); //redirect them to the usersonline page echo"<script type='text/javascript' language='Javascript'>window.open('portal/index2.php');</script>";}}}}}}?> <?php include "portal/edb.php"; //if the login session does not exist therefore meaning the user is not logged in if(strcmp($_SESSION['uid'],"") == 0){ //display and error message echo "<form name='main.php' method='post' action=''> <table bgcolor='#FFFFFF' width='320' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td ><table border='0' align='center' cellpadding='2' cellspacing='0' class='page-border'> <tr><td colspan='2' class='text_heading_center'>Portal</td> </tr> <tr> <td width='100' class='text_standard_right'>Username:</td> <td width='150' class='text_standard_right'><input name='Username' type='text' class='text_standard_left' /></td> </tr> <tr> <td class='text_standard_right'>Password:</td> <td class='text_standard_right'><input name='Password' type='password' class='text_standard_left' /></td> </tr> <tr> <td height='29' colspan='2' align='right'><input type='submit' name='submit' value='Login' /></td> </tr> </table>"; }else{ $time = date('U')+50; $update = mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); $id =$_REQUEST['id']; $result=mysql_query("SELECT * FROM `eusers` WHERE id='".$_SESSION['uid']."'"); print"<form name='main.php' method='post' action=''>"; print"<br/>"; print"You are already logged into the Portal"; print"<br/>"; print"Click here to return the the Portal"; print"<br/>"; print"<input name='submit2' type='button' value='Return to Portal' />"; print"</form>"; }?>
×
×
  • 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.