todo este es mi codigo
Código PHP:
<?php require_once('../Connections/localhost.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "registro.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_localhost, $localhost);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $localhost) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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=iso-8859-1" />
<title>Explosion Total</title>
<link href="archivos/estilo.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="archivos/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="archivos/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="Layer1">
<img src="archivos/barner.jpg" alt="Explosion Total" width="350" height="120" />
<table width="250" border="0" align="left" id="tablas"><tr>
<th width="61"><strong><a href="index.php">Inicio</a></strong></th>
<td width="76"><strong><a href="chistes.php">Chistes</a></strong></td>
<td width="71"><strong><a href="videos.php">Videos</a></strong></td>
<td width="55"><strong><a href="chat.php">Chat</a></strong></td>
<td width="71"><strong><a href="musica.php">Musica</a></strong></td>
</tr>
</table>
<a href="<?php echo $logoutAction ?>"><?php
if(!isset($_SESSION['MM_Username'])) {
} else {
echo "<span class='Estilo3'>Salir<strong></a> ";
echo "</span><br/> Bienvenido ".$_SESSION['MM_Username'];
}?>
</strong></a>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<label>
<input name="username" type="text" id="username" />
</label>
<label><br />
<input name="password" type="text" id="password" />
</label>
<br/>
<input type="submit" name="Submit" value="Ingresar" />
</form>
</body>
</html>
ahora si no me pueden ayudar entonses diganme como veo si solamente hay alguien conectado y decirle "hola usuario"(<---eso lo hago) ysi no hay nadie conectado decirle q se !registre!