Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Marostegan

Problema em script PHP

Recommended Posts

Pessoal, boa noite!

 

Meu problema: Peguei um cliente novo para dar manutenção nos computadores e instalar um sistema meu de imobiliária (programo em Delphi) - PORÉM, esse cliente tem um site e quer trocar de hosepdagem. O site dele é em PHP e Bando de Dados MySQL , só que o script do site dele é daqueles comprados. Pois bem, já fazem mais de 4 anos que ele usa esse site e tem muitos imóveis cadastrados, não quer trocar o site no momento. tentei trocar o site de hospedagem, mas na nova hospedagem não consegui fazer o site rodar (não tenho muitos conhecimentos em PHP).

 

Dentro do FTP tinha o script "cru" que o cara usou para desenvolver, instalei num domínio meu para testar e ver como configura certinho, para na hora que eu for transferir o site do meu cliente, ocorra tudo certo.

 

Pois bem, consegui configurar o banco de dados e fazer a conexão com o site, está funcionando, veja a página de teste: www.meliponariojardim.com.br

 

O PROBLEMA: Para o Painel Admin, fiz a mesma configuração de conexão, porém esse não funciona de forma alguma: www.meliponariojardim.com.br/admin

 

No banco de dados está cadastro para acesso:

 

Usuario: root

Senha: ******

 

Ou se digitar a senha/usuario errado era para falar Dados inválidos. Mas o que parece é que essa página não está conectado ou puxando os dados do BD. Gostaria de saber se alguém pode me ajudar a resolver esse probleminha, ou mesmo se alguém faz esse serviço, quanto cobra?

 

Preciso mesmo resolver isso, e preciso de ajuda, pois não sei como proceder... Agradeço muito se alguém puder dar essa ajuda... A programação da pagina secure.php é:

<?
$cfgIndexpage = 'index.php';
  // page to go to, if login is cancelled
  // Example: if your main page is http://www.mydomain.com/index.php
  // the value would be $cfgIndexpage = '/index.php'
$admEmail = 'daniel@wm8.com.br';
  // E-mail adres of the site administrator
  // (This is being showed to the users on an error, so you can be notified by the users)
$noDetailedMessages = true;
  // Show detailed error messages (false) or give one single message for all errors (true).
  // If set to 'false', the error messages shown to the user describe what went wrong.
  // This is more user-friendly, but less secure, because it could allow someone to probe
  // the system for existing users.
$passwordEncryptedWithMD5 = true;		// Set this to true if the passwords are encrypted
                                          // with the MD5 algorithm
                                          // (not yet implanted, expect this in a next release)
$languageFile = 'brazil.php';        // Choose the language file
$bgImage = 'bg_lock.gif';                 // Choose the background image
$bgRotate = false;                         // Rotate the background image from list
                                          // (This overrides the $bgImage setting)


/****** Lists ******/
// List of backgrounds to rotate through
$backgrounds[] = 'bg_lock.gif';
$backgrounds[] = 'bg_lock2.gif';
$backgrounds[] = 'bg_gun.gif';


/****** Database ******/
$useDatabase = true;                     // choose between using a database or data as input

/* this data is necessary if a database is used */
if ($HTTP_SERVER_VARS["REMOTE_ADDR"] != "186.202.161.13"){
$cfgServerHost = 'example.com.br';             // MySQL hostname
$cfgServerPort = '';                      // MySQL port - leave blank for default port
$cfgServerUser = 'user';                  // MySQL user
$cfgServerPassword = '*****';                  // MySQL password
$cfgDbDatabase = 'database';        // MySQL database name containing phpSecurePages table
} else {
$cfgServerHost = 'example.com.br';             // MySQL hostname
$cfgServerPort = '';                      // MySQL port - leave blank for default port
$cfgServerUser = 'root';                  // MySQL user
$cfgServerPassword = '*****';                  // MySQL password
$cfgDbDatabase = 'database';              // MySQL database name containing phpSecurePages table
}

$cfgDbTableUsers = 'phpsp_users';         // MySQL table name containing phpSecurePages user fields
$cfgDbLoginfield = 'user';                // MySQL field name containing login word
$cfgDbPasswordfield = 'password';         // MySQL field name containing password
$cfgDbUserLevelfield = 'userlevel';       // MySQL field name containing user level
  // Choose a number which represents the category of this users authorization level.
  // Leave empty if authorization levels are not used.
  // See readme.txt for more info.
$cfgDbUserIDfield = 'primary_key';        // MySQL field name containing user identification
  // enter a distinct ID if you want to be able to identify the current user
  // Leave empty if no ID is necessary.
  // See readme.txt for more info.


