RE: Re: session vars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaunak Kashyap wrote:

>> -----Original Message-----
>> From: João Cândido de Souza Neto [mailto:joao@xxxxxxxxxxxxxxxxxxx]
>> Sent: Tuesday, March 21, 2006 11:26 AM
>> To: php-general@xxxxxxxxxxxxx
>> Subject: Re:  Re: session vars
>> 
>> This code's exactly the one that produce the error.
>> 
>> That is, in the line:
>> 
>> <a href="<? echo $_SESSION["root"]; ?>/about.php">
>> 
>> ought to write <a href="http://localhost/buffets/about.php";>
>> 
>> Did you understand?
>> 
>> --
>> ---------------------------------------------------
>> João Cândido de Souza Neto
>> Web Developer
>> 
> 
> Can you please provide the simplest example starting from where
> $_SESSION["root"] is initialized to where it is first unsuccessfully used,
> in the following format:
> 
> top.php:
> (insert example code here)
> 
> page.php:
> (insert example code here)
> 
> ... and any other relevant files ...
> 
> 
> Shaunak Kashyap
>  
> Senior Web Developer
> WPT Enterprises, Inc.
> 5700 Wilshire Blvd., Suite 350
> Los Angeles, CA 90036
>  
> Direct: 323.330.9870
> Main: 323.330.9900
>  
> www.worldpokertour.com
>  
> Confidentiality Notice:  This e-mail transmission (and/or the attachments
> accompanying) it may contain confidential information belonging to the
> sender which is protected.  The information is intended only for the use
> of the intended recipient.  If you are not the intended recipient, you are
> hereby notified that any disclosure, copying, distribution or taking of
> any action in reliance on the contents of this information is prohibited.
> If you have received this transmission in error, please notify the sender
> by reply e-mail and destroy all copies of this transmission.

Ok guy, don't fight with me. hehehe

Follow's all code of files.

In the file /index.php the session is started, the "root" session variable
is registered and defined, in the In the file sca/index.php the file
top.php if included and in the file top.php the variable $_SESSION["root"]
hasn't value.

Thanks for your help.

File top.php:

<div align="center">
        <center>
                <table width="780" border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF">
                        <tr>
                                <td colspan="2">
                                        <img src="img/topo.jpg" width="780" height="117">
                                </td>
                        </tr>
                        <tr>
                                <td width="353" height="24" background="img/bg_menu.jpg"
style="PADDING-LEFT:10px">
                                        <table height="24" border="0" cellpadding="0" cellspacing="0">
                                                <tr>
                                                        <td style="PADDING-TOP:5px;PADDING-BOTTOM:4px">
                                                                <?
                                                                        function retorna_data ( ) {
                                                                                $agora = time();
                                                                                $data = getdate($agora);
                                                                                
                                                                                if($data["wday"]==0) { echo "Domingo, "; }
                                                                                elseif($data["wday"]==1) { echo "Segunda-feira, "; }
                                                                                elseif($data["wday"]==2) { echo "Terça-feira, "; }
                                                                                elseif($data["wday"]==3) { echo "Quarta-feira, "; }
                                                                                elseif($data["wday"]==4) { echo "Quinta-feira, "; }
                                                                                elseif($data["wday"]==5) { echo "Sexta-feira, "; }
                                                                                elseif($data["wday"]==6) { echo "Sábado, "; }
                                                                                
                                                                                if($data["mon"]==1) { $mes="Janeiro"; }
                                                                                elseif($data["mon"]==2) { $mes="Fevereiro"; }
                                                                                elseif($data["mon"]==3) { $mes="Março"; }
                                                                                elseif($data["mon"]==4) { $mes="Abril"; }
                                                                                elseif($data["mon"]==5) { $mes="Maio"; }
                                                                                elseif($data["mon"]==6) { $mes="Junho"; }
                                                                                elseif($data["mon"]==7) { $mes="Julho"; }
                                                                                elseif($data["mon"]==8) { $mes="Agosto"; }
                                                                                elseif($data["mon"]==9) { $mes="Setembro"; }
                                                                                elseif($data["mon"]==10) { $mes="Outubro"; }
                                                                                elseif($data["mon"]==11) { $mes="Novembro"; }
                                                                                elseif($data["mon"]==12) { $mes="Dezembro"; }
                                                                                
                                                                                $data_atual = $data["mday"]." de ".$mes." de ".$data["year"];
                                                                                
                                                                                return $data_atual;
                                                                        }
                                                                        
                                                                        $hoje = retorna_data ( );
                                                                        echo $hoje;
                                                                ?>
                                                        </td>
                                                        <td style="PADDING-LEFT:15px;PADDING-RIGHT:4px">
                                                                <img border="0" src="img/clock.gif" width="12" height="24">
                                                        </td>
                                                        <td style="PADDING-TOP:5px;PADDING-BOTTOM:4px">
                                                                <?
                                                                        $hora = date("H:i:s");  //Pegou a hora
                                                                        echo $hora;
                                                                ?>
                                                        </td>
                                                </tr>
                                        </table>
                                </td>
                                <td width="427" height="24" background="img/bg_menu.jpg"
