Forum Moderators: coopster
There are, however, plenty of pre-written free scripts available. Have a search on these sites:
Sourceforge [sourceforge.net]
Hotscripts [hotscripts.com]
Freshmeat [freshmeat.net]
<?php
$username = 'mat';switch ($username)
{
case 'mat':
header ('location: [mydomain.com...]
break;case 'bea':
header ('location: [mydomain.com...]
break;case 'gary':
header ('location: [mydomain.com...]
break;default:
header ('location: [mydomain.com...]
break;
}
exit();
?>
That will divert to a folder depending on the value of $username.
<?php
if (isset($_SERVER['PHP_AUTH_USER']))
{
$username = $_SERVER['PHP_AUTH_USER'];
switch ($username)
{
case 'mat':
header ('location: [mydomain.com...]
break;case 'bea':
header ('location: [mydomain.com...]
break;case 'gary':
header ('location: [mydomain.com...]
break;default:
header ('location: [mydomain.com...]
break;
}
exit();
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You are not authorised to access this page';
exit;}
?>
You'll have to change "My Realm" to your http authentication realm name or just remove that part altogether if you don't need it.
What you are asking is a relatively complex and time-consuming task. From my experience, those programmers who are competent enough to write a login system will usually charge for it, I know I do.
Money exchange on the forum is not really relevant
What matters is that such a script may call and certainly will for classes and functions and a good MySQL understanding so even writing it for you does not help you to become a better PHP coder.
Try to get a better PHP understanding
And come back with some script draft, then many members will point to your errors and suggest fixes
Have fun!