Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. what is ip2long? also change 'REMOTE_ADDR' to $_SERVER['REMOTE_ADDR']
  2. thanks, I will try that solution next. I built this function: <?php function makeNum(){ $q = mysql_query("SELECT id FROM games WHERE id = '$num'"); $n = 1; //Starters. while($n != 0){ if(!isset($_SESSION['dbNum'])){ $_SESSION['dbNum'] = mysql_num_rows(mysql_query("SELECT id FROM games")); } $num = rand($_SESSION['dbNum'] , 2147483647); $n = mysql_num_rows($q); } return $num; } echo makeNum(); ?> I think it might work, what do you think?
  3. How can I set the auto_increment? There is tons of records in the database, but the highest id is 9736. I am thinking about generating a number from 9757 to 30000 as a quick fix.
  4. I am making some changes to an existing website. I did not write the code, the code is horrid. Any who, I have this query: $query = "INSERT INTO `games` (sport,hsid,homescore,vsid,visitorscore,type,`where`,location,date,time,found) VALUES ('$sport','$hq[id]','$homescore','$vq[id]','$visitorscore','$type','Here','$location','$date','$time','1')"; mysql_query($query) or die(mysql_error()); It looks very odd to me, it has a WHERE and a HERE, why? Why not use a update query? Unless this does not update. I am not sure. However, the ID that is inserted is this: 2147483647 (the highest prime number known so far: http://en.wikipedia.org/wiki/2147483647) I am thinking it is this very odd insert query, if not I must dig a little deeper. Any Ideas? Oops: I had a brain fart, the where is a column in the DB, and the here is the value! Man, I am dumb. Does any one have any idea why I get this as the ID?
  5. This might help you: http://www.dreamincode.net/forums/showtopic82278.htm
  6. Hey guys, I am working on a login script for my website. I want you guys to do a full security check. Please create your own account, because I want that tested as well. Test everything. The Forgot System, the Registration Process, The Login Process, any thing else you can think of. Try to access the /administration folder as well! Registration Password: phpfreaks Here is the webby: http://www.krazypickem.com/new_kp/ Proof of Ownership: http://www.krazypickem.com/new_kp/phpfreaks.txt
  7. http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  8. As I have worked with classes before (Java, not PHP), I still have not seen a point yet. However, I am always willing to try something new. I have a form processes page that I have to edit every time I create a major form (login, register, etc) so maybe when I get done with the login system, I will go back and edit it.
  9. I set a 1 in the database when the user logs in. However, when they don't click the logout button, they are stuck as online, and because of the way I have it setup, they can't login. How should I go about checking for expired users? Say, they can only be inactive for 5 minuets. Any ideas? Thanks!
  10. I don't see the point in classes.
  11. I gotcha, save that RAM. So my final code works: <?php function timeCheck($limit){ if(!isset($_SESSION['~limit'])){ $_SESSION['~limit'] = time()+($limit*60); } if(time() >= $_SESSION['~limit']){ unset($_SESSION['~limit']); return "expired"; }else{ return "still chewy"; } } ?>
  12. I see, so adding $limit *= 60; will turn it into minuets?
  13. Most people won't help you out here unless you try. Post some code and maybe we can help you. For starters, take a look at http://php.net/date and maybe even http://php.net/if
  14. Thanks for the help. That does make a lot of sense. Here is my new code: <?php function timeCheck($limit){ if(!isset($_SESSION['~limit'])){ $_SESSION['~limit'] = time()+$limit; } if(time() >= $_SESSION['~limit']){ return "expired"; }else{ return "still chewy"; } } ?> Now I am getting expired. I am setting the limit to 10, would that be 10 seconds or 10 minuets? The manual did not help much.
  15. I have been playing around with checking on users with stale sessions. I decided to give this method a try. When they login a time will be set, in a session, then it will be checked constantly to see if their session is still good. I try putting in 1 as the limit (1 minuet?), but I still get "still chewy". here is the function in question: <?php function timeCheck($limit){ if(!isset($_SESSION['~time']) && !isset($_SESSION['~limit'])){ $_SESSION['~time'] = time(); $_SESSION['~limit'] = time()+$limit; } if($_SESSION['~time'] == $_SESSION['~limit']){ return "expired"; }else{ return "still chewy"; } } ?>
  16. <?php $email = ($_POST['email']); //You forgot the ')' Duh! $name = ($_POST['name']); $details = ($_POST['comments']); ?>
  17. in your database, edit the column with the # sign, remove it, then edit your query.
  18. See I don't have that problem. I have a functions page, a header page, and a footer page. Then I have a main page to tie them all together. Then I include the main page on the user pages. So when I add a function or change something in a function or even the header, then I don't have to go back and change every single page.
  19. <?php session_start(); // Question 1. $_SESSION['num1'] = $number1 = rand(1,10); $_SESSION['num2'] = $number2 = rand(5,15); $_SESSION['ans'] = $answer1 = $number1 + $number2; echo "<p>"; echo "<b>Q1.</b> $number1 + $number2 = <form name='answer1form' method='post' action='index.php'> <input type='text' size='1' name='answer1'/>"; echo "</p>"; echo "<input type='submit' name='Submit' value='Submit'>"; if($_POST['Submit']){ echo "<p>"; echo $_POST['answer1']; echo "</p>"; echo "<p>"; echo $_SESSION['ans']; echo "</p>"; if ($_POST['answer1'] == $_SESSION['ans']) { echo "<p>Correct answer</p>"; } else { echo "<p>Incorrect answer</p>"; } } echo "</form>"; ?>
×
×
  • 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.