472,328 Members | 1,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Login Form Issue

matheussousuke
249 100+
I dont get any error message, it's simple, some pages works ok, they simply show "Welcome, 'username'.
LOGOUT (link)"

The same as Bytes, when u login, u dont see the form anymore, u just see a link written "Sign out".


But there are a few pages that still show the Login Form, I don't know why, They show the login form, but the user is logged already, so, it wont force them login again, anyway, that's weird.

Here the code of the page that's working fine
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.2">
  2.    var ie=document.all
  3.    var dom=document.getElementById
  4.    var ns4=document.layers
  5.  
  6.    var bouncelimit=32 //(must be divisible by 8)
  7.    var direction="up"
  8.  
  9.    function initbox(){
  10.     if (!dom&&!ie&&!ns4)
  11.     return
  12.     crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
  13.     scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
  14.     crossobj.top=scroll_top-250
  15.     crossobj.visibility=(dom||ie)? "visible" : "show"
  16.     dropstart=setInterval("dropin()",5)
  17.    }
  18.    function dropin(){
  19.     scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
  20.     if (parseInt(crossobj.top)<300+scroll_top) //(vertical position, the horizontal position can be changed directly on the layer)
  21.     crossobj.top=parseInt(crossobj.top)+90
  22.     else{
  23.      clearInterval(dropstart)
  24.      bouncestart=setInterval("bouncein()",50)
  25.     }
  26.    }
  27.    function bouncein(){
  28.     crossobj.top=parseInt(crossobj.top)-bouncelimit
  29.     if (bouncelimit<0)
  30.     bouncelimit+=8
  31.     bouncelimit=bouncelimit*-1
  32.     if (bouncelimit==0){
  33.      clearInterval(bouncestart)
  34.     }
  35.    }
  36.    function dismissbox(){
  37.     if (window.bouncestart) clearInterval(bouncestart)
  38.     crossobj.visibility="hidden"
  39.    }
  40.    function get_cookie(Name) {
  41.     var search = Name + "="
  42.     var returnvalue = ""
  43.     if (document.cookie.length > 0) {
  44.      offset = document.cookie.indexOf(search)
  45.      if (offset != -1) {
  46.       offset += search.length
  47.       end = document.cookie.indexOf(";", offset)
  48.       if (end == -1)
  49.       end = document.cookie.length;
  50.       returnvalue=unescape(document.cookie.substring(offset, end))
  51.      }
  52.     }
  53.     return returnvalue;
  54.    }
  55.    function dropornot(){
  56.     if (get_cookie("droppedin")==""){
  57.      window.onload=initbox
  58.      document.cookie="droppedin=yes"
  59.     }
  60.    }
  61.    dropornot()
  62.    function redo(){
  63.     bouncelimit=32
  64.     direction="up"
  65.     initbox()
  66.    }
  67.    window.onload=initbox
  68.   </script>
  69.  </HEAD>
  70.  <BODY>
  71.   <div id="dropin" style="position:absolute; left:230px; top:0px; width:500; height:150; background-color:#FFFFFF; z-index: ;visibility: hidden; z-index: 9999; background-image: url(http://lucrebem.com.br/spacer.gif); layer-background-image: url(spacer.gif); border: 1px none #000000;">
  72.    <TABLE WIDTH="100%" HEIGHT="100%" BORDER="1" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#000000">
  73.     <TR>
  74.      <TD valign="top"><div align="right"><a class="link" href="javascript:dismissbox()"><FONT FACE="Verdana" SIZE="-2"><B>X</B></FONT></a>&nbsp;</div>
  75.      <FONT FACE="Verdana" SIZE="-1" COLOR="DODGERBLUE">
  76.      <p><FONT FACE="Verdana" SIZE="2">&nbsp;<strong>Insira seu anúncio aqui, e aumente seus lucros agora mesmo! <a href="http://lucrebem.com.br/promote_your_ad.php">Saiba mais...</a></strong></FONT></p>
  77.      <p align="center"><img src="/business_people_jumping.jpg" width="300" height="300"></p></TD>    </TR>
  78.    </TABLE>
  79. </div>
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. <?
  94.  
  95.  
  96.  
  97. require_once 'path_cnfg.php';
  98.  
  99. require_once(path_cnfg('pathToLibDir').'func_common.php');
  100. require_once(path_cnfg('pathToLibDir').'func_checkUser.php');
  101. require_once(path_cnfg('pathToCnfgDir').'cnfg_vars.php');
  102. require_once(path_cnfg('pathToLibDir').'vars_gbl.php');
  103.  
  104. $cookie = $HTTP_COOKIE_VARS['log_in_cookie'];
  105.  
  106. $myDB = db_connect();
  107.  
  108. checkUser('', ''); 
  109.  
  110. $content = array();
  111. $content[] = 'doMain();';
  112.  
  113. // This line brings in the template file.
  114. // If you want to use a different template file 
  115. // simply change this line to require the template 
  116. // file that you want to use.
  117. require_once(path_cnfg('pathToTemplatesDir').cnfg('tmplt_index'));
  118.  
  119. db_disconnect($myDB);
  120.  
  121.  
  122. # --- START FUNCTIONS ---
  123.  
  124. // *********** START FUNCTION doMain() *************
  125.  
  126. function doMain(){
  127.  
  128. ?>
  129.  
  130.  
  131.  
  132. <?
  133. $a = file_get_contents("http://lucrebem.com.br/showCatJobs.php?cat_id=159");
  134. echo ($a);
  135. ?>
  136.  
  137.  
  138.  
  139.  <STYLE>
  140.    A.link:link {color: black; text-decoration: none}
  141.    A.link:visited {color: black; text-decoration: none}
  142.    A.link:active {color: black; text-decoration: none} 
  143.    A.link:hover {color: black; text-decoration : none;}
  144.   </STYLE>
  145.  
  146.  
  147.  
  148.     <?
  149.  
  150. } // end function doMain()
  151.  
  152. // *********** END FUNCTION doMain() *************
  153.  
  154.  
  155.  
  156.  
  157. ?>
  158.  



