Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once("include/events/ga_badge_item_events.php");
- $obj = new ga_badge_item_events();
- $obj->trigger_item_43($userid);
- if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['form_name'] == 'loginform')
- {
- $success_page = './page2.php';
- $error_page = basename(__FILE__);
- $mysql_server = 'xxxxxx';
- $mysql_username = 'xxxxx';
- $mysql_password = 'xxxxx';
- $mysql_database = 'xxxxx';
- $mysql_table = 'ga_users';
- $crypt_pass = md5($_POST['password']);
- $found = false;
- $fullname = '';
- $session_timeout = 600;
- $db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
- if (!$db)
- {
- die('Failed to connect to database server!<br>'.mysqli_error($db));
- }
- mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
- $sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".mysqli_real_escape_string($db, $_POST['username'])."'";
- $result = mysqli_query($db, $sql);
- if ($data = mysqli_fetch_array($result))
- {
- if ($crypt_pass == $data['password'] && $data['active'] != 0)
- {
- $found = true;
- $fullname = $data['fullname'];
- }
- }
- mysqli_close($db);
- if($found == false)
- {
- header('Location: '.$error_page);
- exit;
- }
- else
- {
- if (session_id() == "")
- {
- session_start();
- }
- $_SESSION['username'] = $_POST['username'];
- $_SESSION['fullname'] = $fullname;
- $_SESSION['expires_by'] = time() + $session_timeout;
- $_SESSION['expires_timeout'] = $session_timeout;
- $rememberme = isset($_POST['rememberme']) ? true : false;
- if ($rememberme)
- {
- setcookie('username', $_POST['username'], time() + 3600*24*30);
- setcookie('password', $_POST['password'], time() + 3600*24*30);
- }
- header('Location: '.$success_page);
- exit;
- }
- }
- $username = isset($_COOKIE['username']) ? $_COOKIE['username'] : '';
- $password = isset($_COOKIE['password']) ? $_COOKIE['password'] : '';
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled Page</title>
- <meta name="generator" content="WYSIWYG Web Builder 10 - http://www.wysiwygwebbuilder.com">
- <link href="Untitled1.css" rel="stylesheet">
- <link href="login.css" rel="stylesheet">
- </head>
- <body>
- <div id="wb_Login1" style="position:absolute;left:162px;top:99px;width:446px;height:183px;text-align:right;z-index:0;">
- <form name="loginform" method="post" action="<?php echo basename(__FILE__); ?>" id="loginform">
- <input type="hidden" name="form_name" value="loginform">
- <table id="Login1">
- <tr>
- <td class="Login1_header" colspan="2" style="height:20px;">Log In</td>
- </tr>
- <tr>
- <td style="height:20px;width:201px">User Name:</td>
- <td style="text-align:left"><input class="Login1_input" name="username" type="text" id="username" value="<?php echo $username; ?>"></td>
- </tr>
- <tr>
- <td style="height:20px">Password:</td>
- <td style="text-align:left"><input class="Login1_input" name="password" type="password" id="password" value="<?php echo $password; ?>"></td>
- </tr>
- <tr>
- <td> </td><td style="text-align:left;height:20px"><input id="rememberme" type="checkbox" name="rememberme">Remember me</td>
- </tr>
- <tr>
- <td> </td><td style="text-align:left;vertical-align:bottom"><input class="Login1_button" type="submit" name="login" value="Log In" id="login"></td>
- </tr>
- </table>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement