This is my checklogin.php [php]<?php
include “mysql_info.php”;
session_start();
$filled = 0;
if($_POST[“mypassword”] != “” && $_POST[“myusername”] != “”)
{
// Connect to server and select databse.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db")or die(“cannot select DB”);
// username and password sent from form
$myusername=$_POST[‘myusername’];
$mypassword=$_POST[‘mypassword’];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$mypassword = md5($mypassword);
$sql=“SELECT * FROM members WHERE username=’$myusername’ and password=’$mypassword’”;
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
session_register(“myusername”);
session_register(“mypassword”);
header(“location:home.php”);
}
else {
echo “Wrong Username or Password”;
}
}
?>
[/php]
This is home.php which the login directs to [php]<?php
session_start();
if(!session_is_registered(myusername)){
header(“location:index.html”);
}
?>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Homepage</title>
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/style4.css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<!-- Codrops top bar -->
<div class="codrops-top">
<strong>Home Page <a style="font-size:10px" href="logout.php">Logout</a> </strong>
<div class="clr"></div>
</div><!--/ Codrops top bar -->
<section>
a{color: White; font-size: 15px}
a:visited{color: white; font-size: 15px;}
Home | Forums | Istorage | Chat | IPtrace |
All Rights Reserved |
Axx81 LLC |
Login Page |