<?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 = "oturum.php"; [COLOR="Red"][B]//////// Hocam bu kısım eğer şifre doğruysa açılacak sayfanın linki[/B][/COLOR]
$MM_redirectLoginFailed = "hata.php?hatakodu=2"; [COLOR="Red"][B]//////// Bu kısımda hata olduğunda açılacak sayfa ve oluşan hatayı veritabanından çektiriyorum.[/B][/COLOR]
$MM_redirecttoReferrer = false;
mysql_select_db($database_royalworks, $royalworks);
$LoginRS__query=sprintf("SELECT kullanici, sifre FROM giris WHERE kullanici='%s' AND sifre='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $royalworks) 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 );
}
}
?>