I try to run this on my cpanel hosting, but nothing come out. when I try at my PC using localhost the page is reload.
Suppose this page will display Loading effect when using login into the system
this are my code
<?php
require_once('Connection/connect.php');
$name = $_GET['username'];
$pwd = $_GET['password'];
?>
<?php
$linktemp="http://$_SERVER[HTTP_HOST]" . "/PointerSystem";
if( ($_GET['username']==NULL) || ($_GET['password']==NULL) ) {
header("Location:index.php?mode=empty");
exit();
} else
{
mysql_select_db($database, $connect) or die(mysql_error());
$query = "SELECT * FROM user WHERE matricID='$name' && password ='$pwd' LIMIT 1";
$result = mysql_query($query);
$count = mysql_num_rows($result);
$row = mysql_fetch_assoc($result);
if( $name=="" || $pwd=="" ) {
header("Location:index.php?mode=empty");
exit();
} elseif(($row['matricID']==$name) && ($row['password']==$pwd) ) {
$p1 = $row['matricID'];
$p2 = $row['password'];
session_start();
$_SESSION['name'] = $row['matricID'];
?>
<script language="javascript" type="text/javascript" > window.setTimeout(function() { window.location = 'mainmenu.php'; }, 3000); </script>
<?php
}elseif (($row['matricID']!=$name) || ($row['password']!=$pwd) )/*|| ($row['level']!="admin") || ($row['level']!="user")*/ {
header("Location:index.php?mode=wrong");
exit();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Direct Login</title>
<link rel="stylesheet" type="text/css" href="css/loading.css" />
<link rel="stylesheet" type="text/css" href="css/loading2.css" />
<link rel="stylesheet" type="text/css" href="css/loading4.css" />
<link rel="stylesheet" type="text/css" href="css/loading5.css" />
<script src="js/loading.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body style="background: #fff url('images/bg.jpg') repeat top left;">
<div id="loading2">
<p id="loading-font2">Redirect......</p>
<img id="loading-image2" src="images/ajax-loader2.gif" />
</div>
<div id="loading">
<p id="loading-font">Please Wait, Validation In Progress......</p>
<img id="loading-image" src="images/ajax-loader.gif" />
</div>
<script language="javascript" type="text/javascript">
$(window).load(function(){ $("#loading").hide().delay(700).show(0); $("#loading").fadeOut(5000);});
$(window).on("load",function() { $("#loading2").delay(600).fadeOut(2); $("#loading2").show(); });
</script>
</body>
</html>
PROBLEM Solved. On @TUNAMAXX guid I already change the code above, so here is the correction one. Thank @TUNAMAXX and @vlzvl. Already manage to post the data.
<?php require_once('Connection/connect.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Direct Login</title>
<link rel="stylesheet" type="text/css" href="css/loading.css" />
<link rel="stylesheet" type="text/css" href="css/loading2.css" />
<link rel="stylesheet" type="text/css" href="css/loading4.css" />
<link rel="stylesheet" type="text/css" href="css/loading5.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body style="background: #fff url(images/bg.jpg) repeat top left;">
<?php
$name = $_POST['username'];
$pwd = $_POST['password'];
/*$linktemp="http://$_SERVER[HTTP_HOST]" . "/PointerSystem";*/
if( ($_POST['username']==NULL) || ($_POST['password']==NULL) ) {
header("Location:index.php?mode=empty");
exit();
} else
{
mysql_select_db($database, $connect) or die(mysql_error());
/* -------------------------------------------------------------------------------------------
* I still don't search about SQL Inject yet,Comic that you give me seem like troll Comic ^_^
* ---------------------------------------------------------------------------------------- */
$query = "SELECT * FROM user WHERE matricID='$name' && password ='$pwd' LIMIT 1";
$result = mysql_query($query);
$count = mysql_num_rows($result);
$row = mysql_fetch_assoc($result);
if( $name=="" || $pwd=="" ) {
header("Location:index.php?mode=empty");
exit();
} elseif(($row['matricID']==$name) && ($row['password']==$pwd) ) {
/* -------------------------------------------------------------------------------------------
* I thought wanna use this as holder name or Welcome : USER . But not here
* ---------------------------------------------------------------------------------------- */
$p1 = $row['matricID'];
$p2 = $row['password'];
session_start();
$_SESSION['name'] = $row['matricID'];
echo"<script>
window.setTimeout(function() {
window.location = 'mainmenu.php';
}, 3000);
</script>";
}elseif (($row['matricID']!=$name) || ($row['password']!=$pwd)) {
header("Location:index.php?mode=wrong");
exit();
}
}
?>
<div id="loading2">
<p id="loading-font2">Redirect......</p>
<img id="loading-image2" src="images/ajax-loader2.gif" />
</div>
<div id="loading">
<p id="loading-font">Please Wait, Validation In Progress......</p>
<img id="loading-image" src="images/ajax-loader.gif" />
</div>
<script language="javascript" type="text/javascript">
$(window).load(function(){
$("#loading").hide().delay(700).show(0);
$('#loading').fadeOut(5000);
});
$(window).on("load",function() {
$("#loading2").delay(600).fadeOut(2);
$("#loading2").show();
});
</script>
</body>
</html>