Jump to content
Fórum Script Brasil
  • 0

Travado na página de Login


cesarbourbon
 Share

Question

Olá pessoal.

Bom, sou iniciante e costumo pegar scripts prontos e fazer algumas modificações para ter o resultado que desejo, no script abaixo eu consegui deixar tudo como eu queria, mas não estou conseguindo ir para a área de administração, simplesmente não sai da pagina de login, já tentei de tudo sem sucesso (tudo que conheço), gostei muito do resultado final e realmente gostaria de usar esse script. se puderem me ajudar a resolver esse problema ficarei muito grato.

Meu servidor está com php 4

pasta admin arquivo index.php

 

<?
$requiredUserLevel = array(0,1,2);
$cfgProgDir = 'phpSecurePages/';
include($cfgProgDir . "secure.php");

setcookie("login", $_POST[entered_login]);
setcookie("pass", $_POST[entered_password]);

//include("path.php");
include("../config.php");

$cidade = 1;?>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="text">
  <tr>
    <td width="776" height="92" background="../images/layout/topo-bg.jpg"><table width="800" height="90" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="300" background="../images/layout/logo_admin.png">&nbsp;</td>
        <td width="237" align="right">&nbsp;</td>
        <td width="263" align="right">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#262626">
              <tr>
                      <td height="16"><p><font color="#FFFFFF">&nbsp;
  <? $sql = mysql_query("SELECT * FROM phpsp_users where user='$login'");
$dados = mysql_fetch_array($sql);
$usernivel = "$dados[userlevel]";
$idfranquia = "$dados[id_franquia]";
$idusuarios = "$dados[primary_key]";

//echo $idfranquia;
?>
                      Olá <b><? echo $dados[nome];?></b> (<?
$sql2=mysql_query("SELECT * FROM franquias WHERE id='$dados[id_franquia]'");
$dados2=mysql_fetch_array($sql2);
echo $dados2[cidade];
?>), seja bem vindo!
<td align="right"><a href="logout.php"><font color="#FFFFFF">Sair</font>&nbsp;</a> 
                </td>
              </tr>
</table>


<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/layout/tb_admin_fundo.gif">
  <tr>
    <td><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="200" align="left" valign="top" bgcolor="#FFFFFF"><? include("menu.php");?></td>
        <td align="center" valign="top" bgcolor="#666666"><? include("query_string.php");?>       </td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="789" height="24" align="center" bgcolor="#262626" class="branco"><font color="#CCCCCC">FSOL WEB  &reg; 2012 - Todos os Direitos Reservados</font></td>
  </tr>
</table>

arquivo config.php

 

<?
// conexão com o banco
	$server = "localhost";
  	$user = "MY USER";
  	$senha = "MY SENHA";
	$banco = "MY BANCO";

$conexao = mysql_connect("$server", "$user", "$senha"); $db = mysql_select_db("$banco");
// termina conexão com o banco

$pasta = "galeria";

$sql = mysql_query("SELECT * FROM config WHERE id='1'");
while ($linha = mysql_fetch_array($sql)) {
$tsite = $linha[tsite]; 				// nome do site
$usite = $linha[usite]; 				// url do site, ex: http://www.seusite.com.br/galeria/
$fonte = $linha[fonte]; 				// fonte do site
$tfonte = $linha[tfonte]; 			    // tamanho da fonte usada
$tfonte2 = $linha[tfonte2]; 			    // tamanho da fonte usada
$ttitulo = $linha[ttitulo];			    // tamanho dos titulos do site 
$ttitulo2 = $linha[ttitulo2];			    // tamanho dos titulos do site 
$coronmouse = $linha[coronmouse];		// cor quando passar o mouse em cima dos links #999999
$cortexto = $linha[cortexto]; 		    // cor do texto
$corcelula1 = $linha[corcelula1];		// cor dacelula 1
$corcelula2 = $linha[corcelula2];    	// cor da celula 2
$corfundosite = $linha[corfundosite];   // cor de fundo do site
$qts_thumbs = $linha[qts_thumbs];       // Total de fotos q será exibido do lado esquerdo
$qts_colunas = $linha[qts_colunas];     // total de colunas q será exibido
$qts_ultimos = $linha[qts_ultimos];     // total de eventos q ficarão nas ultimas coberturas
$img_fundo = $linha[img_fundo];        
$loginho = $linha[loginho];
$telefone = "11 - 2233-4455";
$meuemail = "[email protected]";
$corporyth   = "© 2012 - www.weberadiososite";
}

?>

<head>

<SCRIPT language="JavaScript1.2">
var URLSite = window.location.href;
var TituloSite = document.title;
function addfav(){
if (document.all) window.external.AddFavorite(URLSite,TituloSite);
}
</SCRIPT>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><? echo $tsite?></title>

<style type="text/css">
body {
	background-image: url(images/bg.jpg);
	background-position: top;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family: <?=$fonte?>;
	font-size: <?=$tfonte?>;
	color: <?=$cortexto?>;
}

body,td,th {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family: <?=$fonte?>;
	font-size: <?=$tfonte?>;
	color: <?=$cortexto?>;
}

.branco {color: #FFFFFF}

.pequeno {
	font-size: 8px;
	color: #999999;
}

.titulos {
	font-size: <?=$tfonte?>;
	color:  <?=$coronmouse?>;
}

a:link, a:active, a:visited {
color: <?=$cortexto?>;
text-decoration: none;
}

a:hover {
color:  <?=$coronmouse?>;
text-decoration: underline;
}

.input {
	height: 20;
	width: 145;
	border: 1px solid #333333;
	font-family: <?=$fonte?>;
	font-size: <?=$tfonte?>;
	color: #000000;
}
</style>
</HEAD>
 
<body> 
<script src="<? echo $usite?>janelas_popup.js" language="JavaScript"></script>

ARQUIVO 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 = '[email protected]';
  // 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 = false; // 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"] != "127.0.0.1"){
$cfgServerHost = 'localhost';             // MySQL hostname
$cfgServerPort = '';                      // MySQL port - leave blank for default port
$cfgServerUser = 'MY USER';                  // MySQL user
$cfgServerPassword = 'MY SENHA';                  // MySQL password
$cfgDbDatabase = 'MY BANCO';        // MySQL database name containing phpSecurePages table
} else {
$cfgServerHost = 'localhost';             // MySQL hostname
$cfgServerPort = '';                      // MySQL port - leave blank for default port
$cfgServerUser = 'MY USER';                  // MySQL user
$cfgServerPassword = 'MY SENHA';                  // MySQL password
$cfgDbDatabase = 'MY BANCO';        // 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] = 'root';                        // login word
$cfgPassword[1] = 'root';                     // 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"];
?>

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

PHP 4?

No final de 2015 saiu o PHP 7. Recomendo que atualize para, no mínimo, PHP 5.6. Seu servidor pode estar em risco usando uma versão tão obsoleta.

Há vários problemas no seu script, muita coisa obsoleta e que não é mais usada. O ideal é atualizar o PHP, ativar todas as exibições de erro e corrigir cada falha, uma a uma.

 

PS: funções mysql_* estão obsoletas desde o PHP 5.5  e já foram removidas no PHP 7. Prefira usar MySQLi ou PDO. Veja mais aqui: http://rberaldo.com.br/mysql-obsoleto-php/


 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.1k
×
×
  • Create New...