I'm trying to figure out a way for a logged in user to make entries into a database, so that their company, username and password are automatically entered along with the data they manually enter on the form I've made (item, description, price, etc). I'm working with prexisting code, so I don't want to change it too much for fear of breaking another part of it.
From what I gather, I will need to use the session, and the values associated with it, to identify the current user. Presently, the Logincheck.php page only associates the username and session id with the session. Here's where I'm not sure how to proceed. Should I:
A- assign the username, company and password in the session, and how to I add those? I tried, but I think my syntax was bad.
B- make an array that's tied to the session by the username and extract (somehow) the compnay and password from the database using the username?
This code uses session_is_registered(), which I have read should not be used. I tried using the global session method, but didn't have any luck. I would like to try to figure this part out first before trying to tacke that, since it seems like it might need to be addressed eventually anyway.
Here's the code for the Logincheck.php page:
Code: Select all
<?
// this needs to be on every page, it makes it remember all of the set variables that is done on the login_script.php
session_start();
if (session_is_registered("valid_user")) {
session_save_path("$id.txt");
}
else { header ("Location: login.php"); }
?>Steve