[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-db
Subject:    [PHP-DB] big sessions problem - page refusing to load, but will if I skip the logon
From:       chip.wiegand () simrad ! com
Date:       2002-09-30 14:39:28
[Download RAW message or body]

I have a logon screen that starts a session for several other pages and it 
has been working great, 
over the weekend something happened. I checked the site from home and 
after login the main
page would not load, just a white screen and view source showed absolutely 
nothing. Now I'm in the
office and looking at the source code and I don't see anything wrong, 
nothing changed. I can load the
pages by skipping the logon and typing in the complete url manually and 
they all load just fine, soon
as I try to use the logon screen the first main page after it will not 
load, if I enter the full url to another
protected page it will load, then I can use the links for the main page 
and it too will now load. Just after
the logon, the main page will not load. I have tried this with both my own 
login and a users login and
it is happening to all.
Any idea what could be causing this? I've gotta get this fixed ASAP, 
perminently, this is a business web
site. The code for the login screen and the main page are pasted below.
Regards,
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
chip.wiegand@simrad.com

"There is no reason anyone would want a computer in their home."
     --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 9? Somebody help me!)
=========================
Code for authorization login:
-------------------------------------------
<?php
//auth_user.php
include "../common_db.inc";
$register_script = "register.php";

function auth_user($userid, $userpassword) {
   global $default_dbname, $user_tablename;
 
   $link_id = db_connect($default_dbname);
   $query = "SELECT username FROM $user_tablename 
                             WHERE userid = '$userid' 
                             AND userpassword = '$userpassword'";
   $result = mysql_query($query);
   if(!mysql_num_rows($result)) return 0;
   else {
      $query_data = mysql_fetch_row($result);
      return $query_data[0];
   }
}

function login_form() {
   global $PHP_SELF;
?>
<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="<? echo $PHP_SELF ?>">
   <DIV ALIGN="CENTER"><CENTER>
      <H3>Please log in to access the page you requested.</H3>
   <TABLE BORDER="1" WIDTH="200" CELLPADDING="2">
      <TR>
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP>ID</TH>
         <TD WIDTH="82%" NOWRAP>
            <INPUT TYPE="TEXT" NAME="userid" SIZE="8">
         </TD>
      </TR>
      <TR>
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP>Password</TH>
         <TD WIDTH="82%" NOWRAP>
            <INPUT TYPE="PASSWORD" NAME="userpassword" SIZE="8">
         </TD>
      </TR>
      <TR>
         <TD WIDTH="100%" COLSPAN="2" ALIGN="CENTER" NOWRAP>
            <INPUT TYPE="SUBMIT" VALUE="LOGIN" NAME="Submit">
         </TD>
      </TR>
   </TABLE>
   </CENTER></DIV>
</FORM>
</BODY>
</HTML>
<?
}
session_start();
if(!isset($userid)) {
   login_form();
   exit;
}
else {
   session_register("userid", "userpassword");
   $username = auth_user($userid, $userpassword);
   if(!$username) {
      session_unregister("userid");
      session_unregister("userpassword");
      echo "<center><p>Authorization failed.<br>" .
           "Sorry, you must enter a valid userid and password combo.</p> " 
.
           "<p>This site is restricted to Simrad Authorized Dealers 
only.<br>\n";
      echo "Click <a href=\"$PHP_SELF\">here</A> to try again.</p>";
      echo "<p>If you are a Simrad Authorized Dealer and \n";
                        echo "you are not a member yet,<br>please " .
           "call Simrad, Inc and request your login information.</p>\n";
      echo "<p>If you are not a Simrad Authorized Dealer please click on 
the<br> \n";
                        echo "following link to return to our home page 
\n";
                        echo "<a href=\"../index.php\">Simrad, 
Inc</a></p></center>\n";
      exit;
   }
  // else 
  // { 
    //echo "<p><a href=\"dealers_page.php\">Click here</a> to continue";
                //header( 'Location: dealers_page.php' ); 
  // } 
}
?>

==========================================
Code for the main page after the successful login:
-------------------------------------------------------------------------
<?
include "auth_user.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <? include "../connect";
       $sql = "select * from main where cat = 'dealers' and page = 
'dealers'";
       $result = mysql_query($sql);
       while ($row=mysql_fetch_array($result))
       { printf("<title>%s</title>", $row["name"]); } 
   ?>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />
    <meta name="target"
    content="td, tda, tda157, 157, tda 157, tdc, tdc338, tdc 338, tdl, 
td-l, 1100, 1550, 1620, tb, tb548, tb 548, buoy, radio buoy, direction 
finder, df, addf" />
<? include "../metatags_pages.inc"; ?>
<style type="text/css">
/*<![CDATA[*/
td.small {font-size: 75%}
.red {color: red;
                  font-size: 75%; }
.black {color: black;
                          font-size: 75%; }
.big {font-size: 150% }
/*]]>*/
</style>
</head>
<body>
<!-- Code for Extreme Tracker -->
<a target="_top" href="http://t.extreme-dm.com/?login=sim100">
<!-- <img src="http://u1.extreme-dm.com/i.gif" height=38
border=0 width=41 alt="">-->&nbsp;</a><script 
language="javascript1.2"><!--
EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?
EXb=EXs.colorDepth:EXb=EXs.pixelDepth;//-->
</script><script language="javascript"><!--
EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";
EXd.write("<img src=\"http://t0.extreme-dm.com",
"/0.gif?tag=sim100&j=y&srw="+EXw+"&srb="+EXb+"&",
"l="+escape(EXd.referrer)+"\" height=1 width=1>");//-->
</script><noscript><img height=1 width=1 alt=""
src="http://t0.extreme-dm.com/0.gif?tag=sim100&j=n"></noscript>

<div class="c1">
       <table width="90%" align="center" cellpadding="5"
      cellspacing="0" border="0"
      summary="Simrad Logo image with buttons to Index, Contact and 
Search">
        <tr>
          <td class="center" colspan="3">
                <img src="../topp2.jpg" border="0" />
         </a>
         <br />
          </td>
        </tr>
        <tr>
          <td class="center">&nbsp;</td>
          <td class="center"><a href="../index.php"
                        title="Click here to return to the Simrad, Inc 
home page">
          <img src="../home.gif" alt="" width="30"
          height="30" border="0" /></a></td>
          <td class="center">&nbsp;</td>
        </tr>
      </table>
<? 
// Place the page title line from the database, with a gray background
$sql = "select * from main where cat = 'dealers' and page = 'dealers'";
$result = mysql_query($sql);
while ($row=mysql_fetch_array($result))
{ 
print "<table border=0 align=center width=90%><tr><td>";
printf("<p class=\"title\">%s</p>", $row["name"]);
print "</td></tr></table>"; } 
?>
<table summary="Body of the index page" width="90%" border="0" 
align="center">
<tr>
<td>
<table width="200" summary="Product Menu" border="0" align="center">
<tr><td class="menu" cellpadding="0" cellspacing="0">
<?
// create the product menu from the database 
$sql = "select * from main where cat = 'dealers' and id >= 118 order by 
'order'";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result))
{ 
printf("<a href='%s?id=$row[id]'>%s</a><br />", $row["page"], 
$row["name"]);
} 
?>
</td></tr>
</table>
<table width="200" summary="Seperator" align="center">
<tr>
<td>
<br /><hr /><br />
</td>
</tr>
</table>
<? include "../secondary-main-sql.inc" ?>
<table width="200" summary="Seperator" align="center">
<tr>
<td>
<br /><hr /><br />
</td>
</tr>
</table>
<? include "../secondary-menu-sql.inc" ?>
<td>
<td>
            <table width="100%" border="0" cellpadding="20"
            cellspacing="0" align="center"
            summary="Welcome to Simrad, Inc.">
              <tr>
               <td class="small" width="50%">
                                                         <p><span 
class="big">W</span>elcome to the Simrad Authorized Dealers web pages. 
Here you will be able to 
                                                         connect to the 
eBusiness Manager web site, read Dealer Bulletins, and more as we 
                                                         continue to build 