Here a page that keeps showing the login form
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4. require_once 'path_cnfg.php';
  5.  
  6. require_once(path_cnfg('pathToLibDir').'func_common.php');
  7. require_once(path_cnfg('pathToLibDir').'func_checkUser.php');
  8. require_once(path_cnfg('pathToLibDir').'func_tree.php');
  9. require_once(path_cnfg('pathToCnfgDir').'cnfg_vars.php');
  10. require_once(path_cnfg('pathToLibDir').'vars_add_edit.php');
  11. require_once(path_cnfg('pathToLibDir').'vars_gbl.php');
  12.  
  13. $myDB = db_connect();
  14.  
  15. $content = array();
  16.  
  17. $cookie = $HTTP_COOKIE_VARS['log_in_cookie'];
  18.  
  19.  
  20. if (isset($cat_id) ) 
  21. {   $content[] = '$path;' ;
  22.     $gbl["func_arg_arr"] = array("cat_id"=>$cat_id);
  23.     $content[] = 'checkUser(\'ask_to_add($cat_id)\', \'você precisa efetuar log in.\', $gbl["func_arg_arr"]); ' ;
  24. }
  25. else
  26. {   $content[] = 'checkUser(\'get_tree(select_to_add)\', \'você precisa efetuar log in, se ainda não é cadastrado, clique <a href="register.php">aqui.\');'; 
  27. }
  28.  
  29. // This line brings in the template file.
  30. // If you want to use a different template file 
  31. // simply change this line to require the template 
  32. // file that you want to use.
  33. require_once(path_cnfg('pathToTemplatesDir').cnfg('tmplt_select_to_add'));
  34.  
  35. db_disconnect($myDB);
  36.  
  37.  
  38. # ------- START FUNCTIONS ------
  39.  
  40.  
  41. // ************* START FUNCTION ask_to_add() *************
  42.  
  43. function ask_to_add($cat_id)
  44. {
  45.     GLOBAL $myDB ;
  46.  
  47.     echo 'Abaixo está o caminho para a categoria que você escolher:<BR><BR>';
  48.  
  49.     $path = climb_tree($cat_id, 'select_add') ; 
  50.     $path_arr = split("\!\@\#_SPLIT_\!\@\#", $path);
  51.     for ($i=0; $i<count($path_arr); $i++)
  52.     {   echo $path_arr[$i] ;
  53.         if($i < count($path_arr)-2)
  54.         {   echo '<FONT CLASS="subCat" COLOR="#FF0000"><B>>> </B></FONT>' ;
  55.         }
  56.     }
  57.  
  58.  
  59.     echo '<BR><BR>';
  60.     echo '<a href="add_item.php?cat_id='.$cat_id.'"><img src="lucrebemicons/additemtothiscategory.png" border="0"/>&nbsp;<FONT CLASS="subCat">Clique aqui para adicionar um item à esta categoria</FONT></a>';
  61.     echo '<P>';
  62.     echo '<NOSCRIPT>';
  63.     echo '<a href="select_to_add.php"><FONT CLASS="subCat">Clique aqui para escolher uma categoria diferente</FONT></a><BR>';
  64.     echo '</FONT>';
  65.     echo '</NOSCRIPT>';
  66.  
  67.     echo '<SCRIPT LANGUAGE="JAVASCRIPT">';
  68.     echo 'document.write(\'<a href="javascript:history.go(-1);"><FONT CLASS="subCat"><img src="lucrebemicons/chooseanothercategory.png" border="0"/>&nbsp;Clique aqui para escolher uma categoria diferente</FONT></a><BR>\');';
  69.     echo '</SCRIPT>';
  70.  
  71. } // end function ask_to_add() 
  72.  
  73. // ************* END FUNCTION ask_to_add() *************
  74.  
  75.  
  76. ?>
  77.  
  78.  
  79.  
  80.  
  81.  


The template file (It contains the login form)
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Lucre Bem - Por que o céu é o limite.</title>
  4.  
  5. <META NAME="DESCRIPTION" CONTENT="Anuncie completamente grátis, por que aqui você pode.">
  6. <META NAME="ABSTRACT" CONTENT="Site de anúncios grátis, e concursos públicos.">
  7. <META NAME="KEYWORDS" CONTENT="anuncios de classificados, anuncios classificados, de graça, que barato, meu site, anuncie, anunciar, classificados de carros, anuncios de emprego, anuncios de carros, classificados de imoveis, classificados de empregos.">
  8. <META NAME="LANGUAGE" CONTENT="PT">
  9.  
  10. <meta name="google-site-verification" content="rR2J7YCNNtCUv739KCRQnsiT5X-1mcU8lMo-BlzifIk" />
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. <style type="text/css">
  28. <!--
  29. .style1 {
  30.     font-family: tahoma;
  31.     font-size: 12px;
  32. }
  33. -->
  34. </style>
  35. </head>
  36.  
  37. <style type="text/css">
  38. <!--
  39. body {
  40.     margin-left: 0px;
  41.     margin-top: 0px;
  42.     margin-right: 0px;
  43.     margin-bottom: 0px;
  44. }
  45. .style3 {
  46.     font-size: 12px;
  47.     color: #006600;
  48.     font-family: Tahoma;
  49.     font-weight: bold;
  50. }
  51. .style6 {
  52.     font-family: Georgia, "Times New Roman", Times, serif;
  53.     font-size: 12px;
  54.     font-weight: bold;
  55.     color: #006600;
  56. }
  57. -->
  58. </style>
  59.  
  60.  
  61. <body>
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. <?php main_css(); ?>
  82. <style type="text/css">
  83. <!--
  84. body {
  85.     background-image: url();
  86.     margin-left: 0px;
  87.     margin-right: 0px;
  88.         margin-top: 0px;
  89.     margin-bottom: 0px;
  90. }
  91. .style2 {color: #000000; font-family: Geneva, Arial, Helvetica, sans-serif;}
  92. #Layer1 {
  93.     position:absolute;
  94.     left:51px;
  95.     top:421px;
  96.     width:70px;
  97.     height:85px;
  98.     z-index:1;
  99. }
  100. #Layer2 {    position:absolute;
  101.     left:337px;
  102.     top:-57px;
  103.     width:247px;
  104.     height:102px;
  105.     z-index:1;
  106. }
  107. -->
  108. </style>
  109. <script src="http://lucrebem.com.br/templates/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
  110. <script src="http://lucrebem.com.br/templates/Scripts/AC_ActiveX.js" type="text/javascript"></script>
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119. <table width="834" border="0" cellpadding="0" cellspacing="0">
  120.   <!--DWLayoutTable-->
  121.   <tr>
  122.     <td height="24" colspan="5" align="right" valign="top" bgcolor="DEEDFF"><?php main_header(); ?>    </td>
  123.   </tr>
  124.   <tr>
  125.     <td height="30" colspan="5" align="right" valign="top" bgcolor="DEEDFF"><?php top_nav(); ?></td>
  126.   </tr>
  127.   <tr>
  128.     <td height="24" colspan="4" align="center" valign="top" bgcolor="DEEDFF">
  129.       <FORM ACTION="<?=cnfg('deDir')?>search.php?doSearch=1" METHOD="POST">
  130.         &nbsp;<input name="search" type="text" size="50" />
  131.         <select name="category">
  132.           <option value="none">Todas as categorias</option>
  133.           <?php
  134.  
  135.     get_cat_optionshome();
  136.  
  137.     ?>
  138.         </select>
  139.         <input type="submit" name="submit" value="Pesquisar" />
  140.         <input type="hidden" name="searchType" value="keyword" />
  141.         <?php
  142.  // end function search_by_keyword_form()
  143.  
  144. // *********** END FUNCTION search_by_keyword_form() *************
  145.  
  146.  
  147.  
  148. // *********** START FUNCTION get_cat_optionshome() *************
  149.  
  150. function get_cat_optionshome()
  151. {
  152.     $query = 'SELECT cat_name, cat_id 
  153.               FROM std_categories 
  154.               WHERE parent_id=0 ORDER BY cat_name ASC ';
  155.  
  156.     $result = mysql_query($query);
  157.  
  158.     while ($row = mysql_fetch_array($result) )
  159.     {   echo '<OPTION VALUE="'.$row['cat_id'].'">';
  160.         echo $row['cat_name'] ;
  161.         echo "</OPTION>" ;
  162.     } 
  163.  
  164. } // end function get_cat_optionshome()
  165.  
  166. // *********** END FUNCTION get_cat_optionshome() *************
  167.  
  168.  
  169. ?>
  170.                       </FORM></td>
  171.   <td width="154" rowspan="3" align="left" valign="top" bgcolor="DEEDFF">      <p>
  172.     <?
  173. log_in_form_and_status();
  174.  
  175.  
  176. /*
  177. require "adrotator/ad.php";
  178.  
  179. echo show_ad();
  180.  
  181. */
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  ?>
  188.     <br>
  189.     <span class="style3"><font type="tahoma">Vagas de emprego na &aacute;rea tecnol&oacute;gica.</font></span></p>
  190.     <p><span class="style3"><font type="tahoma">S&atilde;o Paulo</font></span>
  191.       <iframe src="iframe.html" width="150" height="780" scrolling="no"></iframe>
  192.     </p></td>
  193.   </tr>
  194.   <tr>
  195.     <td width="11" rowspan="3" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
  196.     <td width="17" rowspan="3" valign="top" background="/images/bg_leftNav.gif"><?php display_cats_main(); ?></td>
  197.     <td height="19" colspan="2" align="left" valign="top" bgcolor="#DEEDFF">
  198.  
  199.     <script type="text/javascript">
  200.  
  201.   var _gaq = _gaq || [];
  202.   _gaq.push(['_setAccount', 'UA-8104996-4']);
  203.   _gaq.push(['_trackPageview']);
  204.  
  205.   (function() {
  206.     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  207.     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  208.     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  209.   })();
  210.  
  211.     </script>
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.     <script type="text/javascript"><!--
  222. google_ad_client = "pub-1337074307357116";
  223. /* 728x90, criado 21/12/09 */
  224. google_ad_slot = "3197427874";
  225. google_ad_width = 728;
  226. google_ad_height = 90;
  227. //-->
  228.     </script>
  229.     <script type="text/javascript"
  230. src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  231.     </script>
  232.  
  233.  
  234.  
  235. &nbsp;    </td>
  236.   </tr>
  237.   <tr>
  238.     <td height="949" colspan="2" valign="top"><?php content($content); ?></td>
  239.   </tr>
  240.   <tr>
  241.     <td width="645" height="212" align="right" valign="middle" bgcolor="DEEDFF">
  242.  
  243.       <!--  
  244.  
  245.       <a href="http://www.permutalivre.com.br/indicacao/?id=189985"><img src="http://www.permutalivre.com.br/images/banner_afiliados.gif" alt="Compre e venda produtos novos e usados" width="580" height="160" border="0" align="absmiddle"></a>
  246.  
  247.  
  248.      -->      </td>
  249.     <td colspan="2" align="right" valign="top" bgcolor="DEEDFF"><img src="http://lucrebem.com.br/templates/template/knowhow.gif" width="161" height="212" border="0" usemap="#1Map" />
  250.       <map name="1Map" id="Map">
  251.         <area shape="poly" coords="78,52" href="#" />
  252.         <area shape="rect" coords="2,-2,160,207" href="promote_your_ad.php" />
  253.                         </map>    </td>
  254.   </tr>
  255.   <tr>
  256.     <td height="19" colspan="5" valign="top" bgcolor="DEEDFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
  257.   </tr>
  258.   <tr>
  259.     <td height="56" colspan="5" align="center" valign="top">     <span class="style1">2009 - 2011<br />
  260. Lucre Bem <br />
  261. Todos os direitos reservados <br />
  262. Desenvolvido por <a href="http://matheusgrafix.com">MatheusGrafix.coM</a> - Hospedado por <a href="http://mghospedagem.com">MGhospedagem</a> 
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.     </span></td>
  271.   </tr>
  272.   <tr>
  273.     <td height="1"></td>
  274.     <td></td>
  275.     <td></td>
  276.     <td width="7"></td>
  277.     <td></td>
  278.   </tr>
  279. </table>
  280.  
  281.  
  282.  
  283.  
  284. </body>
  285. </html>
  286.  



