Autor Tema: [AYUDA] Ayuda con un archivo de las homes  (Leído 674 veces)

Desconectado Edwin

  • PHPero Avanzado
  • ****
  • Mensajes: 404
  • Karma: 8
  • Sexo: Masculino
    • Ver Perfil
[AYUDA] Ayuda con un archivo de las homes
« en: 30 de Junio de 2010, 05:08:00 am »
Hola, como han visto en uno de mis temas anteriores pedia ayuda sobre las homes... pero he encontrado el archivo del registro y login; pero no se que quito, cuando lo quito se me pone en blanco el archivo...
Solo quiero que se pueda registrar al que no este registrado y se pueda loguear al que ya se registro... el codigo:
Código: [Seleccionar]
<?
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include("functions.inc.php");
//accounts.php
if($_GET['mode']=="register" || $_GET['mode']=="login" || $_GET['mode']=="logout"){
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Habbos Account ~ Login/Register Page</title>
<link rel="stylesheet" type="text/css" href="css/kh.css" />
<style type="text/css">
body {
text-align: center;
}
input {
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
input.submit{
background-color: #FC6303;
border: 2px solid black;
color: white;
font-weight: bold;
text-transform: uppercase;
cursor: pointer;
cursor: hand;
}
</style>
</head>

<body>
<? if($_GET['mode']=="register"){
if($logged_in){ ?>
<meta http-equiv="Refresh" content="0;url=control.html">
<? }
if($_POST['submit']){ ?>
<div class="v3box blue">
<div class="v3box-top"><h3><? if(!$_POST['user_name'] || !$_POST['user_pass'] || !$_POST['user_hname'] || !$_POST['user_email'] || usernameTaken($_POST['user_name'])){ ?>Register ~ ERROR<? } else { ?>Register ~ Step 2<? } ?></h3></div>
<div class="v3box-content">
<div class="v3box-body">
<? if(!$_POST['user_name'] || !$_POST['user_pass'] || !$_POST['user_hname'] || !$_POST['user_email']){ ?>
Hmm, looks like you didn't fill out a required field. You need to <a href="register.html">go back</a> and fill them in again. Sorry!
<? }
elseif(usernameTaken($_POST['user_name'])){
echo "Sorry, that username is already taken.<br /><a href=\"register.html\">Go back and pick another one</a>";
}
elseif($_POST['user_pass']!==$_POST['con_user_pass']){
echo "Sorry, those two passwords did not match.<br /><a href=\"register.html\">Go back and pick another one</a>";
}
else { ?>
<img src="avatar/<? echo $_POST['user_hname']; ?>" title="<? echo $_POST['user_hname']; ?>" align="left" />Right, well thats all the information we're extracting from you right now.<br />Let's check we got it right though.<br /><br />You want your username to be <b><? echo $_POST['user_name']; ?></b> and your password to be <b><? echo $_POST['user_pass']; ?></b>.<br />
Your Habbo is called <b><? echo $_POST['user_hname']; ?></b> and looks like the Habbo thats standing to the left of this text.<br />
Your email is <b><? echo $_POST['user_email']; ?></b>.<br /><br />
<form action="register.html" method="post">
<input type="hidden" name="user_name" id="user_name" value="<? echo $_POST['user_name']; ?>" />
<input type="hidden" name="user_pass" id="user_pass" value="<? echo $_POST['user_pass']; ?>" />
<input type="hidden" name="user_hname" id="user_hname" value="<? echo $_POST['user_hname']; ?>" />
<input type="hidden" name="user_email" id="user_email" value="<? echo $_POST['user_email']; ?>" />
<input type="submit" name="ok" value="Yep, thats right!" class="submit" />
<input type="submit" name="notok" value="Hmm, I got something wrong..." class="submit" />
</form>
<? } ?>
</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>

<? }
elseif($_POST['ok']){
$md5pass = md5($_POST['user_pass']);
addNewUser($_POST['user_name'],$md5pass,$_POST['user_hname'],$_POST['user_email']);
echo "Congratulations <b>" . $_POST['user_name'] . "</b>!<br />You now have a Habbos Home!<br /><a href=\"login.html\">Login here to edit your profile and home</a><br /><a href=\"http://www.Habbos.us/home/" . $_POST['user_name'] . "\">View your Home</a><br /><br />You can get to your home by visiting Habbos.us/home/" . $_POST['user_name'] . "/<br />Enjoy!";
}
else{
?>
<div class="v3box blue">
<div class="v3box-top"><h3>Register ~ Step 1</h3></div>
<div class="v3box-content">
<div class="v3box-body">
<form id="register" action="register.html" method="post">
  <div class="field-label"><label>Username</label>:</div>
<div class="field-widget"><input type="text" name="user_name" id="user_name" class="required" value="" size="20" tabindex="20" /></div>
  <div class="field-label"><label>Password</label>:</div>
<div class="field-widget"><input type="password" name="user_pass" id="user_pass" class="required validate-password" value="" size="20" tabindex="20" /></div>
<div class="field-label"><label>Password Again</label>:</div>
<div class="field-widget"><input type="password" name="con_user_pass" id="con_user_pass" class="required validate-password" value="" size="20" tabindex="20" /></div>
  <div class="field-label"><label for="user_hname">Habbo Name</label>:</div>
<div class="field-widget"><input type="text" name="user_hname" id="user_hname" class="required" value="" size="20" tabindex="20" /></div>
  <div class="field-label"><label for="user_email">Email</label>:</div>
<div class="field-widget"><input type="text" name="user_email" id="user_email" class="required validate-email" value="" size="20" tabindex="20" /></div>
<div align="right">
<input type="submit" name="submit" id="submit" value="Next" class="submit" />
</div>
</form>
</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>
<? } } else{
if($logged_in){ ?>
<meta http-equiv="Refresh" content="0;url=control.html">
<? }
elseif($_POST['submit']){
   /* Check that all fields were typed in */
   if(!$_POST['user_name'] || !$_POST['user_pass']){ ?>
<div class="v3box blue">
<div class="v3box-top"><h3>Login - ERROR</h3></div>
<div class="v3box-content">
<div class="v3box-body">
Eek! Looks like you forgot to enter a username or password!<br /><a href="login.html">Go back and try again</a>
</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>
   <? }
   else{
   /* Spruce up username, check length */
   $_POST['user_name'] = trim($_POST['user_name']);

   /* Checks that username is in database and password is correct */
   $md5pass = md5($_POST['user_pass']);
   $result = confirmUser($_POST['user_name'], $md5pass);

   /* Check error codes */
   if($result == 1 || $result == 2){ ?>
<div class="v3box blue">
<div class="v3box-top"><h3>Login - ERROR</h3></div>
<div class="v3box-content">
<div class="v3box-body">
Invalid Username or Password</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>
<? }
   else{
   /* Username and password correct, register session variables */
   $_POST['user_name'] = stripslashes($_POST['user_name']);
   $_SESSION['username'] = $_POST['user_name'];
   $_SESSION['password'] = $md5pass;

   /**
    * This is the cool part: the user has requested that we remember that
    * he's logged in, so we set two cookies. One to hold his username,
    * and one to hold his md5 encrypted password. We set them both to
    * expire in 100 days. Now, next time he comes to our site, we will
    * log him in automatically.
    */
   if(isset($_POST['remember'])){
      setcookie("cookname", $_SESSION['username'], time()+60*60*24*100, "/");
      setcookie("cookpass", $_SESSION['password'], time()+60*60*24*100, "/");
   }

   /* Quick self-redirect to avoid resending data on refresh */
   echo "<meta http-equiv=\"Refresh\" content=\"0;url=login.html\">";
   return;
}
}
}
else{
if(!$logged_in){
?>
<div class="v3box blue">
<div class="v3box-top"><h3>Login</h3></div>
<div class="v3box-content">
<div class="v3box-body">
<form id="login" action="login.html" method="post">
  <div class="field-label"><label>Username</label>:</div>
<div class="field-widget"><input type="text" name="user_name" id="user_name" class="required" value="" size="20" tabindex="20" /></div>
  <div class="field-label"><label>Password</label>:</div>
<div class="field-widget"><input type="password" name="user_pass" id="user_pass" class="required validate-password" value="" size="20" tabindex="20" /></div>
<input type="submit" name="submit" id="submit" value="Login" class="submit" />
</form>
</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>
<? } }
if($_GET['mode']=="logout"){
   /* Kill session variables */
   unset($_SESSION['username']);
   unset($_SESSION['password']);
   $_SESSION = array(); // reset session array
   session_destroy();   // destroy session.
?>
<div class="v3box blue">
<div class="v3box-top"><h3>Habbos Homes ~ Logout</h3></div>
<div class="v3box-content">
<div class="v3box-body">
You have successfully logged out.
</div>
</div>
<div class="v3box-bottom"><div></div></div>
</div>
<? } } ?>
</body>
</html>
<? } ?>

Comunidad PHPeros

[AYUDA] Ayuda con un archivo de las homes
« en: 30 de Junio de 2010, 05:08:00 am »