Hi again, i have problems with redirecttion in the script (header location index.php). its not working. when i log with right info, from login.php it redirects me to the same page - not index.php... Can some1 fix this??? i will be thankfull if you bold your changed place. Many thanks
PHP Code:<table>
<?php
include('db_conn.php');
if(isset($_POST['submit'])) {
$password = md5($_POST[password]);
$q = mysql_query("SELECT * FROM reg_users WHERE Nick='$_POST[nick]' AND Password='$password'") or die(mysql_error());
if($_POST['password'] == '') {
$error .= "<li>Neįrašėte slaptažodžio!</li>";
}
if($_POST['nick'] == '') {
$error .= "<li>Neįrašėte vartotojo -Niko- !</li>";
}
if(mysql_num_rows($q) == 0) {
$error .= "<li>Prisijungimo duomenys neteisingi.</li>";
}
if(isset($error)) {
echo '<font color="#ff0000">Prisijungimas neįvyko. Priežastis:';
echo '<ol>'.$error.'</ol></font>';
} else {
$r = mysql_fetch_array( $q ) or die(mysql_error());
session_start();
$_SESSION['nick'] = $_POST['nick'];
$_SESSION['password'] = md5($_POST['password']);
$_SESSION['authID'] = $r['id'];
header("Location:index.php");
}
}
if($_GET['act'] == 'logout') {
echo '<center><font color="Green">You\'re successfully logged out.</font></center>';
session_unset();
session_destroy(); // remove the entire session
}
?>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<table align='center' width='700px' height='450px' background='images/login_langas.jpg' alt='Fonas'>
<tr valign='center'>
<td align='center'>
<font size="3" color='yellow' face="Verdana"><b>Prisijungimas</b></font><br><br><br><br><br>
<table align='center' width='400px' height='20px'>
<tr valign='center'>
<td>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<font size="1.5" color='blue' face="Verdana">
<td align="right"><font size="1.5" color='yellow' face="Verdana">Vartotojas</font></td>
<td><input type="text" name="nick"></td>
<td align="right"><font size="1.5" color='yellow' face="Verdana">Slaptažodis </font></td>
<td><input type="password" name="password"></td>
<td colspan="2" align="center">
<input type="submit" name="submit" value="Prisijungti">
</td>
</form>
</td>
</tr>
</table>




Reply With Quote

Bookmarks