style="PADDING-RIGHT:5px">
                                        <table height="24" border="0" align="right" cellpadding="0"
cellspacing="0">
                                                <tr>
                                                        <td>
                                                                <img border="0" src="img/div_menu.jpg" width="13" height="24">
                                                        </td>
                                                        <td style="PADDING-LEFT:5px;PADDING-RIGHT:5px;PADDING-TOP:1px">
                                                                <div align="center">
                                                                        <a href="<? echo $_SESSION["root"]; ?>">
                                                                                Sobre o Sistema
                                                                        </a>
                                                                </div>
                                                        </td>
                                                        <td>
                                                                <img border="0" src="img/div_menu.jpg" width="13" height="24">
                                                        </td>
                                                        <td style="PADDING-LEFT:5px;PADDING-RIGHT:5px;PADDING-TOP:1px">
                                                                <div align="center">
                                                                        <a href="<? echo $_SESSION["root"]; ?>dicas.php">
                                                                                Dicas para seu Evento
                                                                        </a>
                                                                </div>
                                                        </td>
                                                        <td>
                                                                <img border="0" src="img/div_menu.jpg" width="13" height="24">
                                                        </td>
                                                        <td style="PADDING-LEFT:5px;PADDING-RIGHT:5px;PADDING-TOP:1px">
                                                                <div align="center">
                                                                        <a href="<? echo $_SESSION["root"]; ?>suporte.php">
                                                                                Suporte
                                                                        </a>
                                                                </div>
                                                        </td>
                                                        <td>
                                                                <img border="0" src="img/div_menu.jpg" width="13" height="24">
                                                        </td>
                                                        <? if (!empty($_SESSION["idsis"])) { ?>
                                                                <td style="PADDING-LEFT:5px;PADDING-RIGHT:5px;PADDING-TOP:1px">
                                                                        <div align="center">
                                                                                <a href="../sair.php">
                                                                                        Sair
                                                                                </a>
                                                                        </div>
                                                                </td>
                                                                <td>
                                                                        <img border="0" src="img/div_menu.jpg" width="13" height="24">
                                                                </td>
                                                        <? } ?>
                                                </tr>
                                        </table>
                                </td>
                        </tr>
                        <tr>
                                <td height="1" colspan="2"></td>
                        </tr>
                </table>
        </center>
</div>

Page sca/index.php:

