Jump to content

[SOLVED] Please Help


unidox

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/60703-solved-please-help/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/60703-solved-please-help/#findComment-302335
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.