Forum Moderators: coopster
I am trying to develop a site that is driven by a MYSQL database. Dependant on which domain you have been redirected from I need to somehow pickup the domain redirected from and set a global constant to only pull from relative MySQL data e.g FOO = xyz.
This site will obviously have multiple users and I need a way to ensure that user A will be browsing xyz while user B will be browsing abc.
The way I can think of but not entirely sure how to get working in PHP is to assign a Value to the session (FOO) and then on database queries uses WHERE foo_ID = (FOO).
## used to get info from the Admin script##
$username=$_POST['username'];
$password=$_POST['password'];
## Initiate the session
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
## TOP Admin script ##
<?php
session_start();
//session_register("auth_user"); // is any means to verify P word and U name
if (!check_auth_user())
then offer the login form
or if loged
$password=$_POST['password'];
$username=$_SESSION['username'];
## then do a "select" ##
$sql = "select * from users where username= '$username and password = '$password' "
if you use a function like the suggested one ("auth_user")
then the "select" becomes
$sql = "select * from users where id = '$auth_user' "
Edit: you should try to implement a user authentication
that will create an ID and log Username and Passowrd
the session (If loged in) will carry the info across the site, so you allow an user to access only info that is tied with the ID.
/edit
Hope this help
Henry