<? session_start(); ?>
<? if ((!isset($_SESSION["login"])) && (!isset($_SESSION["idsis"]))) { ?>
        <script language="javascript">
                <!--
                window.location="../";
                -->
        </script>
<? } else { ?>
        <?
                include("../includes/config.php");
                include("../includes/funcoes.php");
                include("../includes/classes.php");
                $logado=new usuario($_SESSION["login"],$_SESSION["idsis"]);
        ?>
        <html>
                <head>
                        <title><? echo $logado->nome_sistema; ?></title>
                        <base href="<? echo $_SESSION["root"].$logado->contexto_sistema; ?>/">
                        <link href="<? echo $_SESSION["root"]; ?>/includes/estilos.css"
rel="stylesheet" type="text/css">
                </head>
                <body>
                        <? include($_SESSION["root"]."includes/topo.php"); ?>
                        <center>
                                <table border="0" cellpadding="0" cellspacing="0" width="500"
height="300">
                                        <tr>
                                                <? foreach($logado->menus as $menus) { ?>
                                                        <td align="center" valign="middle">
                                                                <? echo $menus[1]; ?>
                                                                <br>
                                                                <br>
                                                                <? foreach($logado->funcoes[$menus[0]] as $funcoes) { ?>
                                                                        <a href="<? echo $funcoes[3]; ?>"><? echo $funcoes[1]; ?></a>
                                                                        <br>
                                                                <? } ?>
                                                                <br>
                                                        </td>
                                                <? } ?>
                                        </tr>
                                </table>
                        </center>
                        <? include($_SESSION["root"]."includes/rodape.php"); ?>
                </body>
        </html>
<? } ?>

File /index.php

<?
        session_start();
        if (!isset($_SESSION["login"],$_SESSION["idsis"],$_SESSION["erro"]
$_SESSION["pagina_erro"],$_SESSION["root"]))
session_register("login","idpes","idsis","erro","pagina_erro","root");
        $_SESSION["root"]="http://localhost/buffets/";;
