Jump to content

How to check session set?


SUNIL16

Recommended Posts

Hi Friends, I am doing one forum. for that  i created registration and now i want to check whether the session is set or not because only registered members can post topic

below is code i am using for session register

<?php
session_start();

$sql = "SELECT * FROM `register` WHERE `username`='$username' and `password`='$password'";
$result = mysql_query($sql) or die("Could not run the query: ".mysql_error());

$count = mysql_num_rows($result);

if($count == 1) {
$_SESSION["myusername"] = $username;
$_SESSION["mypassword"] = $password; 
include("sucess.php");
} else {
echo "There is no one by that username.";
}
?>

if session is set and he is member he can post topic.

Link to comment
https://forums.phpfreaks.com/topic/116986-how-to-check-session-set/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.