this section of our web site. Please feel free to contact us 
                                                         with suggestions 
for what you would like to see in this section.
                                                         </p>
                                                         <p><span 
class="big">N</span>avigating this Site: at the top of each page is an 
'up-arrow', this will bring you back to the Dealers
                                                         Site home page, 
with the exception of the forums - click on the Simrad logo at the top of
                                                         the page to 
return. In the chat room click on Leave Chat.</p>
                                                         <p>Notes:</p>
                                                         <ol>
                                                         <li>These web 
pages have been tested in browsers of versions 5.x or newer.
                                                         They have tested 
in Opera 5 and 6, Netscape 6 and 7, Mozilla 1 and 1.1, and IE 5.5 and 6.
                                                         If you are using 
a 4.x browser please upgrade it to the latest version. (The pages don't
                                                         display properly 
in the older browsers). These pages are all designed for best viewing
                                                         at a screen 
resolution of 800x600 or higher.</li>  
                                                         <li>The original 
Dealer Bulletin mentioned there would be manuals to download, but
                                                         it turns out that 
we are not allowed to put service manuals on the web. This leaves all
                                                         other manuals - 
installation, operators, instruction, etc - available on the regular Tech
                                                         Support and FAQ's 
page on the main web site menu.</li>
                                                         <li>If you click 
on a link in the lower two sections of the menu you will have to use
                                                         your browsers 
back button to return to these pages. Or click on the Dealers Only link 
(which
                                                         may require 
another login, depending on browser and browser version).</li>  
                                                                </td>
                                                                <td 
width="50%" bgcolor="#e5d879">
                                                                <p><span 
class="red">Dealer Bulletins</span><br /><span class="black"> - You can 
read all 
                                                                the Simrad 
Dealer Bulletins published since January 2001 online. They can be sorted 
by
                                                                author or 
date. And when printed look just like the mailed Dealer 
Bulletins.</span></p>
                                                                <p><span 
class="red">eBusiness Manager</span><br /><span class="black"> - You can 
check 
                                                                invoices 
and sales orders status, product availability, view sales order history 
and check
                                                                your 
credit status - all online!</span></p> 
                                                                <p><span 
class="red">Logos</span><br /><span class="black"> - We have our 
authorized Simrad
                                                                logo 
available in several formats and sizes, just right-click the one you want 
and save it.
                                                                If you 
need one in a differant format please <a href="../contact.php">contact the 
webmaster</a>.
 </span></p> 
                                                                <p><span 
class="red">Info</span><br /><span class="black"> - This page will contain 
information
                                                                or 
downloads specificly useful in your daily business. We have our price book 
available for 
                                                                download, 
and will add more items as needed.</span></p> 
                                                                <p><span 
class="red">Forums</span><br /><span class="black"> - Forums are a place 
for discussions.
                                                                You could 
use these for exchanging information about Simrad products, ask questions 
that others may
                                                                be able to 
help you with, post 'want-ads' (looking for a part for a customer but 
can't find it? Maybe
                                                                another 
Simrad dealer can help).</span></p> 
                                                                <p><span 
class="red">Chat Room</span><br /><span class="black"> - Who doesn't like 
to chat, right?
                                                                Here is a 
place you can go to chat with Simrad dealers from across the country, no 
long distance
                                                                phone 
calls to make. Just remember, this is not an Instant Messenger type chat, 
it is a chat room,
                                                                so you'll 
be able to chat with others who are in the chat room also. There is a 
complete help file
                                                                online, 
please read it to get familiar with all the options of the chat 
room.</span></p> 
                                                                <p><span 
class="red">Refurbished Products</span><br /> <span class="black"> - Now 
we have given you 
                                                                a list of 
all the refurbished products we have available. This should make it easier 
for you to sell
                                                                these 
items at discounted prices to customers who may otherwise choose a less 
expensive brand. Please
                                                                contact 
Simrad Sales for pricing information.</span></p> 
                                                                </td> 
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <? include "../footer.inc" ?>
    </div>
  </body>
</html>

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic