SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help in session_start

    Hi,

    Why the session start can't call my session variable..it does not echo my session variable.

    Code PHP:
    <?php
    session_start();
    if(isset($_SESSION['username'])){
    include_once("conn.php");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
    <head>
    </head>
    <body>
    <p><?php echo  $_SESSION['username'];?></p>
    <?php
    $tag=mssql_query("Select * from tblUser where UserName='$_SESSION[username]'");
    if($_POST['Save']){
    $oldpass=md5($_POST['oldpass']); 
     
    	$rpass=mssql_fetch_assoc(mssql_query("Select * from tblUser"));
    	if($oldpass==$rpass['Pass']){
    		//mssql_query("sp_userpass @newpass='$_POST[newpass]',@tag='0'");
    		echo "Save";
    	}else{
    		echo"<font color='#FF0000'>Old Password not match</font>";
     
    	}
     
    }
    ?>
    <form method='post' action=''>
    <table >
    	<tr>
    		<td align='right'>Old Password :</td><td align='left'> <input type='password' name='oldpass' ></td>
    	</tr>
    	<tr>
    		<td align='right'>New Password : </td><td align='left'><input type='password' name='npass' ></td>
    	</tr>
    	<tr>
    		<td align='right'>Re-Enter Password :</td><td align='left'> <input type='password' name='newpass' ></td>
    	</tr>
    	<tr>
    		<td align='right'></td>
    		<td>
    			<input type='submit' name='Save' value='Save'>
    			<input type='Reset' name='Reset' value='Reset'>
    		</td>	
    	</tr>
    </table>
    </form>
    </body>
    </html>
    <?php
    }else{
    	header('location:login.php');
    }
    ?>

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    Where does the session variable get set?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply..
    i just figure it out on my login form..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •