Page 1 of 1

need a members only page

Posted: Thu Jan 21, 2010 2:51 am
by 5475427
the titile say it all can any one plzz make me a members only page and i want this code inside it so when some one logins in they see this page. and make it so that if peope are not loged in they cant see it thanks


<html>
<head>
<title>tprrpg</title>
<style>
A:link
{ text-decoration: none; color: #333333; }
A:visited
{ text-decoration: none; color: #333333; }
A:active
{ text-decoration: none; color: #333333; }
A:hover
{ text-decoration: none; color: #666666; }

body
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
background-color: #ffffff;
background-image: url(' ');
text-align: justify;
margin-bottom: 5px;
margin-right: 0px;
margin-top: 5px;
}

#centerlayout {
margin-left: -370px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
width: 800px;
left: 50%;
top: 0%;
position: absolute;
}

#leftmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://img97.imageshack.us/img97/5073/arceusl.png');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#rightmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://i188.photobucket.com/albums/z109 ... gira_l.jpg');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#content
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 10px;
background-color: #333333;
background-image: url(' ');
border: 0px solid #000000;
width: 529px;
}

#disclaimer
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
width:800px;
height:85px;
background-color: #d5d5d5;
background-image: url('Disclaimer Background URL delete if none');
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
text-align:center;
}

#banner
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 0px;
width:800px;
height:200px;
background-color: #d5d5d5;
background-image: url('http://i93.photobucket.com/albums/l46/K ... roudon.png');
text-align:center;
border-top: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
}

h1
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h2
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h3
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

</style>

</head>
<body leftmargin="0" rightmargin="0" topmargin="10" bottommargin="10">
<div id="centerlayout">
<table cellspacing="0" cellpadding="5" border="0">
<td valign="top" align="center" id="banner" colspan="3">
</td>
<tr>

<td valign="top" id="leftmenu">

<h2>Options</h2>
<a href="members.php">Change Starter</a><br>
<a href="members.php">My Box</a><br>
<a href="members.php">Edit Profile</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Battles</h1>
<a href="members.php">Battle</a><br>
<a href="members.php">Battle A Pokemon</a><br>
<a href="members.php">Battle Dome</a><br>
<a href="members.php">Firle Dome</a><br>


<h1>Pokemon Gyms</h1>
<a href="members.php">Pokemon gym1</a><br>
<a href="members.php">Pokemon gym2</a><br>
<a href="members.php">Pokemon gym3</a><br>
<a href="members.php">Pokemon gym4</a><br>
<a href="members.php">Pokemon gym5</a><br>
<a href="members.php">Pokemon gym6</a><br>
<a href="members.php">Pokemon gym7</a><br>
<a href="members.php">Pokemon gym8</a><br>
<a href="members.php">Pokemon gym9</a><br>

<h1>Free Pokemon</h1>
<a href="members.php">Promo Pokemon</a><br>
<a href="members.php">Event Pokemon</a><br>

<h1>Exit</h1>
<a href="logout.php">Logout</a><br>





</td>
<td valign="top" id="content">
<div align="justify">

<h3>Main News</h3>

heresh: Welcome to the pokemon ruins rpg i hope u enjoy your stay

</div>
</td>
<td valign="top" id="rightmenu">

<h2>General Options</h2>
<a href="members.php">Main</a><br>
<a href="members.php">Staff List</a><br>
<a href="members.php">Rules</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Trades</h1>
<a href="members.php">Trade Pokeon</a><br>
<a href="members.php">Complete Trade</a><br>
<a href="members.php">Pokemon Shop</a><br>
<a href="members.php">Sell Pokemon</a><br>
<a href="members.php">Pokemon Exchange</a><br>

<h1>Maps</h1>
<a href="members.php">map1</a><br>
<a href="members.php">map2</a><br>
<a href="members.php">map3</a><br>
<a href="members.php">map4</a><br>
<a href="members.php">map5</a><br>
<a href="members.php">map6</a><br>
<a href="members.php">map7</a><br>
<a href="members.php">map8</a><br>
<a href="members.php">map9</a><br>



</td></tr>
<tr><td valign="top" id="disclaimer" colspan="3">

Copyright © 2009 Shadow Eagle, Dextrouse. All images, icons, sprites, etc © to their respective owners[<a href='disclaimer.php?area=legal'>Legal Info</a>]


</td></tr>
</table>
</body>
</html>

Re: need a members only page

Posted: Thu Jan 21, 2010 3:05 am
by 5475427
plzz any1 help

Re: need a members only page

Posted: Thu Jan 21, 2010 3:07 am
by balo
do you have a db? can different user login with different password or you have just one user and one password?

Re: need a members only page

Posted: Thu Jan 21, 2010 3:35 am
by aravona
You page would be less cluttered if you took your CSS out, put it in a CSS file and linked it on your page instead. As it is thats far to much CSS to have on a page its just messy.

Re: need a members only page

Posted: Thu Jan 21, 2010 3:37 am
by 5475427
yes i have a database and a login and a register so when people login in i wnat them to see this page

Re: need a members only page

Posted: Thu Jan 21, 2010 4:34 am
by mellowman
ok this is simple in lamen talk but coding it is kinda different.....Sooooo if u have your login and register up and running...thats all you have to do is when they pass threw all the login crap.Set a session that stores there login name and after the login script u want to check if theyy are or not :mrgreen:

So here are the codes u will need.

1.This is code to save there login name once they login.So put this on the bottem of your login :mrgreen:CHANGE THE BLUE CODE TO WHAT U HAVE IT CALLED IN THE TABLE

Code: Select all

 
// Sesseion username is set here
$_SESSION["user"] =  $_POST["[color=#0000FF]loginusername[/color]"];
 
2.Put this at the top of your members page.

Code: Select all

 
<?
session_start();
$login = $_SESSION["user"];
?>
 
3.Now this is what tells the Browser if ur logged in or not.This is all u need on your members page besides the code above :]. O and change the bolded text to the different pages

Code: Select all

 
 <?php if ($login == "") 
  { include("[b]LOGINPAGE.html[/b]");}   
  else {include("[b]NOTLOGGEDIN.html[/b]");
} ?>
 
And there u go...if u have questions email me...imcmellowman@hotmail.com :mrgreen:

Re: need a members only page

Posted: Thu Jan 21, 2010 5:00 am
by timWebUK
Never set a username in the session...

Re: need a members only page

Posted: Thu Jan 21, 2010 5:13 am
by mellowman
well explain y?

Re: need a members only page

Posted: Thu Jan 21, 2010 4:29 pm
by 5475427
ok here is my login page can u plzz put the code it there

<html>
<head>
<title>tprrpg</title>
<style>
A:link
{ text-decoration: none; color: #333333; }
A:visited
{ text-decoration: none; color: #333333; }
A:active
{ text-decoration: none; color: #333333; }
A:hover
{ text-decoration: none; color: #666666; }

body
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
background-color: #ffffff;
background-image: url(' ');
text-align: justify;
margin-bottom: 5px;
margin-right: 0px;
margin-top: 5px;
}

#centerlayout {
margin-left: -370px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
width: 800px;
left: 50%;
top: 0%;
position: absolute;
}

#leftmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://img97.imageshack.us/img97/5073/arceusl.png');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#rightmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://i188.photobucket.com/albums/z109 ... gira_l.jpg');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#content
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 10px;
background-color: #333333;
background-image: url(' ');
border: 0px solid #000000;
width: 529px;
}

#disclaimer
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
width:800px;
height:85px;
background-color: #d5d5d5;
background-image: url('Disclaimer Background URL delete if none');
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
text-align:center;
}

#banner
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 0px;
width:800px;
height:200px;
background-color: #d5d5d5;
background-image: url('http://i93.photobucket.com/albums/l46/K ... roudon.png');
text-align:center;
border-top: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
}

h1
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h2
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h3
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

</style>

</head>
<body leftmargin="0" rightmargin="0" topmargin="10" bottommargin="10">
<div id="centerlayout">
<table cellspacing="0" cellpadding="5" border="0">
<td valign="top" align="center" id="banner" colspan="3">
</td>
<tr>

<td valign="top" id="leftmenu">

<h2>General Options</h2>
<a href="index.php">Index</a><br>
<a href="login.php">Login</a><br>
<a href="add.php">register</a><br>
<a href="http://xat.com/tprrpg">Chatbox</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Other Pages</h1>
<a href="index.php">About TPR RPG</a><br>
<a href="index.php">Story Line</a><br>
<a href="index.php">Rules</a><br>
<a href="index.php">Current News</a><br>
<a href="index.php">Donate</a>

<h2>Stats</h2>
<a href="index.php">All Users</a><br>
<a href="http://tpr-rpg.orgfree.com">
<font color=#000000><script type="text/javascript" src="http://st1.freeonlineusers.com/on1.php?id=197334"> </script> Online Users</font></a>


</td>
<td valign="top" id="content">
<div align="justify">

<h3>Login</h3>

<?php
//MySQL Database Connect
include 'datalogin.php';

//Checks if there is a login cookie
if(isset($_COOKIE['ID_my_site']))

//if there is, it logs you in and directes you to the members page
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($pass != $info['password'])
{
}
else
{
header("Location: members.php");

}
}
}

//if the login form is submitted
if (isset($_POST['submit'])) { // if form has been submitted

// makes sure they filled it in
if(!$_POST['username'] | !$_POST['pass']) {
die('You did not fill in a required field.');
}
// checks it against the database

if (!get_magic_quotes_gpc()) {
}
$check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());

//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>');
}
while($info = mysql_fetch_array( $check ))
{
$_POST['pass'] = stripslashes($_POST['pass']);
$info['password'] = stripslashes($info['password']);
$_POST['pass'] = ($_POST['pass']);

//gives error if the password is wrong
if ($_POST['pass'] != $info['password']) {
die('Incorrect password, please try again.');
}
else
{

// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(ID_my_site, $_POST['username'], $hour);
setcookie(Key_my_site, $_POST['pass'], $hour);

//then redirect them to the members area
header("Location: members.php");
}
}
}
else
{

// if they are not logged in
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2><h1>Login</h1></td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="40">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="50">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Login">
</td></tr>
</table>
</form>
<?php
}

?>
</div>
</td>
<td valign="top" id="rightmenu">

<h2>General Options</h2>
<a href="index.php">Index</a><br>
<a href="login.php">Login</a><br>
<a href="add.php">register</a><br>
<a href="http://xat.com/tprrpg">Chatbox</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Other Pages</h1>
<a href="index.php">About TPR RPG</a><br>
<a href="index.php">Story Line</a><br>
<a href="index.php">Rules</a><br>
<a href="index.php">Current News</a><br>
<a href="index.php">Donate</a>


<h2>Stats</h2>
<a href="index.php">All Users</a><br>
<a href="http://tpr-rpg.orgfree.com">
<font color=#000000><script type="text/javascript" src="http://st1.freeonlineusers.com/on1.php?id=197334"> </script> Online Users</font></a>




</td></tr>
<tr><td valign="top" id="disclaimer" colspan="3">

Copyright © 2009 Shadow Eagle, Dextrouse. All images, icons, sprites, etc © to their respective owners[<a href='disclaimer.php?area=legal'>Legal Info</a>]


</td></tr>
</table>
</body>
</html>

Re: need a members only page

Posted: Thu Jan 21, 2010 4:30 pm
by 5475427
and this is my members page

<html>
<head>
<title>tprrpg</title>
<style>
A:link
{ text-decoration: none; color: #333333; }
A:visited
{ text-decoration: none; color: #333333; }
A:active
{ text-decoration: none; color: #333333; }
A:hover
{ text-decoration: none; color: #666666; }

body
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
background-color: #ffffff;
background-image: url(' ');
text-align: justify;
margin-bottom: 5px;
margin-right: 0px;
margin-top: 5px;
}

#centerlayout {
margin-left: -370px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
width: 800px;
left: 50%;
top: 0%;
position: absolute;
}

#leftmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://img97.imageshack.us/img97/5073/arceusl.png');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#rightmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333300;
font-size: 9px;
background-color: #ffffff;
background-image: url('http://i188.photobucket.com/albums/z109 ... gira_l.jpg');
text-align: center;
border: 1px solid #000000;
width:120px;
}

#content
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 10px;
background-color: #333333;
background-image: url(' ');
border: 0px solid #000000;
width: 529px;
}

#disclaimer
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 9px;
width:800px;
height:85px;
background-color: #d5d5d5;
background-image: url('Disclaimer Background URL delete if none');
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
text-align:center;
}

#banner
{ font-family: Verdana; sans serif; helvetica;
color: #000000;
font-size: 0px;
width:800px;
height:200px;
background-color: #d5d5d5;
background-image: url('http://i93.photobucket.com/albums/l46/K ... roudon.png');
text-align:center;
border-top: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
}

h1
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h2
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

h3
{
font-family: Tahoma;
font-size: 11px;
color: #000000;
font-weight: bold;
text-align: center;
background-color: #d5d5d5;
border:1px solid #000000;
}

</style>

</head>
<body leftmargin="0" rightmargin="0" topmargin="10" bottommargin="10">
<div id="centerlayout">
<table cellspacing="0" cellpadding="5" border="0">
<td valign="top" align="center" id="banner" colspan="3">
</td>
<tr>

<td valign="top" id="leftmenu">

<h2>Options</h2>
<a href="members1.php">Change Starter</a><br>
<a href="members1.php">My Box</a><br>
<a href="members1.php">Edit Profile</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Battles</h1>
<a href="members1.php">Battle</a><br>
<a href="members1.php">Battle A Pokemon</a><br>
<a href="members1.php">Battle Dome</a><br>
<a href="members1.php">Firle Dome</a><br>


<h1>Pokemon Gyms</h1>
<a href="members1.php">Pokemon gym1</a><br>
<a href="members1.php">Pokemon gym2</a><br>
<a href="members1.php">Pokemon gym3</a><br>
<a href="members1.php">Pokemon gym4</a><br>
<a href="members1.php">Pokemon gym5</a><br>
<a href="members1.php">Pokemon gym6</a><br>
<a href="members1.php">Pokemon gym7</a><br>
<a href="members1.php">Pokemon gym8</a><br>
<a href="members1.php">Pokemon gym9</a><br>

<h1>Free Pokemon</h1>
<a href="members1.php">Promo Pokemon</a><br>
<a href="members1.php">Event Pokemon</a><br>

<h1>Exit</h1>
<a href="logout.php">Logout</a><br>





</td>
<td valign="top" id="content">
<div align="justify">

<h3>Main News</h3>

heresh: Welcome to the pokemon ruins rpg i hope u enjoy your stay

</div>
</td>
<td valign="top" id="rightmenu">

<h2>General Options</h2>
<a href="members1.php">Main</a><br>
<a href="members1.php">Staff List</a><br>
<a href="members1.php">Rules</a><br>
<a href="http://www.punbb-hosting.com/forums/tpr ... ums</a><br>

<h1>Trades</h1>
<a href="members1.php">Trade Pokeon</a><br>
<a href="members1.php">Complete Trade</a><br>
<a href="members1.php">Pokemon Shop</a><br>
<a href="members1.php">Sell Pokemon</a><br>
<a href="members1.php">Pokemon Exchange</a><br>

<h1>Maps</h1>
<a href="members1.php">map1</a><br>
<a href="members1.php">map2</a><br>
<a href="members1.php">map3</a><br>
<a href="members1.php">map4</a><br>
<a href="members1.php">map5</a><br>
<a href="members1.php">map6</a><br>
<a href="members1.php">map7</a><br>
<a href="members1.php">map8</a><br>
<a href="members1.php">map9</a><br>



</td></tr>
<tr><td valign="top" id="disclaimer" colspan="3">

Copyright © 2009 Shadow Eagle, Dextrouse. All images, icons, sprites, etc © to their respective owners[<a href='disclaimer.php?area=legal'>Legal Info</a>]


</td></tr>
</table>
</body>
</html>

Re: need a members only page

Posted: Thu Jan 21, 2010 5:35 pm
by McInfo
Learn to use tags.

Edit: This post was recovered from search engine cache.

Re: need a members only page

Posted: Fri Jan 22, 2010 3:06 am
by aravona
aravona wrote:You page would be less cluttered if you took your CSS out, put it in a CSS file and linked it on your page instead. As it is thats far to much CSS to have on a page its just messy.
You code would be MUCH tidier if you moved the CSS out of it, gods.

Also read the forum rules about

Code: Select all

tags like McInfo said. There was no need to post the same code twice (your members page) 

And asking someone to just do it for you wont get you anywhere. Have you not tried anything yourself?