help me pls.....
i have a login page, where i login, i will go to a page where show all the options which can let user to choose.
everything has been working alrite....until i add the login for moderator. now when i choose the options, i will jump back to the login page. i dono wat is wrong..pls help!!
this is the thing that i added, for moderator and admin login.
<?php
if ((trim($login) == '' || trim($pass) == '') && trim($my_pass) == '' && trim($mod_pass) == '')
{
printheader();
login(1);
printfooter();
print \"<hr style=\\"border-style: outset\\">\n\";
exit;
}
$result = mysql_query(\"SELECT * FROM login_review WHERE login_name = '$login' AND login_passwd = '$pass'\");
if ($result)
{
list ($login_ID, $login_name, $login_passwd, $login_sta) = mysql_fetch_row($result);
}
else
{
if (mysql_num_rows($result) < 1)
{
// Nothing returned, password was invalid
echo \"Wrong password or account doesn't exist for that user!\";
exit;
}
// Password is OK - log the user in
else
{
print \"MySQL Error: \" . mysql_error();
exit;
}
}
$script = getenv(\"SCRIPT_NAME\");
session_start();
$flat = 0;
if ($action == 'login')
{
if ($pass == $login_passwd && $login_sta == 'a')
{
$my_pass = $pass;
$stat = $login_sta;
session_register(\"my_pass\");
session_register(\"stat\");
}
elseif ($pass == $login_passwd && $login_sta == 'm')
{
$mod_pass = $pass;
$stat = $login_sta;
session_register(\"mod_pass\");
session_register(\"stat\");
}
}
else
if ($action == 'config' && $do == 'password' && $do2 == 'password')
{
if ($old_admin_password == $login_passwd && $new_admin_password == $new_admin_password2)
{
$sql = \"UPDATE login_review SET login_passwd = '$new_admin_password'\";
mysql_query($sql);
$my_pass = $new_admin_password;
session_register(\"my_pass\");
$login_passwd = $new_admin_password;
$flat = 1;
}
}
else
{
$my_pass = $HTTP_SESSION_VARS[\"my_pass\"];
if ($action == 'logout')
{
session_destroy();
}
?>
these are all the action carried out when i choose the option:
<?php
if ($action == 'login')
{
if ($login == $login_name && $pass == $login_passwd)
{
show_panel();
}
else
{
print \"<p align=center>Incorrect Password!</p>\";
}
}
elseif ($action == 'logout')
{
logout();
}
else
{
if ($login != $login_name || $my_pass != $login_passwd)
{
login();
}
else
{
if ($action == 'add')
{
add();
}
elseif ($action == 'editUser')
{
editUser();
}
elseif ($action == 'editMod')
{
editMod();
}
elseif ($action == 'addMod')
{
addMod();
}
elseif ($action == 'addRe')
{
addRe();
}
elseif ($action == 'writeRe')
{
writeRe();
}
elseif ($action == 'viewModRe')
{
viewModRe();
}
elseif ($action == 'viewUserRe')
{
viewUserRe();
}
elseif ($action == 'config')
{
config();
}
else
{
show_panel();
}
}
}
?>
this is the function show panel() where i can choose the options:
<?php
function show_panel()
{
global $script, $view_mod, $view_user, $mod_pass, $my_pass, $stat;
$result = mysql_query(\"SELECT * FROM config_review\");
if ($result)
{
list($header, $footer, $url_site, $url_image, $font_face, $font_color, $table_border_color, $table_color_1, $table_color_2, $view_mod, $view_user, $cat_mod, $re_mod) = mysql_fetch_row($result);
}
print \"<script language=\\"JavaScript\\">\n\";
print \"<!-- \n\";
print \"function GoOption(action) {\n\";
print \" if (action != '') {\n\";
print \" document.option.submit();\n\";
print \" }\n\";
print \" }\n\";
print \"\n\";
print \"// -->\n\";
print \"</script>\n\";
print \"<table border=0 cellspacing=0 cellpadding=0 width=100
?>
print \" Review Administration Panel\";
options();
print \"\n\";
print \" \n\";
print \"\n\";
print \"\n\";
print \"\n\";
if ($cat_mod == 'y' || $stat == 'a')
{
print \"Category\n\";
}
if ($stat == 'a')
{
print \"Moderator\n\";
}
if ($cat_mod == 'y' || $stat == 'a')
{
print \"Add a Reviewed Item\n\";
}
print \"Write A Review \n\";
if ($view_mod == 'y' && $stat == 'a')
{
print \"View Moderator's Review\n\";
}
if ($view_user == 'y' && $stat == 'a')
{
print \"View User's Review\n\";
}
if ($stat == 'a')
{
print \"Edit Review Configurations\n\";
}
print \"\n\";
print \" \";
print \"\n\";
print \"\n\";
print \"\n\";
print \" \n\";
print \"\n\";
}
?>
Mark Hensler posted this at 07:53 — 20th November 2001.
He has: 4,048 posts
Joined: Aug 2000
I don't have time to read the whole thing right now...
Are you getting any error messages? or is it just redirecting you?
Have you printed any questionable $vars to see the value?
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.