User Status: Online / Offline

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

so the moment the new ms browser comes out you'll stop supporting ie 6? the moment ie 6 came out you stopped supporting ie 5.5?

to force the latest is always bad, unless there is some specific functionality you need.

to support everyone, unless the client wants that, is often insane.

my personal belief is to write expecting that it's not more than 2 revisions back.

at this point, unless they're using lynx (a lot of linux users a i know still use this at times) or a webclipper (they have a palm or other mobile computing device) i expect them to be using something that supports html 4.0 or higher, unless we're talking microsoft, which thinks they write standards and therefore deals with everything in odd ways... id est: http://people.brandeis.edu/~m3rajk/JMT/ ... signup.php

look at that in ie, and in mozilla.

you'll notice that in w3c compliant browsers it looks right. in ie it has a hideous amount of "padding" even though the source is.....

Code: Select all

<html>
  <head>
    <title>FindYourDesire.com Signup page -- 1</title>
    <meta name="Author" content="coded by: Josh Perlmutter">
    <style type="text/css">
      <!-- this comment is for non-css compliant browsers
      &#123;text-decoration=none&#125;
      end of css -->
    </style>
  </head>
  <body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4" link="#ffffff">
    <center><p>&nbsp;</p>
      <!-- banner goes here -->
      <!-- ad bar goes here -->
       <h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>
      <!-- nav bar goes here -->
      <table frame="box" bgcolor="#000000" border="3" cellpadding="0" cellspacing="0" text="#c8c8c8" width="750">
	  <tr>
	    <td><a href="login.php">Log In!</a></td>
	    <td><a href="faq.php">F.A.Q. & T.O.S.</a></td>
	    <td><a href="new.php">New Users</a></td>
	    <td><a href="top.php">Top Users</a></td>
	  </tr>
	  <tr>
	    <td valign="bottom"><a href="signup.php">Sign Up!</a></td>
	    <td valign="bottom"><a href="forums.php">Forums</a></td>
	    <td valign="bottom"><form name="qsearch" action="profile.php"><input type="text" maxlength="15" size="15" name="un"></td>
	    <td valign="bottom"><input type="submit" value="Find User!"></form></td>
	  </tr>
      </table>
	     <h1>debug line: validation = </h1>
             <h1>debug line: step = </h1>
      <p>Thank you for your interest in signing up for FindYourDesire.com. Before you can sign up, you need to agree to a few baisc terms of service</p>
      <form action="/~m3rajk/JMT/preview/phpprev/signup.php" method="POST">
	<input type="hidden" name="step" value="2">
	<table frame="void" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000" text="#c8c8c8">
	    <tr><td>I have read and agree to the <a name="#lw" href="#lw" onClick="window.open('faq.php?seek=lw', 'faq', 'height=250,width=500,scrollbars=yes');">Liabilty Waiver</a></td><td><input type="checkbox" name="lw" value="agree"></td></tr>
	    <tr><td>I have read and agree to the <a name="#gtu" href="#gtu" onClick="window.open('faq.php?seek=gtu', 'faq', 'height=250,width=500,scrollbars=yes');">General Terms of Use</a></td><td><input type="checkbox" name="gtu" value="agree"></td></tr>
	    <tr><td>I have read and agree to the <a name="#fcc" href="#fcc" onClick="window.open('faq.php?seek=fcc', 'faq', 'height=250,width=500,scrollbars=yes');">Forum Civilty Code</a></td><td><input type="checkbox" name="fcc" value="agree"></td></tr>
	    <tr><td>I have read and agree to the <a name="#privacy" href="#privacy" onClick="window.open('faq.php?seek=privacy', 'faq', 'height=250,width=500,scrollbars=yes');">Privacy Policy</a></td><td><input type="checkbox" name="pp" value="agree"></td></tr>
	    <tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
	</table>
      </form>
    </center>
  </body>
</html>
note: i'm using ie 6 with all the patches for ie testing. i expect most people have been assimilated and will be using ie5.5 or 6

w3c compliant browsers actually do the valign.
ie, as you can see, puts the button as a diff valign than stated, and pads, which is turned OFF
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Anything with a border higher than 1 in IE looks ugly. BTW For me they look pretty much the same, other than the fact that Mozilla makes the table border dark gray.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

