Autor Tema: problema con opciones de login.php  (Leído 296 veces)

Desconectado felipon12@ha

  • PHPer@ Fijo
  • ***
  • Mensajes: 102
  • Karma: 1
  • Aprendiendo PHP
    • Ver Perfil
    • iHabber
problema con opciones de login.php
« en: 05 de Mayo de 2010, 00:52:27 am »
bueno son muchas dudas pero ire de a poco la primera es que:

Cambiar nick y subnick
-Tengo una opcion de cambiar tu subnick y poner tu nick de colores, me sale todo y esta todo bien menos que al poner 'guardar cambios' es como que no reconoce a ningun usuario y no se hacen los cambios en el nick o subnick , aqui les dejo el codigo:

Código: [Seleccionar]
<?
session_start();
 ?>
<!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=utf-8" />
<title>Documento sin título</title>
<link href="css/general.css" rel="stylesheet" type="text/css" />
<link href="css/botones.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="459" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="458" height="24" background="images/boxes/bigbox_orange.png"><div class="LetraBlanca" id="Div_Big_Box_Izq" align="left"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                              <tr>
                                <td width="31" align="center" class="Estilo1"><img src="images/icons/new_11.gif" width="15" height="15" /></td>
                                <td width="313" class="LetraBlanca"><strong>iColor de mi nick!</strong></td>
          </tr>
                              </table></div></td>
  </tr>
  <tr>
    <td background="images/boxes/bigbox_middle.png"><div id="Div_Big_Content" align="left">
<?
include("conectar.php");
if(isset($_POST['OK'])) {
function limpiar($d) {
$d = trim($d);
$d = htmlspecialchars($d);
}
$colornick = $_POST['Color'];
$user = $_SESSION['nick'];
$query = mysql_query("SELECT * FROM usuarios WHERE nick='$user'");
$array = mysql_fetch_array($query);
$precio = "5";
if($array[creditos] >= $precio) {
$restar = $array['creditos'] - $precio;
mysql_query("UPDATE `usuarios` SET `colornick` = '$colornick' WHERE nick = '$user'");
mysql_query("UPDATE `usuarios` SET `creditos` = '$restar' WHERE nick = '$user'");
print('Tu color de nick se ha actualizado correctamente');
}else{
print('No tienes creditos suficientes');
}
}else{
?>
<form action="<?=$PHP_SELF;?>" method="post">
    Cabia de tu nick de los colores que quieras.
    Actualizar esto  tiene un valor de <strong>5 coins</strong>.<br />
    <br />
    <center>
<select class="Boton" name="Color" id="Color">
<option value="#000000" selected="selected">Negro</option>
<option value="#00FF2C">Verde</option>
<option value="#008316">Verde intenso</option>
<option value="#F9FF00">Amarillo</option>
<option value="#8C007A">Morado</option>
<option value="#FF8A00">Naranja</option>
<option value="#A9A9A8">Gris</option>
<option value="#41403D">Gris oscuro</option>
<option value="#FF0000">Rojo</option>
<option value="#FF00DF" >Rosa</option>
<option value="#7E4C09">Marron</option>
<option value="#0043FF">Azul</option>
<option value="#050383">Azul intenso</option>
<option value="#00DCC5">Azul-Verde</option>
</select
      ><label>
       &nbsp; <a class="new-button" style="float:right;"><b><input name="OK" id="save" value="Cambiar Color" class="button-b" type="submit"></b><i></i></a>
      </label>
    </center>
    </form>
    <? } ?>
    </div></td>
  </tr>
  <tr>
    <td><img src="images/boxes/bigbox_bottom.png" width="459" height="1" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="459" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="458" height="24" background="images/boxes/bigbox_orange.png"><div class="LetraBlanca" id="Div_Big_Box_Izq" align="left"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                              <tr>
                                <td width="31" align="center" class="Estilo1"><img src="images/icons/new_11.gif" width="15" height="15" /></td>
                                <td width="313" class="LetraBlanca"><strong>iColor de mi nick!</strong></td>
          </tr>
                              </table></div></td>
  </tr>
  <tr>
    <td background="images/boxes/bigbox_middle.png"><div id="Div_Big_Content" align="left">
<?
include("conectar.php");
$n = $_SESSION['nick'];
$q = mysql_query("SELECT * FROM usuarios WHERE nick='$n'");
$a = mysql_fetch_array($q);
if(isset($_POST['OK2'])) {
function limpiar($d) {
$d = trim($d);
$d = htmlspecialchars($d);
}
$subnick = $_POST['Subnick'];
if(strlen($subnick) > 50) {
print('El Subnick no puede tener mas de 30 caracteres');
}else{
mysql_query("UPDATE `usuarios` SET `subnick` = '$subnick' WHERE nick = '$n'");
print('Tu Subnick es:<br>'.$subnick);
}
}else{
?>
    <form action="<?=$PHP_SELF;?>" method="post">
      Aqui pudes cambiar tu subick, pon alguna frase divetida o algo que te represente. No puede ser algo ofensivo<br />
      Actualiza tu <strong>Subnick</strong> desde aqui <strong>gratuitamente.<br />
      </strong><br />
    <center>
      <label>
        <input name="Subnick" type="text" class="Boton" id="textfield" value="<?=$a[subnick];?>" size="40" maxlength="50" />
</label>
<label>
       &nbsp; <br />
       <br />
       <a class="new-button" style="float:right;"><b><input name="OK2" id="save" value="Cambiar Subnick" class="button-b" type="submit"></b><i></i></a>
      </label>
    </center>
    </form>
    <? } ?>
    </div></td>
  </tr>
  <tr>
    <td><img src="images/boxes/bigbox_bottom.png" width="459" height="1" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Tengo mas dudas pero a medida que se resuelva una ire agragando las otras
« Última modificación: 05 de Mayo de 2010, 00:55:34 am por felipon12@ha »

Comunidad PHPeros

problema con opciones de login.php
« en: 05 de Mayo de 2010, 00:52:27 am »