Location: PHPKode > projects > Potato News > newcopy/includes/userwidget.php
<?PHP
if (isset($_COOKIE["user"])) {
$id = $_COOKIE["user"];
if (preg_match('/^[a-z0-9]+$/i', $id)) {
} else {
//INVALID USER NAME
exit("Critical error");
}
}
?><?PHP
$server = getcwd();
$a2 = $_COOKIE["site"];
if (isset($_COOKIE["user"]) and $a2 == $server) {
$id = $_COOKIE["user"];
$zid = $_COOKIE["auth"];
if (file_exists("data/users/$id.php")) {
include ("data/users/$id.php");
include ("data/users/$userid.php");
}
if ($zid == $password) {

if (file_exists("data/users/$id.php")) {
include ("data/users/$id.php");

//LOGGED IN

echo "<h2>$dname</h2>";

if ($usaavatar == "") {
echo "<p align='center'/><img height='125px' width='125px' src='images/noav.jpg'/><br><a href='admin2.php?dand=login&log=out'/>Logout</a><br><a href='admin2.php?dand=usercp'/>User settings</a>";

if ($admin > "0") {
echo "<br><a href='admin.php'/>Admin</a>";
}

echo "</p>";

} else {
echo "<p align='center'/><img height='125px' width='125px' src='$usaavatar'/><br><a href='admin2.php?dand=login&log=out'/>Logout</a><br><a href='admin2.php?dand=usercp'/>User settings</a>";

if ($admin > "0") {
echo "<br><a href='admin.php'/>Admin</a>";
}

echo "</p>";
}

//LOGGED IN - END

} else {
setcookie("user", "", time()-3600);
setcookie("auth", "", time()-3600);
setcookie("site", "", time()-3600);
 ?>
<h2>Welcome, Guest!</h2>

<p>You are currently not logged in.<br><br> Click <a href='admin2.php?dand=login'/>here</a> to login<?PHP
include("data/settings.php");
if ($canregister == "yes") {
echo " or <a href='admin2.php?dand=register'/>here</a> to register.</p>"; } else {
echo ".</p>";
 }
}
 } else { ?>

<h3>Invalid Authentication</h3>
<p>The logged Authentication seems to be invalid. Simply <a href="admin2.php?dand=login&log=out"/>logout</a> and login again to fix this.</p>
<?PHP }

 } else { 
 
 setcookie("user", "", time()-3600);
setcookie("auth", "", time()-3600);
setcookie("site", "", time()-3600);
 ?>

<h2>Welcome, Guest!</h2>

<p>You are currently not logged in.<br><br> Click <a href='admin2.php?dand=login'/>here</a> to login<?PHP
include("data/settings.php");
if ($canregister == "yes") {
echo " or <a href='admin2.php?dand=register'/>here</a> to register.</p>"; } else {
echo ".</p>";
}
?>
<?PHP } ?>
Return current item: Potato News