I think that the part responsible for the cookies is just in the begining of each code. Sorry for providing such a huge code, it's cause I just dont know exactly where the issue is located.
Apr 15 '11 #1
3 3092
Dormilich
8,658 Expert Mod 8TB
Here a page that keeps showing the login form
weeelll, you unconditionally write the login part to the output, of course it shows every time…

getting serious, your whole page needs a lifting
- the language attribute on script tags is outdated, use the type attribute (even IE uses JS 1.5)
- browser sniffing is bad practice (for instance Opera will be tagged as IE) rather test for the functionality you want to use (document.layers was last used in NN4)
- the <font> tags are deprecated (use CSS instead)
- don’t use tables for layout (use CSS instead)
- don’t switch between PHP and HTML too often (more than twice), you’ll loose oversight
Apr 16 '11 #2
matheussousuke
249 100+
LOOL - I'll follow ur optimization advice.


weeelll, you unconditionally write the login part to the output, of course it shows every time…
Yup, the login form is on the template file, but it should work fine in all the files, instead, it just work fine in a few files, is that some kind of conflict?
Apr 16 '11 #3
Dormilich
8,658 Expert Mod 8TB
if you’re including the template file with the login, then you have it, otherwise not. to be honest, I can’t spot anything due to the wild mix (and the lack of file names). all that I can say in the current situation is: don’t include that file if you don’t want the login.

PS. $HTTP_COOKIE_VARS => $_COOKIE
Apr 16 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or...
1
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that...
2
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
3
by: NecroJoe | last post by:
I am using PHP to generate a little javascript for one of my pages. In short it allows a user to select a value from a list and pop it into a form...
5
by: Mateusz Loskot | last post by:
Hi, I'd like to ask how XML parsers should handle attributes which consists of &quot; entity as value. I know XML allows to use both: single and...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this ...
8
by: Ulysse | last post by:
Hello, I need to clean the string like this : string = """ bonne mentalit&eacute; mec!:) \n <br>bon pour info moi je...
1
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. ...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.