Jump to content

floatermule

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by floatermule

  1. I've just setup an Apache server with a basic LAMP stack. We've decided to use Google Apps (gmail) as our mail server / host. So our ubuntu server is only serving up HTTP files. Because the server is not configured as a mail server, and we're using Gmail for our MX and mail servers, how do I go about using sending out emails via PHP on the Apache Box? I've tried installing Postfix, and configuring using this tutorial, and still a no go. http://www.blogternals.com/2009/04/30/postfix-google-apps-gmail-smtp-relay/ Any Ideas?
  2. ok i've got it... this seems to work fine.. startcount.php <a href="count.php">Start Counting</a> count.php <?php session_start(); if(!isset($_COOKIE[loadtime])){ setcookie("loadtime", time()); $_COOKIE['loadtime'] = time(); } $now = time(); echo $_COOKIE['loadtime']; echo '<br><br>'; echo $now; echo '<br><br>'; echo 'Time Since Set: '; $eTime = $now - $_COOKIE['loadtime']; echo $eTime; $rTime = 30 - $eTime; ?> <br><br> <form name="counter"> <input type="text" size="8" readonly name="d2" class=count></form> <script> <!-- // var milisec=0 var seconds=<?php echo $rTime; ?> document.counter.d2.value='30' function display(){ if(seconds == 0 && milisec == 0){ document.forms.form1.submit() } if (milisec<=0){ milisec=9 seconds-=1 } if (seconds<=-1){ milisec=0 seconds+=1 } else milisec-=1 document.counter.d2.value=seconds+"."+milisec setTimeout("display()",100) } display() --> </script> <form action="resetsess.php" method=GET name=form1> <input type="submit" value="Answer"> </form> resetsess.php <?php setcookie("loadtime", "", -3600); header("Location: startcount.php"); ?>
  3. ok.. i think i have it working... but how do you un set the Session variable ... i've tried using these methods: if(isset($_SESSION[loadtime])){ $_SESSION[loadtime] = time(); } as well as session_unset(); would it be easier to user $_COOKIE rather than $_SESSION? and set an the cookie to expire after 40 secs or something?
  4. i got it to work... kind of... i don't know if your math is right tho... it's adding the elapsed seconds to a new 30 seconds on reload... also, does this reset after each question.. so when the user comes back to the page after answering a question will the sesson variable reset?
  5. it's a good idea.. but i cannot get your code to work... Cannot send session cookie - headers already sent by (output started at blah blah blah..... i guess i'm not to familiar with $_SESSION variables... i did stick the PHP code in the first line of the document...
  6. ok this is a little problem i've been having with a trivia game script i've been working on... here's the scenario.. the user clicks "start a new game", which loads a page that creates a row in a MySQL database with a Unique ID for the user as well as sets the cookie for the UID, that page instantly redirects to a 3rd page where you select the category for the trivia question as well as select your wager for the upcoming question. after the user had made their selections they are sent to a page that selects a question from the database, while another query updates the users history to make sure the question selected is not asked again, this page auto redirects you to the question page... here's where i'm having my problem... i have a counter script (javascript) on the question page that counts down 30 seconds and then auto submits the form... the counter is displayed in a text field. here's the code for the counter: <form name="counter"> <input type="text" size="8" readonly name="d2" class=count></form> <script> <!-- // var milisec=0 var seconds=30 document.counter.d2.value='30' function display(){ if(seconds == 0 && milisec == 0){ document.forms.form1.submit() } if (milisec<=0){ milisec=9 seconds-=1 } if (seconds<=-1){ milisec=0 seconds+=1 } else milisec-=1 document.counter.d2.value=seconds+"."+milisec setTimeout("display()",100) } display() --> </script> Now my problem is that the user can simply refresh the page to reset the counter and give them more time to answer... i would like to figure out a way to stop people from being able to reset that counter by refreshing or using the back button... any idea?? p.s. i've thought about going all Flash so that a refresh would totally start the game over... but flash frames stop when you right-click or click and hold anywhere on the page... so that wouldn't work either...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.