Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ob_start();
- include 'dbc.php';
- $user_name = mysql_real_escape_string($_POST['username']);
- if ($_POST['Submit']=='Login')
- {
- $pass = $_POST['pwd'];
- $sql = "SELECT id,user_name FROM users WHERE
- user_name = '$user_name' AND
- user_pwd = '$pass' AND user_activated='1'";
- $result = mysql_query($sql) or die (mysql_error());
- $num = mysql_num_rows($result);
- if ( $num != 0 ) {
- // A matching row was found - the user is authenticated.
- list($user_id,$user_email) = mysql_fetch_row($result);
- // this sets variables in the session
- $_SESSION['ibr']= $user_name;
- if (isset($_GET['ret']) && !empty($_GET['ret']))
- {
- header("Location: $_GET[ret]");
- } else
- {
- header("Location: account.php");
- }
- //echo "Logged in...";
- exit();
- }
- header("Location: login.php?msg=Invalid Login");
- //echo "Error:";
- exit();
- }
- ?>
- <link href="styles.css" rel="stylesheet" type="text/css">
- <?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
- <style type="text/css">
- <!--
- .logintxt {font-size: 12px}
- -->
- </style>
- <div id="login"><form name="form1" method="post" action="">
- <p align="center"><span class="logintxt">Username:</span>
- <input name="username" type="text" id="username">
- </p>
- <p align="center"> <span class="logintxt">Password: </span>
- <input name="pwd" type="password" id="pwd">
- </p>
- <p align="center">
- <input type="submit" name="Submit" value="Login">
- </p>
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement