Jump to content
MakeWebGames

login.php help!


topmorpg

Recommended Posts

Not sure why but the tables are screwying up badly once I start putting in the connection values etc..

http://www.bornmobsters.com/login3.php

Code:

<?php
session_start();
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
//count users and stats display
$sql = "SELECT COUNT(userid) FROM users";
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
$total_users = $row[0];
$sql = sprintf("SELECT COUNT(userid) FROM users WHERE (laston > %u)", time() - 900);
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
$users_online = $row[0];
$users_offline = $total_users - $users_online;
//end stats display info
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
print <<<EOF

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$set['game_name']}</title>
<link rel="SHORTCUT ICON" href="favicon.ico" />
<script language="JavaScript">
<!--

function getCookieVal (offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
   endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg)
     return getCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break;
 }
 return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
 document.cookie = name + "=" + escape (value) +
   ((expires) ? "; expires=" + expires.toGMTString() : "") +
   ((path) ? "; path=" + path : "") +
   ((domain) ? "; domain=" + domain : "") +
   ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
 if (GetCookie(name)) {
   document.cookie = name + "=" +
     ((path) ? "; path=" + path : "") +
     ((domain) ? "; domain=" + domain : "") +
     "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 }
}
// -->
</script>

<script language="JavaScript">
var usr;
var pw;
var sv;
function getme()
{
usr = document.login.username;
pw = document.login.password;
sv = document.login.save;

if (GetCookie('player') != null)
{
	usr.value = GetCookie('username')
	pw.value = GetCookie('password')
	if (GetCookie('save') == 'true')
	{
		sv[0].checked = true;
	}
}

}
function saveme()
{
if (usr.value.length != 0 && pw.value.length != 0)
{
	if (sv[0].checked)
	{
		expdate = new Date();
		expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000));
		SetCookie('username', usr.value, expdate);
		SetCookie('password', pw.value, expdate);
		SetCookie('save', 'true', expdate);
	}
	if (sv[1].checked)
	{
		DeleteCookie('username');
		DeleteCookie('password');
		DeleteCookie('save');
	}
}
	else
{
	alert('You must enter a username/password.');
	return false;
}
}
</script>

<style type="text/css">
<!--
body {
background-color: #000000;
}
a:link {
color: #42465A;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #42465A;
}
a:hover {
text-decoration: none;
color: #CED6CD;
}
a:active {
text-decoration: none;
color: #D6D6D6;
}
-->
</style></head>
<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"  onload=\"getme();\">
EOF;
print "


<div align=\"center\">
<form action=\"authenticate.php\" method=\"post\" name=\"login\" onsubmit=\"return saveme();\">
<table id=\"Table_01\" width=\"950\" height=\"751\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
	<td colspan=\"9\">
		<img src=\"images/index_01.gif\" width=\"950\" height=\"135\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"3\" rowspan=\"2\">
		<img src=\"images/index_02.gif\" width=\"123\" height=\"326\" alt=\"\"></td>
	<td colspan=\"5\">
		<table width=\"342\" height=\"224\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td align=\"center\" valign=\"top\" background=\"images/index_03.gif\">Here will place in some text. 



Users Online: {$users_online}

Users Offline: {$users_offline}

Total Users: {$total_users}


<a href=\"http://bornmobsters.com/forgot_password.php\">Forgot password?</a> || <a href=\"http://bornmobsters.com/register.php\">[b]REGISTER NOW![/b]</a></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"6\">
		<img src=\"images/index_04.gif\" width=\"485\" height=\"615\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"5\">
		<img src=\"images/index_05.gif\" width=\"342\" height=\"102\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"2\" rowspan=\"2\">
		<img src=\"images/index_06.gif\" width=\"54\" height=\"42\" alt=\"\"></td>
	<td colspan=\"2\">
		<table width=\"111\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td><input name=\"username\" type=\"text\" id=\"username\" style=\"border: medium none ; background: transparent url(images/index_07.gif) no-repeat scroll 0pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: bottom; vertical-align: bottom; width: 111px; height: 28px; color: red; font-weight: bold;\" maxlength=\"25\"><input type=\"hidden\" value=\"ON\" name=\"save\" checked></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"2\">
		<img src=\"images/index_08.gif\" width=\"93\" height=\"42\" alt=\"\"></td>
	<td>
		<table width=\"114\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td><input name=\"username\" type=\"text\" id=\"username\" style=\"border: medium none ; background: transparent url(images/index_09.gif) no-repeat scroll 0pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: bottom; vertical-align: bottom; width: 114px; height: 28px; color: red; font-weight: bold;\" maxlength=\"25\"></td>
             </tr>
           </table>
		</td>
	<td colspan=\"2\" rowspan=\"2\">
		<img src=\"images/index_10.gif\" width=\"93\" height=\"42\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"2\">
		<img src=\"images/index_11.gif\" width=\"111\" height=\"14\" alt=\"\"></td>
	<td>
		<img src=\"images/index_12.gif\" width=\"114\" height=\"14\" alt=\"\"></td>
</tr>
<tr>
	<td>
		<img src=\"images/index_13.gif\" width=\"40\" height=\"40\" alt=\"\"></td>
	<td colspan=\"6\">
		<table width=\"354\" height=\"40\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td>
			<input src=\"images/index_14.gif\" value=\"Submit\" alt=\"Submit\" type=\"image\"></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"2\">
		<img src=\"images/index_15.gif\" width=\"71\" height=\"247\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"7\">
		<table width=\"394\" height=\"207\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td width=\"394\" height=\"207\" background=\"images/index_16.gif\">[i]<center>Provided by: Dedicated Gaming Network LLC  &copy 2008.  

Game Copyright © 2008 Dedicated Gaming Network LLC</center>[/i]</td>
";
print <<<OUT
             </tr>
           </table>
		</td>
</tr>
<tr>
	<td>
		<img src=\"images/spacer.gif\" width=\"40\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"14\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"69\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"42\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"93\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"114\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"22\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"71\" height=\"1\" alt=\"\"></td>
	<td>
		<img src=\"images/spacer.gif\" width=\"485\" height=\"1\" alt=\"\"></td>
</tr>
</table>
</form>
</div>

</body>
</html>
OUT;
?>

 

Any ideas?

 

TJ

Link to comment
Share on other sites

Re: login.php help!

 

Because you used Photoshops export to HTML instead of doing it properly with html/css? Don't use that funtion in photoshop, especially for production pages. It's better to slice it and code it by hand

That I did.. Honest I am horrible at graphics. and coding a template. better at coding within the php/mysql.

Anyone wanting to give a stab at the core file?

let me know a price.

TJ

Link to comment
Share on other sites

Re: login.php help!

here you go bro, i did it for free :)

I re-edited some html lines, and cleaned up unnecessary breaks. Also you coded some PHP wrong at the bottom which caused the huge break. I re-coded that PHP part for you and tested, works perfectly ;)

 

<?php
session_start();
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
//count users and stats display
$sql = "SELECT COUNT(userid) FROM users";
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
$total_users = $row[0];
$sql = sprintf("SELECT COUNT(userid) FROM users WHERE (laston > %u)", time() - 900);
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
$users_online = $row[0];
$users_offline = $total_users - $users_online;
//end stats display info
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
print <<<EOF

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$set['game_name']}</title>
<link rel="SHORTCUT ICON" href="favicon.ico" />
<script language="JavaScript">
<!--

function getCookieVal (offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
   endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg)
     return getCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break;
 }
 return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
 document.cookie = name + "=" + escape (value) +
   ((expires) ? "; expires=" + expires.toGMTString() : "") +
   ((path) ? "; path=" + path : "") +
   ((domain) ? "; domain=" + domain : "") +
   ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
 if (GetCookie(name)) {
   document.cookie = name + "=" +
     ((path) ? "; path=" + path : "") +
     ((domain) ? "; domain=" + domain : "") +
     "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 }
}
// -->
</script>

<script language="JavaScript">
var usr;
var pw;
var sv;
function getme()
{
usr = document.login.username;
pw = document.login.password;
sv = document.login.save;

if (GetCookie('player') != null)
{
	usr.value = GetCookie('username')
	pw.value = GetCookie('password')
	if (GetCookie('save') == 'true')
	{
		sv[0].checked = true;
	}
}

}
function saveme()
{
if (usr.value.length != 0 && pw.value.length != 0)
{
	if (sv[0].checked)
	{
		expdate = new Date();
		expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000));
		SetCookie('username', usr.value, expdate);
		SetCookie('password', pw.value, expdate);
		SetCookie('save', 'true', expdate);
	}
	if (sv[1].checked)
	{
		DeleteCookie('username');
		DeleteCookie('password');
		DeleteCookie('save');
	}
}
	else
{
	alert('You must enter a username/password.');
	return false;
}
}
</script>

<style type="text/css">
<!--
body {
background-color: #000000;
}
a:link {
color: #42465A;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #42465A;
}
a:hover {
text-decoration: none;
color: #CED6CD;
}
a:active {
text-decoration: none;
color: #D6D6D6;
}
-->
</style></head>
<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"  onload=\"getme();\">
EOF;
print "


<div align=\"center\">
<form action=\"authenticate.php\" method=\"post\" name=\"login\" onsubmit=\"return saveme();\">
<table id=\"Table_01\" width=\"950\" height=\"751\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
	<td colspan=\"9\"><img src=\"http://www.bornmobsters.com/images/index_01.gif\" width=\"950\" height=\"135\" alt=\"\"></td>
</tr>
<tr>

	<td colspan=\"3\" rowspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_02.gif\" width=\"123\" height=\"326\" alt=\"\"></td>
	<td colspan=\"5\">
		<table width=\"342\" height=\"224\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td align=\"center\" valign=\"top\" background=\"http://www.bornmobsters.com/images/index_03.gif\">Here will place in some text.



Users Online: {$users_online}

Users Offline: {$users_offline}

Total Users: {$total_users}


<a href=\"http://bornmobsters.com/forgot_password.php\">Forgot password?</a> || <a href=\"http://bornmobsters.com/register.php\">[b]REGISTER NOW![/b]</a></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"6\"><img src=\"http://www.bornmobsters.com/images/index_04.gif\" width=\"485\" height=\"615\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"5\"><img src=\"http://www.bornmobsters.com/images/index_05.gif\" width=\"342\" height=\"102\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"2\" rowspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_06.gif\" width=\"54\" height=\"42\" alt=\"\"></td>
	<td colspan=\"2\">
		<table width=\"111\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td><input name=\"username\" type=\"text\" id=\"username\" style=\"border: medium none ; background: transparent url(images/index_07.gif) no-repeat scroll 0pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: bottom; vertical-align: bottom; width: 111px; height: 28px; color: red; font-weight: bold;\" maxlength=\"25\"><input type=\"hidden\" value=\"ON\" name=\"save\" checked></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_08.gif\" width=\"93\" height=\"42\" alt=\"\"></td>
	<td>
		<table width=\"114\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td><input name=\"username\" type=\"text\" id=\"username\" style=\"border: medium none ; background: transparent url(images/index_09.gif) no-repeat scroll 0pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: bottom; vertical-align: bottom; width: 114px; height: 28px; color: red; font-weight: bold;\" maxlength=\"25\"></td>
             </tr>
           </table>
		</td>
	<td colspan=\"2\" rowspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_10.gif\" width=\"93\" height=\"42\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_11.gif\" width=\"111\" height=\"14\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/index_12.gif\" width=\"114\" height=\"14\" alt=\"\"></td>
</tr>
<tr>
	<td><img src=\"http://www.bornmobsters.com/images/index_13.gif\" width=\"40\" height=\"40\" alt=\"\"></td>
	<td colspan=\"6\">
		<table width=\"354\" height=\"40\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
             <tr>
               <td>
			<input src=\"http://www.bornmobsters.com/images/index_14.gif\" value=\"Submit\" alt=\"Submit\" type=\"image\"></td>
             </tr>
           </table>
		</td>
	<td rowspan=\"2\"><img src=\"http://www.bornmobsters.com/images/index_15.gif\" width=\"71\" height=\"247\" alt=\"\"></td>
</tr>
<tr>
	<td colspan=\"7\">
		<table width=\"394\" height=\"207\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

             <tr>
               <td width=\"394\" height=\"207\" background=\"http://www.bornmobsters.com/images/index_16.gif\">[i]<center>Provided by: Dedicated Gaming Network LLC  &copy 2008.  

Game Copyright © 2008 Dedicated Gaming Network LLC</center>[/i]</td>
		</tr>
           </table>
		</td>
</tr>
<tr>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"40\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"14\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"69\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"42\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"93\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"114\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"22\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"71\" height=\"1\" alt=\"\"></td>
	<td><img src=\"http://www.bornmobsters.com/images/spacer.gif\" width=\"485\" height=\"1\" alt=\"\"></td>
</tr>
</table>
</form>
</div>

</body>
</html>
\";
print <<<OUT
OUT;
?>
Link to comment
Share on other sites

Re: login.php help!

As it loads it's fine - all tables/pictures/whatnot are fine as they are joined together.

But when the loading has finished, then it breaks up..

There's a problem between the communication from the login file (most likely the HTML) to the users browser itself

Link to comment
Share on other sites

Re: login.php help!

 

hmmm...

 

Everything seems fine except on your site.. :S

http://www.nsyed.com/login.html

You need to save it as a PHP script, not HTML.

I think PHP might be inserting spaces where it is not needed, so look trough the PHP code to find where it makes new lines etc.

Also keep in mind that any layout needs allot of editing to make it cross-browser compatible.

Try using CSS to remove spaces, padding etc. in the tables, should solve it.

Link to comment
Share on other sites

Re: login.php help!

I tried it in PHP works fine, except i had to remove all the php classes and functions for the design to show up with no php die errors... If you need help slicing it up properly and integrated properly with PHP, email me up and we can set a price :) or i think TJ has my msn, msg me if you ned help still.

Link to comment
Share on other sites

Re: login.php help!

 

I tried it in PHP works fine, except i had to remove all the php classes and functions for the design to show up with no php die errors... If you need help slicing it up properly and integrated properly with PHP, email me up and we can set a price :) or i think TJ has my msn, msg me if you ned help still.

Ill just recode it and remove the echo callings. thats why is screwing it up. Did it on another clients site. I just been lazy lately.

TJ

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...