-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
na, would be easier if i did
-
to play fair add $id = $_SESSION['tznUserId']; to the top of shaunrigby code
-
this is so much easier working directly ok updated (again) <?php $id = $_SESSION['tznUserId']; $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `surv_member` SET timestamp='$timeout' WHERE memberId='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp`>='$time'") or die(mysql_error()); $display = array(); while($row=mysql_fetch_array($query)) { $display[] = $row['username']; } //spit out the results mysql_close(); foreach($display as $d) { print "$d<br />"; } ?>
-
cool <?php $id = $_SESSION['tznUserId']; $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `surv_member` SET timestamp='$time' WHERE memberId='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp`>='$timeout'") or die(mysql_error()); $display = array(); while($row=mysql_fetch_array($query)) { $display[] = $row['username']; } //spit out the results mysql_close(); foreach($display as $d) { print "$d<br />"; } ?>
-
oh my dang ; try <?php echo "session="; print_r($_SESSION); echo "GET="; print_r($_GET); echo "POST="; print_r($_POST); ?>
-
you could <?php foreach($_POST as $P) { if (!valid_entry($P)) { do_html_header("Problem:"); echo "<p class=\"genmed\">That is not valid data. Please go back " ." and try again.</p>"; do_html_footer(); exit; } } ?> the address would fail
-
i don't mean from the database.. i don't have the infomation required to compleate the script.. ok just guessing here but can you do a echo "session=" print_r($_SESSION); echo "GET=" print_r($_GET); echo "POST=" print_r($_POST); and give me the output please
-
to fix shaunrigby script up data to this $query = mysql_query("SELECT * FROM `surv_member` WHERE `online`= '1' AND `timestamp` >= '" . $timeout . "'") or die("SELECT Stament: " . mysql_error());
-
OK $id isn't being set, do you know what the user's id is ?
-
it would be messy on the return as it will return an array of booleans you can create a loop and just all the function
-
line 552 is missing a )
-
lol would help if i check the logic a little closer <?php echo "ID = $id"; //Added for debugging $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `surv_member` SET timestamp='$time' WHERE memberId='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp`>='$timeout'") or die(mysql_error()); $display = array(); while($row=mysql_fetch_array($query)) { $display[] = $row['username']; } //spit out the results mysql_close(); foreach($display as $d) { print "$d<br />"; } ?> ok done
-
missing ; EDIT: hate to ask but did my code work ?
-
<?php function valid_entry($user_name) { if(ereg("/[^a-zA-Z0-9]/",$user_name)) { return true; }else{ return false; } } ?>
-
update <?php $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `username` SET timestamp='$time' WHERE memberId='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp`>='$timeout'") or die(mysql_error()); $display = array(); while($row=mysql_fetch_array($query)) { $display[] = $row['username']; } //spit out the results mysql_close(); foreach($display as $d) { print "$d<br />"; } ?>
-
who cares the solve button has been pressed, lets get out of here lol Good to know Trium918 your welcome
-
` on the 6th line
-
try this on every page ($id = userid i assumed that is set) <?php $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `username` SET timestamp='$timeout' WHERE memberId='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp` >= '$time'") or die(mysql_error()); while($row=mysql_fetch_array($query)) { $display[] = $row['username']; } //spit out the results mysql_close(); foreach($display as $d) { print "$d<br />"; } ?> logout <?php $time=time(); mysql_query("UPDATE `username` SET timestamp='$time' WHERE memberId='$id' LIMIT 1"); ?> No online field or login script required
-
change UPDATE `username` SET online='0' WHERE memberId='$row[id]' LIMIT 1 to UPDATE `username` SET online='0' WHERE memberId='{$row['id']}' LIMIT 1
-
<?php if (mysql_num_rows($result)>0) { return false; }else{ return true; } ?> <?php // attempt to register $reg_result = register($user_name,$first_name,$last_name,$gender,$birth_month,$birth_day, $birth_year,$contact_number,$email_address,$password,$street_address, $city_county, $state, $postal_code); if ($reg_result === true) { echo "<p class=\"genmed\">Your registration was successful. Go to the members page " ."to start setting up your bookmarks!</p>"; }else{ echo "<p class=\"genmed\">That username is taken - go back and choose another one.</p>"; } ?>
-
How to end a session when the browser is closed?
MadTechie replied to proud's topic in PHP Coding Help
could have some javascipt or an iframe that refreshes that runs a "i'm still here script" -
null means nothing returning (i believe thats a unique name) EDIT: wait a minute thats not right!! can you post the register function code please LOL i hope no one said that dumb mistake of mine LOL
-
yeah but as shaunrigby pointed out when using booleans === is important as <?php $test="false" if($test) // will pass if($test == true) // will pass if($test === true) // will fails ?>
-
do a <?php var_dump($reg_result); die; if ($reg_result == "true") ?> i think your find register() is returning a string not a boolean, as for the ===, this forces the check to be of the same type ie if(1=="1") // works if(1==="1")//fails
-
well this is going off topic, but i would like to know what *nix you use ?