Ir para conteúdo
Fórum Script Brasil
  • 0

Não consigo escrever nome do usuario!


tuliocll

Pergunta

Presiso que apareça igual a desse site por exemplo: Bem-vindo(a) nome do usuario

Estou usando esse codigo gerado pelo dreamweaver cs5 : {Recordset1.usuario}

Recordset1 é o nome da minha ligação.

vlw.

sou novo aqui no forum ! e espero ajudar! :rolleyes:

Editado por *FIT*
Retirar palavra AJUDA do titulo conforme REGRA 3.6 *FIT*
Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

qual parte você quer o codigo? do login ou de onde e pra aparecer o nome?

vou mandar os dois

codigo do nome:

<div id="sidebar1">
   <div style="background:#6959CD; color:#fff; border: #000 5px solid; padding: 10px; border-radius:20px; -moz-border-radius: 20px; -webkit-border-radius: 20px;">
     <p><span class="Bemvindo">Bem vindo (a) :<?php echo $row_inicialverlogin['usuario']; ?></span></p>
e o do login
<?php require_once('Connections/login.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
    
  $logoutGoTo = "login erro.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_login, $login);
$query_inicialverlogin = "SELECT * FROM login ORDER BY usuario ASC";
$inicialverlogin = mysql_query($query_inicialverlogin, $login) or die(mysql_error());
$row_inicialverlogin = mysql_fetch_assoc($inicialverlogin);
$totalRows_inicialverlogin = mysql_num_rows($inicialverlogin);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['textfield'])) {
  $loginUsername=$_POST['textfield'];
  $password=$_POST['textfield2'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "Index.php";
  $MM_redirectLoginFailed = "login erro.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_login, $login);
  
  $LoginRS__query=sprintf("SELECT usuario, senha FROM login WHERE usuario=%s AND senha=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $login) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!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>Kings of Glory</title>
<style type="text/css"> 
<!-- 
body  {
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #0000FF;
    background-repeat: repeat;
    background-attachment: fixed;
    background-position: right top;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 100%;
    background-image: url(pladddd.png);
}
.twoColFixLtHdr #container {
    width: 780px;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: medium none #000000;
    text-align: left;
    background-color: #000000;
    page-break-before: auto;
} 
.twoColFixLtHdr #header {
    padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    border: medium none #000000;
    background-color: #000000;
    text-align: right;
} 
.twoColFixLtHdr #header h1 {
    margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.twoColFixLtHdr #sidebar1 {
    float: left; /* since this element is floated, a width must be given */
    width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 10px 15px 20px;
    border: medium none #000000;
    background-color: #000000;
}
.twoColFixLtHdr #mainContent {
    margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
    background-color: #000000;
} 
.twoColFixLtHdr #footer {
    padding: 0 10px 0 20px;
    background-color: #000000;
} 
.twoColFixLtHdr #footer p {
    margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    background-color: #000000;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
    float: left;
    margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
    background-color: #000000;
}
.style1 {
    color: #0000FF;
    background-color: #000000;
}
.ddf {
    text-align: left;
}
.Bemvindo {
    text-align: left;
}
--> 
</style>
<!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]-->
<!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_effectShake(targetElement)
{
    Spry.Effect.DoShake(targetElement);
}
//-->
</script>
</head>

<body class="twoColFixLtHdr">
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<p>
        <label for="textfield"></label>
Login:
<input type="text" name="textfield" id="textfield" />
      </p>
      <p>Senha:
<input type="text" name="textfield2" id="textfield2" />
      </p>
      <p><a href="cadastro2.php">Cadastre-se!</a>
<input type="submit" name="entrar" id="entrar" value="Entrar" />
      </p>
    </form>

Link para o comentário
Compartilhar em outros sites

  • 0

vou testar, logo logo e posto aki! falou? ^_^

Edit: Man foi +ou- quando eu faço login ele aparece como eu queria! XD mas quando eu faço logont ele fica esse codigo :Bem vindo (a) :

Notice: Undefined index: MM_Username in C:\xampp\htdocs\kings\Index.php on line 251

como resolver?

e como faz pra aparecer a senha? vlw

Editado por tuliocll
Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...