3 Replies - 900 Views - Last Post: 30 June 2008 - 10:54 PM Rate Topic: -----

#1 maximator5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-June 08

Index page+Login Page all in one not working!

Posted 27 June 2008 - 08:54 AM

Hi there, here is the code of my page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="author" content="MaximatoR">
<meta name="generator" content="Liberty Hood">
<title>|==-==| Liberty Hood |==-==| Crime never sleeps! |==-==|</title>

<style type="text/css">
/*----------Text Styles----------*/
.ws6 {font-size: 8px;}
.ws7 {font-size: 9.3px;}
.ws8 {font-size: 11px;}
.ws9 {font-size: 12px;}
.ws10 {font-size: 13px;}
.ws11 {font-size: 15px;}
.ws12 {font-size: 16px;}
.ws14 {font-size: 19px;}
.ws16 {font-size: 21px;}
.ws18 {font-size: 24px;}
.ws20 {font-size: 27px;}
.ws22 {font-size: 29px;}
.ws24 {font-size: 32px;}
.ws26 {font-size: 35px;}
.ws28 {font-size: 37px;}
.ws36 {font-size: 48px;}
.ws48 {font-size: 64px;}
.ws72 {font-size: 96px;}
.wpmd {font-size: 13px;font-family: 'Arial';font-style: normal;font-weight: normal;}
/*----------Para Styles----------*/
DIV,UL,OL /* Left */
{
 margin-top: 0px;
 margin-bottom: 0px;
}
</style>

<style type="text/css">
div#container
{
	position:relative;
	width: 800px;
	margin-top: 0px;
	margin-left: auto;
	margin-right: auto;
	text-align:left; 
}
body {text-align:center;margin:0}
</style>

<script language="Javascript1.4" type="text/javascript">
<!--
function jsPlay(soundobj) {
 var thissound= eval("document."+soundobj);
 try {
	 thissound.Play();
 }
 catch (e) {
	 thissound.DoPlay();
 }
}
//-->
</script>

<script language="javascript" type="text/javascript">
<!--
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//-->
</script>

</head>

<body background="images/bg.JPG" bgColor="#000000">

<div id="container">
<div id="image1" style="position:absolute; overflow:hidden; left:0px; top:15px; width:800px; height:78px; z-index:0"><img src="images/logo.JPG" border=0 width=800 height=78></div>

<div id="image2" style="position:absolute; overflow:hidden; left:0px; top:92px; width:800px; height:36px; z-index:1"><img src="images/bar.JPG" border=0 width=800 height=36></div>

<div id="image3" style="position:absolute; overflow:hidden; left:0px; top:566px; width:800px; height:34px; z-index:2"><img src="images/bar2.JPG" border=0 width=800 height=34></div>

<div id="text2" style="position:absolute; overflow:hidden; left:560px; top:567px; width:238px; height:19px; z-index:3"><div class="wpmd">
<div><font class="ws9" color="#FFFFFF" face="Symbol"></font> <font class="ws8" color="#FFFFFF">Copyright MaximatoR 2008 All rights reserved!</font></div>
</div></div>

<div id="nav1" style="position:absolute; left:96px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav10','','images/nav122741090a.gif',1)" href="#"><img name="nav10" onload="MM_preloadImages('images/nav122741090a.gif')" alt="" border=0 src="images/nav122741090i.gif"></a></div>
<div id="nav1" style="position:absolute; left:198px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav11','','images/nav122741091a.gif',1)" href="#"><img name="nav11" onload="MM_preloadImages('images/nav122741091a.gif')" alt="" border=0 src="images/nav122741091i.gif"></a></div>
<div id="nav1" style="position:absolute; left:300px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav12','','images/nav122741092a.gif',1)" href="#"><img name="nav12" onload="MM_preloadImages('images/nav122741092a.gif')" alt="" border=0 src="images/nav122741092i.gif"></a></div>
<div id="nav1" style="position:absolute; left:402px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav13','','images/nav122741093a.gif',1)" href="#"><img name="nav13" onload="MM_preloadImages('images/nav122741093a.gif')" alt="" border=0 src="images/nav122741093i.gif"></a></div>
<div id="nav1" style="position:absolute; left:504px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav14','','images/nav122741094a.gif',1)" href="#"><img name="nav14" onload="MM_preloadImages('images/nav122741094a.gif')" alt="" border=0 src="images/nav122741094i.gif"></a></div>
<div id="nav1" style="position:absolute; left:606px; top:92px; z-index:4"><a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('nav15','','images/nav122741095a.gif',1)" href="#"><img name="nav15" onload="MM_preloadImages('images/nav122741095a.gif')" alt="" border=0 src="images/nav122741095i.gif"></a></div>

