Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $userid = "";
- $userpw = "";
- if( isset( $_POST['userid'] ) ) {
- $userid = $_POST['userid'];
- }
- if( isset( $_POST['userpw'] ) ) {
- $userpw = $_POST['userpw'];
- }
- if( $userid && $userpw ) {
- include("../dbcon.php");
- $userpws = md5($userpw);
- $sql = "select * from users ";
- $sql .= " where userid='{$userid}'";
- $sql .= " and userpw='{$userpws}'";
- if( $rs = $db->query($sql) ){
- if( $user = $rs->fetch() ) {
- $_SESSION['userid'] = $user['userid'];
- $_SESSION['username'] = $user['username'];
- }
- }
- }
- header("Location: index.php");
Add Comment
Please, Sign In to add comment