Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

need help (php session)

This is a discussion on need help (php session) within the PHP forums, part of the Web Development category; i start a new session with : session_start(); then i set some session variable like this : $_SESSION['name']=$_POST['name'];\ and some another variables. at bottom of page i set header to ...

Go Back   Geeks Talk > Web Development > PHP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

PHP PHP - The most popular scripting language. Discuss PHP related questions here. Sample Scripts, Popular downloads, tools and utilites and more...

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-09-2009
Junior Member
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mo_dashti1 is on a distinguished road
need help (php session)

i start a new session with : session_start();
then i set some session variable like this : $_SESSION['name']=$_POST['name'];\
and some another variables.
at bottom of page i set header to diffrent page : header('location: index.php');
exit();
now in new page (index.php i can't access to my session variables, like $_SESSION['name'])
what's wrong ?
thanks.



here is my files :

a.php

========================================

session_start();

require ('config.inc.php');
if(isset($_POST))
foreach($_POST as $v=>$k)
{
$items[$v]=$k;
}

$sql="SELECT * FROM members WHERE username='{$items['user']}' AND pass=MD5('{$items['Password']}') ";
$res=mysql_query($sql);
$row=mysql_fetch_assoc($res);
if($row['username'])
{ $_SESSION['type']=$row['type'];
$_SESSION['name']=$row['name'];
$_SESSION['family']=$row['family'];
$_SESSION['username']=$row['username'];
$_SESSION['date']=$row['date'];

}

header('location: admin.php');
exit();

======================================

admin.php

=====================================

<?php
session_start();
if(!isset($_SESSION['admin']))
{
header('location: index.php');
exit();
}
require ('config.inc.php');

?>

.

.

.

=================================
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-18-2009
Junior Member
 
Join Date: Sep 2009
Location: nasik
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Ashwinilokhande is on a distinguished road
Smile Re: need help (php session)

Happy diwali
Reply With Quote
Reply

  Geeks Talk > Web Development > PHP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Session dnt9862 VB.NET 1 08-21-2009 04:03 AM
Session Variables C D Raghavendra ASP.NET 1 08-04-2008 02:48 AM
bdc session method b_geetha04 SAP R/3 1 06-07-2008 01:06 PM
Kill a session krishnaindia2007 Oracle 2 12-01-2007 01:21 AM
plain asp session rumbleEye ASP.NET 1 11-14-2007 03:31 AM


All times are GMT -4. The time now is 05:45 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved