Jump to content

Help with php layout


Adamhull1

Recommended Posts

Hello it is my first time at the forum I am trying to make a new layout for my website but I can not get the tables under my login box to align next to each other all the same size any help? Then code is

<?phpsession_start();include_once"includes/db_connect.php";if (strip_tags($_GET['logout']) == "yes"){session_destroy();}elseif (isset($_SESSION['username'])){header("Location: logged_in.php");exit();}if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){$username = addslashes(strip_tags($_POST['username'])); $password = addslashes(strip_tags($_POST['password']));$ip = $REMOTE_ADDR;$ud=mysql_num_rows(mysql_query("SELECT * FROM users"));///check INFO$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1' LIMIT 1"); $login_check = mysql_num_rows($sql); $inf = mysql_fetch_object($sql); if ($login_check == "0"){echo "<body bgcolor=#666666>You Have Typed an Incorrect Username or Password";}elseif ($login_check != "0"){if ($login_check > "0"){if ($inf->status == "Dead"){include_once"dead.php";exit();}if ($inf->status == "Banned"){$encoded=md5(strtolower($username));header("Location: banned.php?banned=$username&encoded=$encoded"); exit();}        session_register('username');         $_SESSION['username'] = $inf->username;          $timestamp = time()+60; mysql_query("UPDATE users SET online='$timestamp' WHERE username='$username'");mysql_query("UPDATE users SET l_ip='$ip' WHERE username='$username'");        header("Location: logged_in.php"); } else {     $message= "You could not be logged in.<br />"; }}}///////MONEY IN GAME AND PER USER$result11111 = mysql_query("SELECT money, bank FROM users WHERE userlevel='0' AND status='Alive'");	$moneytot = 0;	while($row=mysql_fetch_array($result11111)){		$moneytot+=$row[0]+$row[1];	}		$nums=mysql_num_rows($result11111); 	$per_user = round($moneytot / $nums);$ud=mysql_num_rows(mysql_query("SELECT * FROM users"));///END////SITE STATS$site=mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));////END////FORUM TOPICS$totaltopics = mysql_num_rows(mysql_query("SELECT id FROM topics"));//?END/////USERS DEAD$dead= mysql_num_rows(mysql_query("SELECT username FROM users WHERE status = 'Dead' AND modkill = '0'"));$banned= mysql_num_rows(mysql_query("SELECT username FROM users WHERE status = 'Banned'"));/////TOTAL ATTEMPTS$attempts= mysql_num_rows(mysql_query("SELECT id FROM attempts WHERE outcome = 'Survived' OR outcome = ''"));///?END$result11111swiss = mysql_query("SELECT money FROM swiss");	$moneyswiss = 0;	while($rowswiss=mysql_fetch_array($result11111swiss)){		$moneyswiss+=$rowswiss[0];	}?> <html><head><link rel="shortcut icon" href="favicon.ico.png"><title>Way Of The Mafia</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="includes/in.css" rel="stylesheet" type="text/css"><style type="text/css"><!--A:link,  {    COLOR:#999999;   font-family:"Arial", serif;   FONT-WEIGHT:bold;font-size:12px;   TEXT-DECORATION:none}body {	background-attachment: fixed;	background-image: url(images/index/loginbg.jpg);        background-position: bottom right;}.style4 {font-size: 18px;	font-color: #FFFFFF;	}.style9 {color: #000000}.style13 {color: #FFFFFF}.style14 {	color: #000000;	font-weight: bold;	font-family: Geneva, Arial, Helvetica, sans-serif;}.style16 {color: #CCCCCC}.style17 {color: #0099FF}.style18 {color: #00FF00}.style19 {color: #FF0000; }<style type="text/css">.button {	-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;	-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;	box-shadow:inset 0px 1px 0px 0px #ffffff;	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );	background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#e9e9e9');	background-color:#f9f9f9;	-webkit-border-top-left-radius:0px;	-moz-border-radius-topleft:0px;	border-top-left-radius:0px;	-webkit-border-top-right-radius:0px;	-moz-border-radius-topright:0px;	border-top-right-radius:0px;	-webkit-border-bottom-right-radius:0px;	-moz-border-radius-bottomright:0px;	border-bottom-right-radius:0px;	-webkit-border-bottom-left-radius:0px;	-moz-border-radius-bottomleft:0px;	border-bottom-left-radius:0px;	text-indent:0;	border:1px solid #dcdcdc;	display:inline-block;	color:#666666;	font-family:Impact;	font-size:15px;	font-weight:bold;	font-style:normal;	height:40px;	line-height:40px;	width:100px;	text-decoration:none;	text-align:center;	text-shadow:1px 1px 0px #ffffff;}.button:hover {	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );	background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e9e9e9', endColorstr='#f9f9f9');	background-color:#e9e9e9;}.button:active {	position:relative;	top:1px;}.table1 {    width:auto;    max-width:100%;    display:inline-block;    float:none;}.table2 {    width:auto;    max-width:100%;    display:inline-block;    float:left;}input, select, textarea{    color: #ffffff;}</style></style></head><? $timenow=time();$select =mysql_query("SELECT * FROM users WHERE online > '$timenow' ORDER by id");$num = mysql_num_rows($select); ?>  <p align="center"><img src="images/banner.jpg"><BR><BR><table bgcolor=black width="20%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor=black class="thinline"><tr><td><center>Login</td></tr>  <tr><td><form action='index.php' method='post'>      <div align="center"><br /><span class="style4">            <font color=#FFFFFF>Username: <input name="username" class="thinline" type="text" id="username" value="<?php if (strip_tags($_GET['l'])){ echo "$l"; } ?>" size="15" maxlength="40">        </div>       <div align="center"> <span class="style4">            Password:  <font color="white"><input name="password" type="password" class="thinline" id="password2" value="<?php if (strip_tags($_GET['pw'])){ echo "$pw"; } ?>" size="15" maxlength="40">        </span></div><center><input name="Submit" colspan="4" type="Submit" id="Submit" value="Login" class="button"><br /><tr><p align="center"> <a href="register.php"><img src="images/index/reglink.png" alt="register" ismap></a> <a href="lost.php"><img src="images/index/lplink.png" ismap></a><br /><br /></p></td></tr>    </table>    <label></label>    <div align="center">      <p>    </div>  </form><br><br><br><table class=table2><center>&nbsp&nbsp&nbsp<td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td><table bgcolor=black width=25% class="table1"><td></td><table bgcolor=black class="table2" height=33%><tr class="thinline"><td colspan=2>      Last 5 Registered</td>    </tr>        <tr class=table>          <td class="subhead" width="109">Username</td>        </tr>        <?	   $c=mysql_query("SELECT * FROM users ORDER BY id DESC LIMIT 5");	   while($d=mysql_fetch_object($c)){	   echo "<tr><td align=center>$d->username</td></tr>";	   }	   ?><table bgcolor="black" class="table2" height=33%><tr align="center" class="thinline"><td colspan=2>      Last 5 Killed</td>    </tr>        <tr class=table>          <td class="subhead" width="109">Username</td>        </tr>        <?	   $e=mysql_query("SELECT * FROM users WHERE status='Dead' AND modkill='0' ORDER BY killed_on DESC LIMIT 5");	   while($f=mysql_fetch_object($e)){	   $dae=mysql_fetch_object(mysql_query("SELECT * FROM dead WHERE username='$f->username'"));	   echo "<tr><td align=center>$f->username</td></tr>";	   }	   ?><table bgcolor="black" class="table2" height=33%><tr align="center" class="thinline"><td colspan=2>      Top 5 Players</td>    </tr>        <tr class=table>          <td class="subhead" width="109">Username</td>        </tr>        <?php	$tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rankpoints` desc limit 5");	while ($top = mysql_fetch_array($tsel)) {		print "<tr><td align=center>$top[username]</td></tr>";	}	?><table bgcolor="black" class="table2" height=33%><tr class="thinline"><td colspan=2>      Site Stats</td>    </tr>        </tr>        <tr>           <td width="40%" align=right>Total Users:</td>          <td width="60%" align=center><?php echo "$ud"; ?></td>        </tr>              <tr>           <td width="40%" align=right>Game Money:</td>       <td width="60%" align=center><?php echo "£$moneytot"; ?> </td>        </tr>        <tr>           <td width="40%" align=right>Users Dead:</td>          <td width="60%" align=center><?php echo "$dead"; ?></td>        </tr>      <tr>           <td width="40%" align=right>Users Banned:</td>          <td width="60%" align=center><?php echo "$banned"; ?></td>        </tr>        <tr>           <td width="40%" align=right>Attempted Murders:</td>          <td width="60%" align=center><?php echo "$attempts"; ?></td>

 

 

 

</tr>

 

 

 

</table>

</table></td>

</table>

</body>

</html>

 

[\code]

 

Thanks

Edited by Adamhull1
Link to comment
Share on other sites

Ran through a formatter and used full php tags versus short ones.

 

and...holy tables!!

 

<?php
session_start();
include_once "includes/db_connect.php";
if (strip_tags($_GET['logout']) == "yes") {
    session_destroy();
} elseif (isset($_SESSION['username'])) {
    header("Location: logged_in.php");
    exit();
}
if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])) {
    $username    = addslashes(strip_tags($_POST['username']));
    $password    = addslashes(strip_tags($_POST['password']));
    $ip          = $REMOTE_ADDR;
    $ud          = mysql_num_rows(mysql_query("SELECT * FROM users"));
    //check INFO
    $sql         = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1' LIMIT 1");
    $login_check = mysql_num_rows($sql);
    $inf         = mysql_fetch_object($sql);
    if ($login_check == "0") {
        echo "<body bgcolor=#666666>You Have Typed an Incorrect Username or Password";
    } elseif ($login_check != "0") {
        if ($login_check > "0") {
            if ($inf->status == "Dead") {
                include_once "dead.php";
                exit();
            }
            if ($inf->status == "Banned") {
                $encoded = md5(strtolower($username));
                header("Location: banned.php?banned=$username&encoded=$encoded");
                exit();
            }
            session_register('username');
            $_SESSION['username'] = $inf->username;
            $timestamp            = time() + 60;
            mysql_query("UPDATE users SET online='$timestamp' WHERE username='$username'");
            mysql_query("UPDATE users SET l_ip='$ip' WHERE username='$username'");
            header("Location: logged_in.php");
        } else {
            $message = "You could not be logged in.<br />";
        }
    }
}
//MONEY IN GAME AND PER USER
$result11111 = mysql_query("SELECT money, bank FROM users WHERE userlevel='0' AND status='Alive'");
$moneytot    = 0;
while ($row = mysql_fetch_array($result11111)) {
    $moneytot += $row[0] + $row[1];
}
$nums             = mysql_num_rows($result11111);
$per_user         = round($moneytot / $nums);
$ud               = mysql_num_rows(mysql_query("SELECT * FROM users"));
//END
//SITE STATS
$site             = mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));
//END
//FORUM TOPICS
$totaltopics      = mysql_num_rows(mysql_query("SELECT id FROM topics"));
//?END
//USERS DEAD
$dead             = mysql_num_rows(mysql_query("SELECT username FROM users WHERE status = 'Dead' AND modkill = '0'"));
$banned           = mysql_num_rows(mysql_query("SELECT username FROM users WHERE status = 'Banned'"));
//TOTAL ATTEMPTS
$attempts         = mysql_num_rows(mysql_query("SELECT id FROM attempts WHERE outcome = 'Survived' OR outcome = ''"));
//?END
$result11111swiss = mysql_query("SELECT money FROM swiss");
$moneyswiss       = 0;
while ($rowswiss = mysql_fetch_array($result11111swiss)) {
    $moneyswiss += $rowswiss[0];
}
?>
<html>
<head>
<link rel="shortcut icon" href="favicon.ico.png">
<title>Way Of The Mafia</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/in.css" rel="stylesheet" type="text/css">
<style type="text/css">
A:link, {
COLOR:#999999;
font-family:"Arial", serif;
FONT-WEIGHT:bold;
font-size:12px;
TEXT-DECORATION:none
}
body {
background-attachment: fixed;
background-image: url(images/index/loginbg.jpg);
background-position: bottom right;
}
.style4 {
font-size: 18px;
font-color: #FFFFFF;
}
.style9 {
color: #000000;
}
.style13 {
color: #FFFFFF;
}
.style14 {
color: #000000;
font-weight: bold;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style16 {
color: #CCCCCC;
}
.style17 {
color: #0099FF;
}
.style18 {
color: #00FF00;
}
.style19 {
color: #FF0000;
}
.button {
-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
box-shadow:inset 0px 1px 0px 0px #ffffff;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#e9e9e9');
background-color:#f9f9f9;
-webkit-border-top-left-radius:0px;
-moz-border-radius-topleft:0px;
border-top-left-radius:0px;
-webkit-border-top-right-radius:0px;
-moz-border-radius-topright:0px;
border-top-right-radius:0px;
-webkit-border-bottom-right-radius:0px;
-moz-border-radius-bottomright:0px;
border-bottom-right-radius:0px;
-webkit-border-bottom-left-radius:0px;
-moz-border-radius-bottomleft:0px;
border-bottom-left-radius:0px;
text-indent:0;
border:1px solid #dcdcdc;
display:inline-block;
color:#666666;
font-family:Impact;
font-size:15px;
font-weight:bold;
font-style:normal;
height:40px;
line-height:40px;
width:100px;
text-decoration:none;
text-align:center;
text-shadow:1px 1px 0px #ffffff;
}
.button:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );
background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e9e9e9', endColorstr='#f9f9f9');
background-color:#e9e9e9;
}
.button:active {
position:relative;
top:1px;
}
.table1 {
width:auto;
max-width:100%;
display:inline-block;
float:none;
}
.table2 {
width:auto;
max-width:100%;
display:inline-block;
float:left;
}
input, select, textarea{
color: #ffffff;
}
</style>
</head>
<?php
$timenow = time();
$select  = mysql_query("SELECT * FROM users WHERE online > '$timenow' ORDER by id");
$num     = mysql_num_rows($select);
?>
<p align="center">
<img src="images/banner.jpg">
<BR><BR>
<table bgcolor=black width="20%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor=black class="thinline">
<tr>
<td>
<center>
Login
</td>
</tr>
<tr>
<td>
<form action='index.php' method='post'>
<div align="center">
<br />
<span class="style4">
<font color=#FFFFFF>
Username: <input name="username" class="thinline" type="text" id="username" value="<?php
if (strip_tags($_GET['l'])) {
    echo "$l";
}
?>" size="15" maxlength="40">
</div>
<div align="center">
<span class="style4">
Password: <font color="white"><input name="password" type="password" class="thinline" id="password2" value="<?php
if (strip_tags($_GET['pw'])) {
    echo "$pw";
}
?>" size="15" maxlength="40">
</span>
</div>
<center>
<input name="Submit" colspan="4" type="Submit" id="Submit" value="Login" class="button">
<br />
<tr>
<p align="center">
<a href="register.php"><img src="images/index/reglink.png" alt="register" ismap></a>
<a href="lost.php"><img src="images/index/lplink.png" ismap></a><br />
<br />
</p>
</td>
</tr>
</table>
<label>
</label>
<div align="center">
<p>
</div>
</form>
<br><br><br>
<table class=table2>
<center>
&nbsp&nbsp&nbsp
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<table bgcolor=black width=25% class="table1">
<td>
</td>
<table bgcolor=black class="table2" height=33%><tr class="thinline">
<td colspan=2> Last 5 Registered</td>
</tr>
<tr class=table>
<td class="subhead" width="109">Username</td>
</tr>
<?php
$c = mysql_query("SELECT * FROM users ORDER BY id DESC LIMIT 5");
while ($d = mysql_fetch_object($c)) {
    echo "<tr><td align=center>$d->username</td></tr>";
}
?>
<table bgcolor="black" class="table2" height=33%>
<tr align="center" class="thinline">
<td colspan=2> Last 5 Killed</td>
</tr>
<tr class=table>
<td class="subhead" width="109">Username</td>
</tr>
<?php
$e = mysql_query("SELECT * FROM users WHERE status='Dead' AND modkill='0' ORDER BY killed_on DESC LIMIT 5");
while ($f = mysql_fetch_object($e)) {
    $dae = mysql_fetch_object(mysql_query("SELECT * FROM dead WHERE username='$f->username'"));
    echo "<tr><td align=center>$f->username</td></tr>";
}
?>
<table bgcolor="black" class="table2" height=33%><tr align="center" class="thinline">
<td colspan=2> Top 5 Players</td>
</tr>
<tr class=table>
<td class="subhead" width="109">Username</td>
</tr>
<?php
$tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rankpoints` desc limit 5");
while ($top = mysql_fetch_array($tsel)) {
    echo "<tr><td align=center>$top[username]</td></tr>";
}
?>
<table bgcolor="black" class="table2" height=33%>
<tr class="thinline">
<td colspan=2> Site Stats</td>
</tr>
</tr>
<tr>
<td width="40%" align=right>Total Users:</td>
<td width="60%" align=center>
<?php
echo "$ud";
?>
</td>
</tr>
<tr>
<td width="40%" align=right>Game Money:</td>
<td width="60%" align=center>
<?php
echo "£$moneytot";
?>
</td>
</tr>
<tr>
<td width="40%" align=right>Users Dead:</td>
<td width="60%" align=center>
<?php
echo "$dead";
?>
</td>
</tr>
<tr>
<td width="40%" align=right>Users Banned:</td>
<td width="60%" align=center>
<?php
echo "$banned";
?>
</td>
</tr>
<tr>
<td width="40%" align=right>Attempted Murders:</td>
<td width="60%" align=center>
<?php
echo "$attempts";
?>
</td>
 
</tr>
 
</table>
</table>
</td>
</table>
</body>
</html>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

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.