The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Is the a way of doing this easily without having to have people log in? I'm using SmartFTP and wondered if I could do it through there somehow, but I haven't managed to figure it out.
Many thanks.
Is the a way of doing this easily without having to have people log in? I'm using SmartFTP and wondered if I could do it through there somehow, but I haven't managed to figure it out.
Many thanks.
$pretext = "extrakeyword_";
$format = ".data";
$filename = "$pretext$password$format";
if(file_exists($filename) == TRUE)
{ include("$filename"); }
else
{ print("Go away"); }
; ?>
The variable $password is posted by a form that points to this login page. For this example, you password is "donkeyballs". Then the script searches for a file called "extrakeyword_donkeyballs.data". If it exists, it includes the file, which will contain all your admin features. Else it tels you to "Go away!". You need to create the file called "extrakeyword_donkeyballs.data" for it to be found and included. Simple really, and you can use a PHP cookie to set and retrieve the password.
I don't really know anything about coding in PHP. What do I include in the file?
Set up a log-in form (username / password) and pass on this form data to another page, with a script something vaguely like :
then,
Switch ($username)
---case ($
---$userentry1 = yes
---$userentry2 = no
---case ($
---$userentry1 = yes
---$userentry2 = yes
(A Switch statment is like an easy way to do nested IF's)
Then, on every page you want to protect, use the session thingy along with a condition like :
IF ($userentry1 = yes) AND ($usernetry2=no) [i.e not staff]
THEN
Works a treat for me.
session_start();
session_register('status1','status2' (SPACE),'username2','password2');
?>
That's on my index before any other code. It basically opens a session, and lists the variables this session will use. You'll probably only need 'status1'.
Then, on every page you want to use sessions :
session_start();
if ( @$status2 != "Yes" )
{
header("Location: register.php");
exit();
}
?>
That basically checks $status2 and acts based on it's contents, in this case, going to /register.php.
Quick lesson on switch statements
switch ($memberPass)
{
case "fruitypie" :
$status1="No";
$status2="No";
echo
break;
case "monkey" :
$status1="No";
$status2="No";
echo
break;
default :
$status1="No";
$status2="No";
echo
break;
}
It's the first few lines of my uber-complex (;D) set of statements to determined users, wrong inputs and the like. You can have as many of the cases as you like.
If it isn't then it makes your site vulnerable to fairly simple attacks on that kind of code snippet. The code can be fairly easily modified to prevent the attacks though.
PHP seems similar to 'C' in some ways. I wonder if there's a program that can convert C to php....
> With something like that code, for security it's worth checking to see
> if Safe Mode is enabled. Either ask your ISP or upload a PHP file
> containing:
>
>
I've just checked, Safe Mode is on.
Thanks for informing :)