Jump to content

updating session


chris_s_22

Recommended Posts

any ideas how i update my session?

 

when someone logs into site it creates a session

// Now encrypt the data to be stored in the session
     $encrypted_id = md5($user['id']);
     $encrypted_name = md5($user['username']);

     // Store the data in the session
     $_SESSION['id'] = $id;
     $_SESSION['username'] = $username;
     $_SESSION['encrypted_id'] = $encrypted_id;
     $_SESSION['encrypted_name'] = $encrypted_name;

 

this code is what im using

$query = "UPDATE members SET username = '$newusername' WHERE username = '$username'";
$result= mysql_query ($query) or die ('Could not create user.');
// if suceesfully inserted data into database, 
if($result)
{
$_SESSION['username'] = $newusername;
header('Location: home.php');
}

as you can see this updates the username then redirects to home.php

this page checks if the user is_authed so i need to update session data

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/182510-updating-session/
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.