m3rajk wrote:so the moment the new ms browser comes out you'll stop supporting ie 6? the moment ie 6 came out you stopped supporting ie 5.5?
no no no... I didn't mean that I only supported the lastest version and bollocks to everything else. What it all boils down to is if the browser can do 'getElementById' stuff... if it can then I am happy with that.

Basically browsers that don't support dynamic content, and by that I mean dynamically changing the HTML code using JavaScript. The MS Dom object allows many many good things to be done in real-time, and now with the new Gecko support so does NS.

People who use browsers that can't do real-time dynamic changes are, in my view, not worth coding for any more.

:roll:
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

Speaking about mobile devices like Palm (old models like 90a) and cell phones: they can go to the WAP pages instead HTML, so they will get “normal” look of the page, because of page optimization for this kind of devices… :!:
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

“mudkicker”, the code you gave on page 2, it is just a login script (and I would destroy session if the number of rows < 0, not just disconnect from db)
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

I guess you people convinced me to use inner frame (even that I don’t like to use frame, especially in development process)

:?: But still just for general information… is there any way to obtain username from session file? (Just the user name, nothing more nothing less)
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

Just tried to do my script by using inline frame… well there is some small problem… the session variable from original frame doesn’t want to pass on other frames…
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

alexus wrote:Just tried to do my script by using inline frame… well there is some small problem… the session variable from original frame doesn’t want to pass on other frames…
That's strange!

As long as the pages you are calling are on the same site and your not pulling in pages from other sites, and as long as you remember to use start_session() on the iframe pages as well as the main pages it should work fine.

Are you keeping the iframe visible so you can debug?
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

alexus wrote:Just tried to do my script by using inline frame… well there is some small problem… the session variable from original frame doesn’t want to pass on other frames…
Do you have cookies on?
see also: http://se2.php.net/session
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

Ops…
I forgot to call session on the frame page…
(I always use include… )
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Ah I'm sure everyone here has done that at one time or another.... forgot to include something obvious like that and then spent an hour or two scratching our head wondering what the hell's going on... I know I have :D
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

like i said, it's better to do an update in the db ona full page load. why? what phappens if someone leave the computer and the page is open to your site. now assume it's a college kid in class. the kid is gone at least an hour. do you really want him online the entire time?

if someone's looking for who's activbely there then only the full pagelload should matter. anyone else might have the page open, but they aren't actively there.
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

So finely I’ll assume that my script will be something like this:

User enters the page, logging in… his name will be set for session… + his page open time will be added to data base as UNIX time stamp…

Then to see how many users are online I’ll select * from DB where time < 60sec and then I’ll either print the names of the users or just print the number of rows found…
---------------------------------------------------------------------------------
1. So then I might have one additional theoretical (or maybe rather psychological) question, what the time should be given to the person to be count as online?

2. And speaking about students, if for example student is taking online test (that might take him 30-120min to finish) and I want to keep his status as online…. [Actually while I was typing this I found the answer by myself…. I’ll just use inline frame there…]

So lets see what problems will I get by doing my script…
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

alexus wrote:Then to see how many users are online I’ll select * from DB where time < 60sec and then I’ll either print the names of the users or just print the number of rows found…
You don't have to print anything. But make sure you send headers to prevent caching. If you don't, the browser might use a local copy instead of fetching a new one. If that happens, no activity will be registered at the server, thus, the user becomes offline.

So be sure to send these:

Code: Select all

<?php

//If You are using SSL or if any browser doesn't do what you expect. 
//    Try to disable one header at a time and test 
//    without it to track down wich one fails.
// They are all headers to prevent caching in different ways.

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                          // HTTP/1.0

?>
EDIT: I mean that those headers should be sent from at least the online checker script. But since you are developing something with dynamic content, I recommend sending them in every scripted page. If a user sits behind a proxy he/she (and you! of course :)) might get into trouble with cached pages, without those headers. Data may get corrupted aswell, if you don't design/use the database correctlyl
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post by alexus »

Ok, thanks for advise, I’ll use that…..
Post Reply