Miért nem működik a bejelentkezés?
Ha a felhasználó azonosítva lett, és az adatok helyesek, akkor az "sk.php" ra szeretném ha átirányítani!
<?php
include 'dbc.php';
$user_email = mysql_real_escape_string($_POST['email']);
if ($_POST['Submit']=='Login')
{
$md5pass = md5($_POST['pwd']);
$sql = "SELECT id,user_email FROM users WHERE
user_email = '$user_email' AND
user_pwd = '$md5pass' AND user_activated='1'";
$result = mysql_query($sql) or die (mysql_error());
$num = mysql_num_rows($result);
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
session_start();
list($user_id,$user_email) = mysql_fetch_row($result);
// this sets variables in the session
$_SESSION['user']= $user_email;
if (isset($_GET['ret']) && !empty($_GET['ret']))
{
header("Location: $_GET[ret]");
} else
{
header("Location: myaccount.php");
}
//echo "Logged in...";
exit();
}
header("Location: login.php?msg=Hibás adatok");
//echo "Error:";
exit();
}
?>
<meta content="text/plain; charset=UTF-8" http-equiv="content-type">
<link href="styles.css" rel="stylesheet" type="text/css">
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>SilentKiller - Bejelentkezés</title>
<link rel="stylesheet" type="text/css" href="css/index_green.css"/>
<link rel="shortcut icon" href="images/icon.ico">
</head>
<body>
<div class="login_resz">
<a href="index.html"><img src="images/bannernew.jpg" alt="Silent killer"></a>
<div id="login_resz2">
<p align="center">E-mail:
<input name="email" type="text" id="email">
</p>
<p align="center"> Jelszó:
<input name="pwd" type="password" id="pwd">
</p>
<p align="center">
<input type="submit" name="Submit">
</p>
<p align="center"><a href="register.php">Regisztráció</a> | <a href="forgot.php">Elfelejtett jelszó</a></p>
</form>
</div>
</div>
</body>
</html>
bocsi
<?php
include 'dbc.php';
$user_email = mysql_real_escape_string($_POST['email']);
if ($_POST['Submit']=='Login')
{
$md5pass = md5($_POST['pwd']);
$sql = "SELECT id,user_email FROM users WHERE
user_email = '$user_email' AND
user_pwd = '$md5pass' AND user_activated='1'";
$result = mysql_query($sql) or die (mysql_error());
$num = mysql_num_rows($result);
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
session_start();
list($user_id,$user_email) = mysql_fetch_row($result);
// this sets variables in the session
$_SESSION['user']= $user_email;
if (isset($_GET['ret']) && !empty($_GET['ret']))
{
header("Location: $_GET[ret]");
} else
{
header("Location: myaccount.php");
}
//echo "Logged in...";
exit();
}
header("Location: login.php?msg=Hibás adatok");
//echo "Error:";
exit();
}
?>
<meta content="text/plain; charset=UTF-8" http-equiv="content-type">
<link href="styles.css" rel="stylesheet" type="text/css">
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>SilentKiller - Bejelentkezés</title>
<link rel="stylesheet" type="text/css" href="css/index_green.css"/>
<link rel="shortcut icon" href="images/icon.ico">
</head>
<body>
<div class="login_resz">
<a href="index.html"><img src="images/bannernew.jpg" alt="Silent killer"></a>
<div id="login_resz2">
<p align="center">E-mail:
<input name="email" type="text" id="email">
</p>
<p align="center"> Jelszó:
<input name="pwd" type="password" id="pwd">
</p>
<p align="center">
<input type="submit" name="Submit">
</p>
<p align="center"><a href="register.php">Regisztráció</a> | <a href="forgot.php">Elfelejtett jelszó</a></p>
</form>
</div>
</div>
</body>
</html>
Kapcsolódó kérdések:
Minden jog fenntartva © 2024, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!