Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2006, 03:57 PM
Authorized User
 
Join Date: Apr 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chayanvinayak
Default check whether a particular session exists or not

how can i check whether a specified/particular session exists or not.



i.e.
  setting session - session_id('xxx');

  checking 'sess_xxx' exist or not - if(isset(session_id($userid)))


i have used following script but it gives error at line 12 (if(isset(session_id($userid)))









<?php
mysql_connect ("localhost", "game_cvg", "cvg") or die ('cannot connect : ' . mysql_error());
mysql_select_db("game_accounts") or die ('cannot select database because: ' . mysql_error());
$userid = $_GET['$userid'];
$password = $_GET['$password'];
$result = mysql_query("select session from accounts where userid='$userid'");
$row = @mysql_fetch_assoc($result);
echo $row["session"];


session_id($userid);
if(isset(session_id($userid))){
  echo 'You are already logged in';
}
else{
  echo 'You are allowed to log in';
}

session_start();
echo session_id();

?>

chayan vinayak goswami
__________________
chayan vinayak goswami
 
Old May 1st, 2006, 04:09 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You might start with reading my reply to your last thread on this topic.

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
check whether COM object exists EddyT C# 0 June 15th, 2007 04:10 AM
How to check if exists BEFORE the Insert rtr1900 Classic ASP Databases 0 December 20th, 2006 07:04 AM
check first to see if the file exists crmpicco Classic ASP Professional 2 December 1st, 2005 12:34 PM
how to check that node is exists debuajm General .NET 0 June 8th, 2004 02:07 AM
How to check if connection already exists Ciarano VB How-To 3 March 9th, 2004 10:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.