Hello fellow members.......
I have been learning a forum creation video tutorial lately and I found few errors in them but the author is just NOT responding to my emails.....
Anyhow these are the errors which I am facing:
The Error I am facing is 'uid' which it says is not defined in my index page!!!!!!! but checked his tutorial again and again and its the same way he did as shown below:
<?php
session_start();
include "./global.php";
?>
<html>
<head>
<style type="text/css">
body {
background-color:#EEE;
color:#000;
font-family:Tahoma;
font-size:10pt;
}
#holder {
width:90%;
color:#000;
font-family:Tahoma;
border:1px solid #000;
padding:10px;
text-align:left;
}
#userinfo {
color:#000;
font-family:Tahoma;
border:1px solid #CCC;
text-align:right;
padding:3px;
#userinfo a {
color:#800000;
text-decoration:none;
</style>
<script language="Javascript">
function confirmLogout() {
var agree = confirm("Are you sure you wish to logout?");
if (agree){
return true ;
}else {
return false ;
}
</script>
</head>
<body>
<center>
<div id="holder">
<div id="userinfo">
<?php
if($_SESSION['uid']){
$sql = "SELECT id,username FROM 'users' WHERE 'id'='".$_SESSION['uid']."'";
$res = 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> a new account!\n";
}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>\n";
}
}else {
echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n";
}
?>
</div>
<?php
?>
</div>
</center>
</body>
</html>
The user table is as follows:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
`email` varchar(255) NOT NULL,
`name` varchar(64) NOT NULL,
`aim` varchar(16) NOT NULL,
`admin` int(11) NOT NULL default '0',
`time` int(15) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Thanks