connect_errno) { err_msg("Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error); } $query = "SELECT id as uid FROM user WHERE (name='".$uname."' OR email='".$uname."') AND pwd=MD5('".$pwd."')"; if(!($res=$mysqli->query($query))) err_msg("MYSQL-error:".$mysqli->errno.":".$mysqli->error." query:".$query); $row = $res->fetch_assoc(); //print_r($row); if(count($row) == 1) { $_SESSION['login'] = true; $_SESSION['uname'] = $uname; $_SESSION['uid'] = $row['uid']; } else $loginfailed = true; } /* login end */ if(isset($_GET['r'])) { switch($_GET['r']) { case 'join': $javascript[0] = BASE_DIR."join.js"; $require = "join.php"; $title = "Join Streak-Challenge"; break; case 'news': $require = "news.php"; $title = "Streak-Challenge - News"; break; case 'kontakt': $require = "kontakt.php"; $title = "Kontakt Streak-Challenge.com"; break; case 'achievement': $require = "achievement.php"; $title = "Streak-Challenge - Achievements"; break; case 'level': $require = "level.php"; $title = "Streak-Challenge - Level"; break; case 'country': $require = "country.php"; $title = "Streak-Challenge - Country"; break; case 'banner': $require = "banner.php"; $title = "Streak-Challenge - Banner"; $requireslogin = true; break; case 'profile': if(!isset($_GET['p1'])) { $requireslogin = true; } include('profile_top.inc.php'); $require = "profile.php"; $title = "Streak-Challenge - Profile of ".$userdata['name']; break; case 'messages': $requireslogin = true; include('profile_top.inc.php'); $require = "messages.php"; $title = "Streak-Challenge - Messages"; break; case 'settings': $requireslogin = true; include('profile_top.inc.php'); $require = "usersettings.php"; $title = "Streak-Challenge - Settings"; break; case 'progress': include('profile_top.inc.php'); $require = "progress.php"; $title = "Streak-Challenge - Progress of ".$userdata['name']; if(!isset($_GET['p1'])) $requireslogin = true; break; case 'wall': include('profile_top.inc.php'); $require = "wall.php"; $title = "Streak-Challenge - Wall of ".$userdata['name']; if(!isset($_GET['p1'])) $requireslogin = true; break; case 'message': include('profile_top.inc.php'); $require = "message.php"; $title = "Streak-Challenge - ".$userdata['name']; $requireslogin = true; break; case 'confirm': $require = "confirm.php"; $title = "Streak-Challenge - Registration "; break; case 'start': $require = "start.php"; $title = "Streak-Challenge"; break; case 'runs': include('profile_top.inc.php'); $require = "runs.php"; if(!isset($_GET['p1'])) $requireslogin = true; $title = "Streak-Challenge - Runs of ".$userdata['name']; break; case 'logout': $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Finally, destroy the session. session_destroy(); $require = "start.php"; $requireslogin = true; $title = "Streak-Challenge"; break; case 'about': default: $require = "about.php"; $title = "About Streak-Challenge"; break; } } /* $require=$_GET['r'].".php"; if(empty($require)) $require = "about.php"; $javascript[0] = BASE_DIR."join.js"; */ ?> <? echo $title; ?> '; } } ?>