/****** Database - PHP3 ******/
/* information below is only necessary for servers with PHP3 */
$cfgDbTableSessions = 'phpsp_sessions';
  // MySQL table name containing phpSecurePages sessions fields
$cfgDbTableSessionVars = 'phpsp_sessionvars';
  // MySQL table name containing phpSecurePages session variables fields


/****** Data ******/
$useData = false;                          // choose between using a database or data as input

/* this data is necessary if no database is used */
$cfgLogin[1] = 'sandro';                        // login word
$cfgPassword[1] = 'sandro';                     // password
$cfgUserLevel[1] = '1';                    // user level
  // Choose a number which represents the category of this users authorization level.
  // Leave empty if authorization levels are not used.
  // See readme.txt for more info.
$cfgUserID[1] = '';                       // user identification
  // enter a distinct ID if you want to be able to identify the current user
  // Leave empty if no ID is necessary.
  // See readme.txt for more info.

$cfgLogin[2] = '';
$cfgPassword[2] = '';
$cfgUserLevel[2] = '';
$cfgUserID[2] = '';

$cfgLogin[3] = '';
$cfgPassword[3] = '';
$cfgUserLevel[3] = '';
$cfgUserID[3] = '';


/**************************************************************/
/*             End of phpSecurePages Configuration            */
/**************************************************************/


// https support
if (getenv("HTTPS") == 'on') {
	$cfgUrl = 'https://';
} else {
	$cfgUrl = 'http://';
}

// getting other login variables
$cfgHtmlDir = $cfgProgDir;
if ($message) $messageOld = $message;
$message = false;

// Create a constant that can be checked inside the files to be included.
// This gives an indication if secure.php has been loaded correctly.
define("LOADED_PROPERLY", true);


// include functions and variables
function admEmail() {
	// create administrators email link
	global $admEmail;
	return("<A HREF='mailto:$admEmail'>$admEmail</A>");
}

include($cfgProgDir . "lng/" . $languageFile);
include($cfgProgDir . "session.php");


// choose between login or logout
if ($logout && !($HTTP_GET_VARS["logout"] || $HTTP_POST_VARS["logout"])) {
	// logout
	include($cfgProgDir . "logout.php");
} else {
	// loading login check
	include($cfgProgDir . "checklogin.php");
}
echo $HTTP_GET_VARS["logout"];
?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Seu script não está entrando na função checkData(). Mas seria interessante corrigir erros de HTML, no topo está abrindo <html><head>. Depois que fecha um <style> fecha </head> e abri a <body> chama um CSS e alguns JS's e depois abre <html><head> novamente, depois fecha </head> e abre <body> novamente.

 

No form, onde está o onSubmit="return checkData()", tente colocar assim: onSubmit="return checkData(this)"

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tive de remover seus dados de conexão, por mais voluntários que existem no fórum, sempre há os mal intencionados.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Seu script não está entrando na função checkData(). Mas seria interessante corrigir erros de HTML, no topo está abrindo <html><head>. Depois que fecha um <style> fecha </head> e abri a <body> chama um CSS e alguns JS's e depois abre <html><head> novamente, depois fecha </head> e abre <body> novamente.

 

No form, onde está o onSubmit="return checkData()", tente colocar assim: onSubmit="return checkData(this)"

 

Amigo, fiz essa alteração mas nada de funcionar o painel de controle... será que tem como arrumar isso?

 

O que mais eu poderia tentar fazer? Muito obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

olá amigo, bom dia!

 

Acho que não estou conseguindo fazer.

 

Olha, esse mesmo script funciona hoje no painel antigo de hospedagem:

 

www.imobialianca.com.br

www.imobialianca.com.br/admin

 

Porém nessa nova hospedagem que é PHP 5.4 funciona só o site o painel ADM não acessa.

 

Tetei fazer as alterações que você faloou, veja por gentileza se ficou certo:

<?PHP

//  ------ create table variable ------
// variables for Netscape Navigator 3 & 4 are +4 for compensation of render errors
$Browser_Type  =  strtok($HTTP_ENV_VARS['HTTP_USER_AGENT'],  "/");
if ( ereg( "MSIE", $HTTP_ENV_VARS['HTTP_USER_AGENT']) || ereg( "Mozilla/5.0", $HTTP_ENV_VARS['HTTP_USER_AGENT']) || ereg ("Opera/5.11", $HTTP_ENV_VARS['HTTP_USER_AGENT']) ) {
	$theTable = 'WIDTH="400" HEIGHT="245"';
} else {
	$theTable = 'WIDTH="400" HEIGHT="245"';
}

//echo $HTTP_ENV_VARS["QUERY_STRING"];

