right, this make take a while to read, but its a simple problem for any expert i think. (go to toilet if u need 🙂 )
right i have a page which i make admins use to log in to post messages for my main page bulletin board.
and when they log in it takes you to a page where you can choose what you want to do.
this page has only 1 option, but it'll have more soon.
anyways.......on this page i load the variables from the form on the previous page (user & password)
which i want to load from a database instead of loading from the
page.
here is my coding for the options page so far....
// Check to see if $user and %password contains info
if (!$user | !$password) {
// If empty, send header causing dialog box to appear
echo 'Authorization Required';
exit;
}
// check database to see if the user with pass exists
else if ($user&&$password) {
if ($user==pass&&$password==user) {
?>
<font face=verdana size=1>
Welcome <? echo "$user"; ?><br><br>
-- Choose An Action -- <script language="Javascript"><!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>
</form>
<form name="AutoListBox3">
<select name="ListBoxURL" size="1" language="javascript"
onchange="gotoLink(this.form);" class="nav">
<option selected>--[Menu]--</option>
<option value="../newmessage.php">Post A Message</option>
</select>
</div><script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>
<br>
</font>
<?
}
else if ($user != pass | $password != user) {
echo "<font face=verdana size=1>";
echo "Authorization Required<br>";
echo "Your Not Authorized, Try The Right Password/Username Next Time<br><br>";
}
}
firstly i want to know how i can load the user name and password from a database
i know how to load them, but not in a way to implement auth!
then i want to store these variables posted, so that when the admin
goes into post a message it requires authorization, from those variables it will unlock the page.
or echo an error message.
my coding for this page so far is
if (!$user | !$password) {
// If empty, send header causing dialog box to appear
echo '<font face=verdana size=1>Authorization Required<br><br><Br><br><font size=-10>Hacker :P<Br><Br>';
}
// check database to see if the user with pass exists
else if ($user&&$password) {
if ($user==pass&&$password==user) {
?>
<form method="GET" action="submit.php">
<p align="center"><font face="Verdana" size="2">Who Are You<br>
<select size="1" name="writer">
<option selected>-- Person --</option>
<option>Comms</option>
<option>Pager</option>
<option>DOA</option>
</select></font></p>
<p align="center"><font face="Verdana" size="2">Headline<br>
<input type="text" name="headline" size="20"></font></p>
<p align="center"></p>
<p align="center"><font face="Verdana" size="2">Message<br>
</font><font size="1" face="Verdana"><textarea rows="13" name="story" cols="35"></textarea></font></p>
<p align="center"><font face="Verdana" size="2">Your Image Src<br>
<select size="1" name="user_image">
<option selected>-- Your Image --</option>
<option>/images/comms.gif</option>
<option>/images/pager.gif</option>
<option>/images/doa.gif</option>
</select></font></p>
<p align="center"><font face="Verdana" size="1"><input type="submit" value="Insert"></font></p>
</form>
<?
}
else if ($user != pass | $password != user) {
echo "<font face=verdana size=1>";
echo "Authorization Required<br>";
echo "Your Not Authorized, Try The Right Password/Username Next Time<br><br>";
}
}
so what i need help with is
Authentication The Users From A Database
Storing (And Posting) The Variables (Using Cookies, If So Needs Explaning)
Using Them In The Message Posting Page To Implement More Authorization
if anyone can do this it would be a great help
as always - thnks in advance 🙂