Hey guys
I'm writing a multiple user log in system using PHP and MySql, the way i have done it in the past is to have a central "processing" file that will handle all of the code on the backend, like logging in, messaging other users etc..., I've used forms with hidden fields to define which action to perform in the processing file.
heres a quick example.
the login form:
<form method="post" action="process.php">
Username:<input type="text" name="username" /><br />
Password:<input type="password" name="password" /><br />
<input type="hidden" name="action" value="login" />
<input type="submit" value="Login" />
</form>
the processing file:
<?
$action = strtolower($_REQUEST['action']);
switch ($action) {
case "login":
* get the username and password from the form
* query against the SQL database
* set appropriate session data if login was ok
* redirect to homepage for logged in users with a header("Location: home.php");
}
?>
is this the best way to handle this? or should i say be using classes and separate files, including these into the login form. and then post back to the login form and check the data there?
Thanks for reading, cyrix