<div id="image4" style="position:absolute; overflow:hidden; left:0px; top:127px; width:217px; height:122px; z-index:5"><img src="images/loginbox.JPG" border=0 width=217 height=122></div>

<div id="text1" style="position:absolute; overflow:hidden; left:13px; top:141px; width:193px; height:105px; z-index:6"><div class="wpmd">
<div><font color="#FFFFFF" face="Cambria">Username:</font></div>
<div><font color="#FFFFFF" face="Cambria"><BR></font></div>
<div><font color="#FFFFFF" face="Cambria">Password:</font></div>
<div><font color="#FFFFFF" face="Cambria"><BR></font></div>
<div><font color="#FFFFFF" face="Cambria"><BR></font></div>
<div><font color="#FFFFFF" face="Cambria"><BR></font></div>
<div><font color="#FFFFFF" face="Cambria">Don't have an account? REGISTER!</font></div>
</div></div>

<?php
	session_start();
	if($_POST) {
		require_once 'config.php';
		$username = $_POST['username'];
		$password = $_POST['password'];		
		$conn = mysql_connect($dbhost,$dbuser,$dbpass)
			or die ('Error connecting to mysql');
		mysql_select_db($dbname);
		$query = sprintf("SELECT COUNT(id) FROM users WHERE UPPER(username) = UPPER('%s') AND password='%s'",
			mysql_real_escape_string($username),
			mysql_real_escape_string(md5($password)));
		$result = mysql_query($query);
		list($count) = mysql_fetch_row($result);
		if($count == 1) {
			$_SESSION['authenticated'] = true;
			$_SESSION['username'] = $username;
			$query = sprintf("UPDATE users SET last_login = NOW() WHERE UPPER(username) = UPPER('%s') AND password = '%s'",
				mysql_real_escape_string($username),
				mysql_real_escape_string(md5($password)));
			mysql_query($query);
			$query = sprintf("SELECT is_in_jail FROM users WHERE UPPER(username) = UPPER('%s') AND password='%s'",
				mysql_real_escape_string($username),
				mysql_real_escape_string(md5($password)));
			$result = mysql_query($query);
			list($is_admin) = mysql_fetch_row($result);
			if($is_admin == 1) {
				header('Location:jail.php');			
			} else {
				header('Location:details.php');				
			}
		} else {	?>
<span style='color:red'>Error: that username and password combination does not match any currently within our database.</span>
<?php	}
	}
?>

<form name="login" method="POST">
<input name="username" type="text" maxlength=15 style="position:absolute;width:125px;left:77px;top:139px;z-index:7">
<input name="password" type="password" maxlength=15 style="position:absolute;width:125px;left:77px;top:169px;z-index:8">
<input name="submit" type="submit" value="Enter the Hood!" style="position:absolute;left:43px;top:199px;z-index:9">
</form>


</div></body>
</html>


When I try to log in or something like this, it's doesn't work :-? !

This post has been edited by maximator5: 27 June 2008 - 08:55 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Index page+Login Page all in one not working!

#2 level1  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 65
  • Joined: 12-June 08

Re: Index page+Login Page all in one not working!

Posted 27 June 2008 - 09:27 AM

Do you have a file named config.php? Notice it is being included just inside the if($_POST) statement. I'm also guessing this is where all your dB info is going to be. If you don't have one make one with the variables needed by the code and it should get you going.
Was This Post Helpful? 0
  • +
  • -

#3 JBrace1990  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 110
  • View blog
  • Posts: 760
  • Joined: 09-March 08

Re: Index page+Login Page all in one not working!

Posted 27 June 2008 - 06:15 PM

session_start() should be at the beginning of the file, not just the PHP section.... using NuSphere PHP Editor and hitting Run, it came up with that error...
Was This Post Helpful? 0
  • +
  • -

#4 akozlik  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 797
  • Joined: 25-February 08

Re: Index page+Login Page all in one not working!

Posted 30 June 2008 - 10:54 PM

Why are your login page and index all in one page?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1