auriaks
11-07-2009, 11:03 AM
Hi,
i have session like this:
<?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 .= "";
}
if($_POST['nick'] == '') {
$error .= "";
}
if(mysql_num_rows($q) == 0) {
$error .= "<li></li>";
}
if(isset($error)) {
echo '<font color="#ff0000">';
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: http://www.xz.lt/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
header("Location: http://www.xz.lt/login.php");
}
?>
The thing is, that i want some text be written only when session is on... when i logged i can see, when im not logged i cant. :) i really need help with that. THANKS :)
i have session like this:
<?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 .= "";
}
if($_POST['nick'] == '') {
$error .= "";
}
if(mysql_num_rows($q) == 0) {
$error .= "<li></li>";
}
if(isset($error)) {
echo '<font color="#ff0000">';
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: http://www.xz.lt/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
header("Location: http://www.xz.lt/login.php");
}
?>
The thing is, that i want some text be written only when session is on... when i logged i can see, when im not logged i cant. :) i really need help with that. THANKS :)