?>
<html>
        <head>
                <title>Sistema Administrativo - Nome do Buffet</title>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                <base href="<? echo $_SESSION["root"]; ?>">
                <link href="includes/estilos.css" rel="stylesheet" type="text/css">
                <script language="javascript">
                        <!--
                                function verifica_login(obj) {
                                        if (obj.login.value.length==0) {
                                                alert("Obrigatório informar login!");
                                                obj.login.focus();
                                                return false;
                                        }
                                        if (obj.senha.value.length<6) {
                                                alert("Obrigatório informar uma senha com no mínimo 6 e no máximo 10
dígitos!");
                                                obj.senha.focus();
                                                return false;
                                        }
                                        return true;
                                }
                        -->
                </script>
        </head>
        <body onload="document.form_login.login.focus();">
                <? include("includes/topo.php"); ?>
                <div align="center">
                        <center>
                                <table width="780" border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF">
                                        <tr>
                                                <td>
                                                        <br>
                                                        <? if (!empty($_SESSION["erro"]) &&
$_SESSION["pagina_erro"]=="index.php") { ?>
                                                                <div align="center" class="erro">
                                                                        <? echo $_SESSION["erro"]."<br><br>"; ?>
                                                                </div>
                                                        <? } ?>
                                                        <form name="form_login" action="autentica.php" method="post">
                                                                <table width="500" border="0" align="center" cellpadding="1"
cellspacing="0" bgcolor="#E8E8E8">
                                                                        <tr>
                                                                                <td>
                                                                                        <table width="500" border="0" cellpadding="5" cellspacing="2"
bgcolor="#F9F9F9">
                                                                                                <tr>
                                                                                                        <td>
                                                                                                                <div align="center">
                                                                                                                        <table width="100%" border="0" cellspacing="0"
cellpadding="5">
                                                                                                                                <tr>
                                                                                                                                        <td valign="top">
                                                                                                                                                <tr width="100%" border="0" cellpadding="0"
cellspacing="1" bgcolor="#E8E8E8">
                                                                                                                                                        <tr>
                                                                                                                                                                <td bgcolor="#CCCCCC">
                                                                                                                                                                        <table width="100%" border="0" cellpadding="5"
cellspacing="1" bgcolor="#FFFFFF">
                                                                                                                                                                                <tr>
                                                                                                                                                                                        <td width="28">
                                                                                                                                                                                                <img border="0" src="img/icone_login.jpg" width="32"
height="32">
                                                                                                                                                                                        </td>
                                                                                                                                                                                        <td><strong><font color="#17478E">Sistema
Administrativo</font></strong></td>
                                                                                                                                                                                </tr>
                                                                                                                                                                        </table>
                                                                                                                                                                </td>
                                                                                                                                                        </tr>
                                                                                                                                                </table>
                                                                                                                                        </td>
                                                                                                                                </tr>
                                                                                                                        </table>
                                                                                                                        <table width="100%" border="0" cellspacing="0"
cellpadding="5">
                                                                                                                                <tr>
                                                                                                                                        <td valign="top">
                                                                                                                                                <table width="100%" border="0" cellpadding="0"
cellspacing="1" bgcolor="#E8E8E8">
                                                                                                                                                        <tr>
                                                                                                                                                                <td bgcolor="#CCCCCC">
                                                                                                                                                                        <table width="100%" border="0" cellpadding="5"
cellspacing="1" bgcolor="#FFFFFF">
                                                                                                                                                                                <tr>
                                                                                                                                                                                        <td>
                                                                                                                                                                                                <table width="250" border="0" align="center"
cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
                                                                                                                                                                                                        <tr bgcolor="#FFFFFF">
                                                                                                                                                                                                                <td width="26%" height="25">
                                                                                                                                                                                                                        <div align="right">
                                                                                                                                                                                                                                <font size="1" face="MS Sans Serif, Arial">
                                                                                                                                                                                                                                        Login: 
                                                                                                                                                                                                                                </font>
                                                                                                                                                                                                                        </div>
                                                                                                                                                                                                                </td>
                                                                                                                                                                                                                <td width="74%" height="25">
                                                                                                                                                                                                                        &nbsp;
                                                                                                                                                                                                                        <input name="login" id="login" type="text"
maxlength="20" style="font-family: 'MS Sans Serif'; font-size: 7.5;
background-color: #F9F9F9">
                                                                                                                                                                                                                </td>
                                                                                                                                                                                                        </tr>
                                                                                                                                                                                                        <tr bgcolor="#FFFFFF">
                                                                                                                                                                                                                <td height="25">
                                                                                                                                                                                                                        <div align="right">
                                                                                                                                                                                                                                <font size="1" face="MS Sans Serif, Arial">
                                                                                                                                                                                                                                        Senha: 
                                                                                                                                                                                                                                </font>
                                                                                                                                                                                                                        </div>
                                                                                                                                                                                                                </td>
                                                                                                                                                                                                                <td height="25"><font size="1" face="MS Sans
Serif, Arial">
                                                                                                                                                                                                                        &nbsp;
                                                                                                                                                                                                                        <input type="password" name="senha" id="senha"
maxlength="10" style="font-family: 'MS Sans Serif'; font-size: 7.5;
background-color: #F9F9F9">
                                                                                                                                                                                                                </td>
                                                                                                                                                                                                        </tr>
                                                                                                                                                                                                        <tr bgcolor="#FFFFFF"> 
                                                                                                                                                                                                                <td height="25" colspan="2">
                                                                                                                                                                                                                        <div align="center">
                                                                                                                                                                                                                                <img border="0" src="img/bot_entrar.gif"
onclick="if (verifica_login(document.form_login))
document.form_login.submit(); else return false;" style="cursor:pointer;">
                                                                                                                                                                                                                        </div>
                                                                                                                                                                                                                </td>
                                                                                                                                                                                                        </tr>
                                                                                                                                                                                                </table>
                                                                                                                                                                                        </td>
                                                                                                                                                                                </tr>
                                                                                                                                                                        </table>
                                                                                                                                                                </td>
                                                                                                                                                        </tr>
                                                                                                                                                </table>
                                                                                                                                        </td>
                                                                                                                                </tr>
                                                                                                                        </table>
                                                                                                                </div>
                                                                                                        </td>
                                                                                                </tr>
                                                                                        </table>
                                                                                </td>
                                                                        </tr>
                                                                </table>
                                                                <br>
                                                                <br>
                                                        </form>
                                                </td>
                                        </tr>
                                </table>
                        </center>
                </div>
                <? include("includes/rodape.php"); ?>
        </body>
</html>

-- 
---------------------------------------------------
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux