<?php
session_start();
$con = mysql_connect("localhost","root","");
$sql = mysql_select_db("blog", $con) or die(mysql_error());
?>
<html>
<head>
<title>///</title>
</head>
<body>
<div id="admin-content">
<?php
if($_SESSION['uid']){
$sel = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."' ";
$result = mysql_query($sql) or die (mysql_error());
if(mysql_num_rows($res) == 0){
session_destroy();
echo "Please <a href='login.php'>Login</a> to your account, or <a href='register.php'>Register</a> new account!";
}else{
$row = mysql_fetch_assoc($res);
echo "Welcome back, <a href='index.php?act=profile&id=".$row['id']."'>".$row['username']."</a>! <a href='logout.php' onClick='return confirmLogout()'>logout</a>";
if($row['admin'] == '1'){
echo "admin Section";
}
}
} else {
echo "Please <a href='login.php'>Login</a> to your account, or <a href='register.php'>Register</a> new account!";
}
?>
</div>
</body>
</html>
I got error on line 17, which is "Undefined Index: uid". I'm a new in php please help me guys