Ir para conteúdo
Fórum Script Brasil

eversonbraz

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre eversonbraz

eversonbraz's Achievements

0

Reputação

  1. Nobres colegas, meu caso é o seguinte. Estou engatinhando em PHP e estou fazendo um projetinho para colocar um cadastro em uma pasta dentro de um site que já existe. Como sei quase nada uso o Dreamweaver CS5 para "desenvolver" o projeto. Até ai, beleza. Porém quando envio os arquivos para o servidor do site e faço a configuração da conexão com o mysql, dá erro. Abre a página inicial, que é uma página de login, faz o login; mas quando pra redirecionar para a pagina principal do cadastro acontece o seguinte erro: "Access denied for user 'root'@'localhost' (using password: NO)" Mesmo tendo entrado no cpanel do meu site e colocando uma senha para o meu usuario, ou então deixando em branco, dá esse erro. Alguns códigos que usei estão abaixo. Se alguém puder me ajudar, ficarei muito grato. Muito obrigado. (página Index.php) <?php require('Connections/conexao.php'); ?> <?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; } } ?> <?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['usu_email'])) { $loginUsername=$_POST['usu_email']; $password=$_POST['usu_senha']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "principal.php"; $MM_redirectLoginFailed = "erro_acesso.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_conexao, $conexao); $LoginRS__query=sprintf("SELECT Email, Senha FROM usuarios WHERE Email=%s AND Senha=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $conexao) 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 ); } } ?> (Script de conexão) <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_conexao = "meu_host"; $database_conexao = "meu_banco"; $username_conexao = "meu_usuario"; $password_conexao = "minha_senha"; $conexao = mysql_pconnect($hostname_conexao, $username_conexao, $password_conexao) or die(mysql_error()); ?>
×
×
  • Criar Novo...