// ------ create document-location variable ------
if ( ereg("php\.exe", $HTTP_SERVER_VARS['PHP_SELF']) || ereg("php3\.cgi", $HTTP_SERVER_VARS['PHP_SELF']) || ereg("phpts\.exe", $HTTP_SERVER_VARS['PHP_SELF']) ) {
	$documentLocation = $HTTP_ENV_VARS['PATH_INFO'];
} else {
	$documentLocation = $HTTP_SERVER_VARS['PHP_SELF'];
}
if ( $HTTP_ENV_VARS['QUERY_STRING'] ) {
	$documentLocation .= "?" . $HTTP_ENV_VARS['QUERY_STRING'];
}
include("../config.php");

?>
<html>
<head>
<title><? echo $tsite?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">     A    {text-decoration: none}
.caixa {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #666666;
	margin: auto;
	border: 1px solid #333333;
}
</style>
<style fprolloverstyle>A:hover {color: #666666; text-decoration: underline}</style>
	</head>
	<body link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0">
<SCRIPT LANGUAGE="JavaScript">
<!--
//  ------ check form ------
function checkData() {
	var f1 = document.forms[0];
	var wm = "<?PHP echo $strJSHello; ?>\n\r\n";
	var noerror = 1;

	// --- entered_login ---
	var t1 = f1.entered_login;
	if (t1.value == "" || t1.value == " ") {
		wm += "<?PHP echo $strLogin; ?>\r\n";
		noerror = 0;
	}

	// --- entered_password ---
	var t1 = f1.entered_password;
	if (t1.value == "" || t1.value == " ") {
		wm += "<?PHP echo $strPassword; ?>\r\n";
		noerror = 0;
	}

	// --- check if errors occurred ---
	if (noerror == 0) {
		alert(wm);
		return false;
	}
	else return true;
}
//-->
</SCRIPT>
<html><head>


<form action='<?PHP echo $documentLocation; ?>' METHOD="post" onSubmit="return checkData(this)">
<table width="100%" height="100% "border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td align="center" valign="middle" background="<? echo $imglateral; ?>"> 
<TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0">
  <TR>
    <TD height="4" ALIGN="center" VALIGN="middle" bgcolor="#F48000"> </TD>
  </TR>
  <TR>
              <TD ALIGN="center" VALIGN="middle"><table width="40%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center"><img src="../images/layout/logo.jpg" width="200" height="154"></td>
                    <td align="center"><table border="0" cellpadding="0" cellspacing="3">
                      <tr>
                        <td height="10" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Usuário:</font></td>
                        <td colspan="2"><input name="entered_login" type="text" class="caixa" size="20"></td>
                      </tr>
                      <tr>
                        <td height="10" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Senha:</font></td>
                        <td colspan="2"><input name="entered_password" type="password" class="caixa" size="20"></td>
                      </tr>
                      <tr>
                        <td colspan="3" align="center"><br>
                        <input style="border:none;" name="logar" value="Entrar" src="../images/layout/enviar.gif" type="image"></td>
                      </tr>
                    </table></td>
                  </tr>
                </table>
                <table width="300" border="0" cellpadding="0" cellspacing="2">
                  <tr valign="top">
                    <td height="35" colspan="3" align="center"><font size="4" face="Arial, Helvetica, sans-serif"><strong>
                      <? //echo $strLoginInterface; ?>
                      <br>
                      </strong></font><strong><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">
                      <?PHP
			// check for error messages
			if ($message) {
				echo $message;
			} ?>
                    </font></strong><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif"> </font></td>
                  </tr>
            </table></TD>
          </TR>
  <TR>
    <TD height="4" ALIGN="center" VALIGN="middle" bgcolor="#F48000"> </TD>
  </TR>
</TABLE>
    </td>
  </tr>
</table>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.forms[0].entered_login.select();
document.forms[0].entered_login.focus();
//-->
</SCRIPT></body></head></html>

Muito obrigado por estar ajudando, pois preciso mesmo fazer isso funcionar.

 

Abraços.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Caros srs.
também enfrento este mesmo problema de não conseguir acessar a área administrativa do cliente, alguém tem alguma dica?

A aplicação foi escrita sobre a plataforma PHP5.2 e aualmente está numa plataforma PHP5.4 aparentemente o problema de incompatibilidade está relacionado ao Register_globals on mas não estou certo disso, alguéme pode me ajudar?

Compartilhar este post


Link para o post
Compartilhar em outros sites

@CyberCaseiroDeSitioDigital

Crie um tópico explicando o seu problema. Apesar de poderem ser problemas parecidos, isso dificulta na explanação.

 

http://forum.imasters.com.br/topic/542539-atencao-orientacoes-e-regras-do-forum-de-php/

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.