Jump to content

unidox

Members
  • Posts

    557
  • Joined

  • Last visited

    Never

Everything posted by unidox

  1. I have a cms, and I want it to be able to add custom modules and arrange their order on the sides, like php nuke does. I was just wondering if there was a tutorial on how to do this or not. Thanks
  2. Well, I have been working on a cms, and I got the login and main admin page working, so what I am trying to do is make it so if your not logged it, it redirects you to the login page. But the problem is once it gets to the login page, it continues to redirect from the login page to the login page, so its nonstop. How can I fix this... login.php: <?php $page = "login"; require_once ("inc/db.inc.php"); require_once ("inc/func2.inc.php"); require_once ("req/login.inc.php"); if ($_REQUEST['m']) { if ($_REQUEST['m'] == "1") { $loginpass = $_POST['login_pass']; $password = md5($loginpass); $loginname = $_POST['login_name']; $checkrows = mysql_query ("SELECT * FROM cp_users WHERE username='$loginname' && password='$password'") or die (mysql_error()); $rowcount = mysql_num_rows ($checkrows); if ($rowcount == "0") { showError("User/Login Error"); exit; } if ($rowcount != "0") { header ("Location: index.php?page=admin"); $time = date("h:i:a"); $date = date("m/d/Y"); $last_logged = $time . "\n(" . $date . ")"; $ip = getenv ("REMOTE_ADDR"); MYSQL_QUERY("UPDATE cp_users SET last_logged='$last_logged', cur_ip='$ip' WHERE username='$loginname'") or die (mysql_error()); while ($mysql=mysql_fetch_array($checkrows)) { setcookie("access", $mysql[access],time()+60*60*24*30); } setcookie ("uniqueid",$loginname,time()+60*60*24*30); exit; } } elseif ($_REQUEST['m'] == "2") { header ("Location: index.php?page=login"); setcookie ("uniqueid"); setcookie ("access"); exit; } } else { if ($_COOKIE['uniqueid'] == "") { $checkfields = "login_name&login_pass"; $errors = "Enter a username&Enter a password!"; $titles = "Username:&Password:"; $fields = "login_name&login_pass"; $type = "text&password"; $size = "30&30"; $maxlength = "25&25"; createJSValid($checkfields,$errors); createForm($titles,$fields,$type,$size,$maxlength,'1','','','','1'); } else { showError("You are already logged in, <a href=\"" . $_SERVER['PHP_SELF'] . "?page=login&m=2\">logout?</a>"); } } ?> Part of the func2.inc.php: <?php require_once 'config.inc.php'; $islogged = preg_match("/index.php?page=login/", $_SERVER['PHP_SELF']); if ($islogged == "0") { if ($_COOKIE['uniqueid'] == "") { header ("Location: index.php?page=login"); exit; } } if ((!$_REQUEST['method']) || (!$_COOKIE['uniqueid'])) { $access = $_COOKIE['access']; if (array_search($page,$levels)) { if ($access > $levels[$page]) { echo $access . $levels[$page]; //showError('You do not have access to this page.'); exit; } } } How can I fix this?
  3. Well right now, if you go to login.php it logins fine, but what I am trying to do is make the url instead of site.com/login.php into site.com/index.php?page=login cause when u enter the login info, the url is site.com/index.php?m=2 which I dont want and doesnt work.
  4. Login.php code: <?php $page = "login"; require_once ("inc/db.inc.php"); require_once ("inc/func2.inc.php"); if ($_REQUEST['m']) { if ($_REQUEST['m'] == "1") { $loginpass = $_POST['login_pass']; $password = md5($loginpass); $loginname = $_POST['login_name']; $checkrows = mysql_query ("SELECT * FROM cp_users WHERE username='$loginname' && password='$password'") or die (mysql_error()); $rowcount = mysql_num_rows ($checkrows); if ($rowcount == "0") { showError("User/Login Error"); exit; } if ($rowcount != "0") { header ("Location: admin.php"); $time = date("h:i:a"); $date = date("m/d/Y"); $last_logged = $time . "\n(" . $date . ")"; $ip = getenv ("REMOTE_ADDR"); MYSQL_QUERY("UPDATE cp_users SET last_logged='$last_logged', cur_ip='$ip' WHERE username='$loginname'") or die (mysql_error()); while ($mysql=mysql_fetch_array($checkrows)) { setcookie("access", $mysql[access],time()+60*60*24*30); } setcookie ("uniqueid",$loginname,time()+60*60*24*30); exit; } } elseif ($_REQUEST['m'] == "2") { header ("Location: login.php"); setcookie ("uniqueid"); setcookie ("access"); exit; } } else { if ($_COOKIE['uniqueid'] == "") { $checkfields = "login_name&login_pass"; $errors = "Enter a username&Enter a password!"; $titles = "Username:&Password:"; $fields = "login_name&login_pass"; $type = "text&password"; $size = "30&30"; $maxlength = "25&25"; createJSValid($checkfields,$errors); createForm($titles,$fields,$type,$size,$maxlength,'1','','','','1'); } else { showError("You are already logged in, <a href=\"" . $_SERVER['PHP_SELF'] . "?m=2\">logout?</a>"); } } ?> But when u enter a user and pass, the url looks like: site.com/index.php?m=1 when I want it to look like: site.com/index.php?page=login&m=1 how would I do that
  5. Like, I saw this one site, that to get to the admin panel, you had to subtract the day from the year. I was just wondering how you can do that
  6. Is it possible to have an if ($_REQUEST so like you go: index.php?id= the month minus the day and whatnot
  7. I added that, but now I got: Parse error: syntax error, unexpected T_IF in /home/clansuni/public_html/index.php on line 23
  8. So are you saying, move all the php script on top of that?
  9. I am making a new cms where it is built into the site. But I keep getting this error: Warning: Cannot modify header information - headers already sent by (output started at *****:16) in *****inc/func.inc.php on line 10 Here is my index.php: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <!-- This is where the main body will go --> Testing <!-- This starts the admin panel --> <?php /* Login Panel */ if ($_REQUEST['adm'] == "login") { $page = "Login"; require_once ("inc/db.inc.php"); require_once ("inc/func.inc.php"); if ($_REQUEST['m']) { if ($_REQUEST['m'] == "1") { $loginpass = $_POST['login_pass']; $password = md5($loginpass); $loginname = $_POST['login_name']; $checkrows = mysql_query ("SELECT * FROM admin_users WHERE username='$loginname' && password='$password'") or die (mysql_error()); $rowcount = mysql_num_rows ($checkrows); if ($rowcount == "0") { showError("User/Login Error"); exit; } if ($rowcount != "0") { header ("Location: index.php?adm=home"); $time = date("h:i:a"); $date = date("m/d/Y"); $last_logged = $time . "\n(" . $date . ")"; $ip = getenv ("REMOTE_ADDR"); MYSQL_QUERY("UPDATE admin_users SET last_logged='$last_logged', cur_ip='$ip' WHERE username='$loginname'") or die (mysql_error()); while ($mysql=mysql_fetch_array($checkrows)) { setcookie("access", $mysql[access],time()+60*60*24*30); } setcookie ("uniqueid",$loginname,time()+60*60*24*30); exit; } } elseif ($_REQUEST['m'] == "2") { header ("Location: index.php?adm=login"); setcookie ("uniqueid"); setcookie ("access"); exit; } } else { if ($_COOKIE['uniqueid'] == "") { $checkfields = "login_name&login_pass"; $errors = "Enter a username&Enter a password!"; $titles = "Username:&Password:"; $fields = "login_name&login_pass"; $type = "text&password"; $size = "30&30"; $maxlength = "25&25"; getHeader(); createJSValid($checkfields,$errors); createForm($titles,$fields,$type,$size,$maxlength,'1','','','','1'); } else { showError("You are already logged in, <a href=\"" . $_SERVER['PHP_SELF'] . "?m=2\">logout?</a>"); } } } ?> </body> </html> Here is part of my inc/func.inc.php(lines 0 -50): <?php require_once 'config.inc.php'; $oncolour = "#BCD5FE"; $offcolour = "#FFFFFF"; $bdrcolour = "#F0F0F0"; $islogged = preg_match("/index.php?adm=login/", $_SERVER['PHP_SELF']); if ($islogged == "0") { if ($_COOKIE['uniqueid'] == "") { header ("Location: index.php?adm=home"); exit; } } if ((!$_REQUEST['method']) || (!$_COOKIE['uniqueid'])) { $access = $_COOKIE['access']; if (array_search($page,$levels)) { if ($access <= $levels[$page]) { // less than or equal to as the higher you go the less privileges you have echo $access . $levels[$page]; //showError('You do not have access to this page.'); exit; } } } $browser = 'An Unidentified Browser'; $viewer = getenv('HTTP_USER_AGENT'); if (preg_match( "/MSIE/i", "$viewer" ) ) { $browser = 'Internet Explorer'; } if (preg_match( "/Netscape/i", "$viewer" ) ) { $browser = 'Netscape'; } if (preg_match( "/Opera/i", "$viewer" ) ) { $browser = 'Opera'; } if (preg_match( "/Firefox/i", "$viewer" ) ) { $browser = 'Mozilla Firefox'; } Please help.
  10. How do I sort a list alphabetically?
  11. next time for you code use: [code] [/code]
  12. php.net, I am not going to create a code for you.
  13. If you have phpmy admin you can export
  14. SELECT * FROM table LIMIT 10, 20 should work. Unless you have the same id, but i think that is impossible
  15. Damn, chigley posted the answer b4 me
  16. SELECT * FROM table_id LIMIT 1, 9 //This means that it wil grab the id from 1-9 and none others
  17. Setup a dns server, like simpledns although you do have to pay, but worth it. Then you can add a domain and setup multiple hosts on one apache server!
  18. Like I said and you can even use the asp and php for dummies book I have over 23
  19. I like the text and colors, but make the nav stand out
  20. You need spaces if ($Start2 > 35, $Display > 4) { print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>1</b></font>"; }else{ print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>2</b></font>"; }
  21. Goto www.w3schools.com and compare
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.