#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Hi,

    I have been attempting to set up a very basic protected page. This would be based on a cookie. I know that it is easily cracked however I don't care if it's cracked.

    I am using PHP 3 (since my web host hasn't upgraded yet to PHP 4). Basically, I have checked for a cookie, than cross-checked it with my database. If it's good, they will see a page, if not, they don't.

    In MSIE 5.0 the page works fine. I have tested it with a cookie, deleting the cookie and creating my own cookie. MSIE handles each response appropriately.

    Netscape loads the appropriate page, however it doesn't render. The page continues to say that it's loading. When I stop the browser to view the source, my page is there but it doesn't show on my screen.

    Since I am a newbie to PHP, I was curious if it was a problem with my code or if it was a problem with Netscape that every other programmer knows about. I have included the code just in case. The actual HTML pages has been omitted as with critical information about my database.

    Thanks for your time.

    Richard Fujimoto
    Fuji Creations, Inc. http://wwww.fujicreations.com

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    <?php

    function showheader ($title){
    ?>
    <html><head><title><?php echo $title ?>
    </title><link rel="stylesheet" href="styles.css"></head>
    <?php
    }

    function showfooter() {
    ?>
    </body></html><?php}if ($user_name AND $id_hash) {
    $db = mysql_connect("localhost", "?????"); mysql_select_db("??????", $db);

    $query = mysql_query("SELECT * FROM ???? WHERE (user_name='$user_name')"); $info = mysql_fetch_array($query);

    if (mysql_num_rows($query) < 1 ) {

    showheader("You are unauthorized to view this page"); ?> <body bgcolor="#FFFFFF"> <table cellpadding=5 cellspacing=3 border=0 width=400><tr> <td><font face=arial size=4>Sorry, You Dont Have The Key</td> </tr></table> <?php showfooter(); exit; }

    elseif (mysql_num_rows($query) == 1) { showheader("You are authorized"); ?>

    <body bgcolor="#FFFFFF"><DIV ID="overDiv" STYLE="position:absolute; visibility:hide;"></DIV>

    <SCRIPT TYPE="" LANGUAGE="JavaScript"><!-- var width = "250"; var border = "3"; var offsetx = 2; var offsety = 2; var fcolor = "#CCCCFF"; var backcolor = "#000099"; var textcolor = "#000000"; var capcolor = "#FFFFFF"; var closecolor = "#99FF99";// -->

    </SCRIPT>
    <script src="overlib.js" type="text/javascript" language="Javascript"></script>

    <table><tr><td> This will be some text. And the actual HTML Page.</td></tr></table>

    <?php showfooter();

    exit; }
    }
    else { showheader("You Have Not Registered") ?><table><tr><td> Text, Blah, blah</td></tr></table>
    }
    ?>
    [/code]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    Well the PHP code its self doesn't care what your browser it is. Usually if NS doesn't display anything, it's because a </table> tag was omitted or just bad html in general. But all the PHP work is done on the server side, so it doesn't care about the browser.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    That's what I thought.

    But I have checked the HTML, and everything looks fine to me.

    Could it be the use of the functions showheader() and showfooter().

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 03:54 PM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo