Jump to content

Petsmacker

Members
  • Posts

    71
  • Joined

  • Last visited

    Never

Everything posted by Petsmacker

  1. Hey, thanks for your contribution but I didn't mean the points themselves. I meant their position. So the team with the most points - in the 'Pos' column would be '1', 2nd would be 2 etc.
  2. Sorry, having to post again to bump cos I fear this is being lost and I really need help with it. I'll continue to try and get it but...
  3. I only use cookies for my log-in and log-out systems. They're far more reliable and convenient. Look into the setcookie() function and change the $_SESSION variables on your page to $_COOKIE Sessions are unreliable for log in stuff. You should also have a 'password' cookie as well with an encrypted password. Otherwise people could simply use software to edit the 'userid' cookie to whatever they want and then be logged in as anybody else.
  4. Basically I have a website where people are sorted into one of 4 teams when they join and throughout 2 months they earn points - the team with most points at the end of the month are the winners - easy. What I want is Something like this: [table][tr][td]TEAM[/td][td]Team 1[/td][td]Team 2[/td][td]Team 3[/td][td]Team 4[/td][/tr][tr][td]POS.[/td][td][center]3[/center][/td][td][center]1[/center][/td][td][center]2[/center][/td][td][center]4[/center][/td][/tr][/table] So POS would mean what position they had come at the end of the month when I close the game. The only problem is that sometimes houses can get the same amount of points so in that case the positions should be like: [table][tr][td]TEAM[/td][td]Team 1[/td][td]Team 2[/td][td]Team 3[/td][td]Team 4[/td][/tr][tr][td]POS.[/td][td][center]2[/center][/td][td][center]1[/center][/td][td][center]2[/center][/td][td][center]3[/center][/td][/tr][/table] for example I've tried using tons of IF statements but when it came to the houses having equal points in some instances it made things too complicated for me. I hope somebody can help!
  5. It works, thanks for both your helps.
  6. Yaharharhar!! The ouput I get is '-1'.
  7. My code is: <? $dates="Jun 2, 2006, 9:13pm"; function convert($date) { //format: "Nov 13, 2006, 10:06pm"; //eliminate commas and seperate the parts $date = explode(" ", str_replace(",", "", $dates)); //determine am / pm, remove the text, adjust the hours if necessary if (substr($date['3'], -2, 2) == "pm") { list($hour, $minute) = explode(":", rtrim($date[3], 'pm')); $hour += 12; } else { list($hour, $minute) = explode(":", rtrim($date[3], 'am')); } //reconstruct and pass to strtotime return strtotime($date[2] . "-" . $date[0] . "-" . $date[1] . " " . $hour . ":" . $minute); } ?> But get no output whatsoever.
  8. I know there's a way of converting a timestamp to time with gmdate: e.g - $timeworkedout=gmdate("d M Y H:i:s", $time); No way to convert it back? Is there a way to have it come out as a variable? I mean I could sort it so that if the 'am' or 'pm' bit is a problem I could have it convert the hour to 24 hour format by having the PHP recognise the letters 'am' or 'pm'.
  9. I was hoping to turn this: [i]Nov 13, 2006, 10:06pm[/i] into a UNIX timestamp when posted in a form Bearing in mind its not 24 hours time and the times can not be changed. I'm basically transferring posts from a proboards board to my own site but that means transferring all 19,000 posts so obviously we're looking for ways to speed up the process of the transfer. Hope you can help.
  10. Heh, thanks, it works perfectly. I knew it required a preg_ thingy but I haven't yet got my head around those - really should one of these days. Yup, we have excellent taste in avatars it seems. Thanks again!
  11. I'm trying to make a place where users can post news for all to read. What I want to do is to make it so they could write it like [quote][username1]My news here[/username1] [username2]My news is also here[/username2][/quote] When the script is to be executed onto a page I want it to look something like this. I'm guessing there'll have to be a 'while(' bit on it [code]<table width=100% cellpadding="3"><tr> <?$newsinfoque2=mysql_query("SELECT news FROM news WHERE id='$newsid'"); $newsnews2=mysql_result($newsinfoque2,0,"news"); // Working out here ?> <td width=18%><center><font class="largest"><b><? echo "$usernamehere";?> -</b></font></center></td> <td width=82%><center><font color="black"><b><? echo nl2br($theirnewshere);?></b></font></center></td> </tr> </table>[/code] What I want to know is how can I make the text between the ['s and ]'s into a variable as a username and then the text between the [username][/username] tags into another variable as news? I hope its not too difficult a question.
  12. What you're asking is for people to help you with something that is obviously out of your league for the moment, people are advising you to work with PHP/SQL a little more and familiarise yourself with it so you actually understand what you're doing.
  13. PHP does work in iframes. <iframe src="http://intranet/she/she.php" frameborder="0" marginheight="0" marginwidth="0"></iframe> Should work, though I suggest you add width and height values too.
  14. I've set up a very basic image upload page on my site but have read about the dangers of site security regarding allowing user-uploads. Here is my script. [code]<B>File upload</b><br><form enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="post"><input type="hidden" name="MAX_FILE_SIZE" value="1000000">Send this file: <input name="userfile" type="file"><input type="submit" name="submit" value="Send File"></form><?PHP // copy to this directory $dir="./images/temp/"; // copy the file to the server if (isset($submit)){ if (!is_uploaded_file ($userfile)){echo "<b>$userfile_name</b> couldn't be copied!!";} // check whether it has been uploaded if (is_uploaded_file ($userfile)){ move_uploaded_file($userfile,$dir.$userfile_name) ;} echo "<b>$userfile_name</b> copied succesfully !!"; } ?>[/code] The /images/temp/ folder is 757 CHMOD. I have no idea if thats the right or wrong one to use not being particularly familiar with CHMOD. Should I add anything to my script to make it more secure? I do intend to sort out the Max_file_size thing so its in PHP rather than HTML but is there anything else? How can people screw about with unsecured uploads or their folders or whatever it is they do? Hope you can help :)
  15. number_format(555555); Outputs: 555,555 You'd say something like [b]echo number_format(100000);[/b]
  16. [code] <? $box1=mysql_result($b,0,"box1"); $box2=mysql_result($b,0,"box2"); $os = compact('box1', 'box2')?> <table width=60%><tr><td bgcolor=#00FFFF><center><b><? if (in_array("0.01", $os)){echo "0.01 Galleons";}?></b></center></td><td><center><img src="images/dond/divide.gif"></center></td>[/code] This is a very simplified version of the code but basically it keeps showing me: [b]Warning: in_array(): Wrong datatype for second argument in /home/xxx/public_html/dond.php on line 21[/b] in the in_array() function. Can anybody help? And YES, the mysql_result IS picking up the database data correctly.
  17. Ignore - solved. Sorry for waste of space.
  18. This is the script I've kicked up for the moment: [code]<? $randomNumbers = array(); // storage array for ($i=0;$i<22;$i++) { $random = mt_rand(1,22); while(in_array($random,$randomNumbers)) { $random = mt_rand(1,22); } array_push($randomNumbers,$random); echo "$random"; echo "<br>"; } $randomNumbers2 = array(); // storage array for ($i2=0;$i2<22;$i2++) { $random2 = mt_rand(1,22); while(in_array($random2,$randomNumbers2)) { $random2 = mt_rand(1,22); } array_push($randomNumbers2,$random2); echo "<font color=\"red\">$random2</font>"; echo "<br>"; } if ($random == 1){$t=0.01;} if ($random == 2){$t=0.10;} if ($random == 3){$t=0.50;} if ($random == 4){$t=1;} if ($random == 5){$t=5;} if ($random == 6){$t=10;} if ($random == 7){$t=50;} if ($random == 8){$t=100;} if ($random == 9){$t=250;} if ($random == 10){$t=500;} if ($random == 11){$t=750;} if ($random == 12){$t=1000;} if ($random == 13){$t=3000;} if ($random == 14){$t=5000;} if ($random == 15){$t=10000;} if ($random == 16){$t=15000;} if ($random == 17){$t=20000;} if ($random == 18){$t=35000;} if ($random == 19){$t=50000;} if ($random == 20){$t=75000;} if ($random == 21){$t=100000;} if ($random == 22){$t=250000;} echo "SQL: UPDATE dond SET box$random2='$t' WHERE name='$realname'"; ?>[/code] But I can't get it to do what I want, can anyone help?
  19. Thankies, I've managed to get unique random numbers but don't know how to get the exact prize values into the database, as I want the actual values in the database.
  20. Ok, basically I'm making a mini-PHP-game for my website based on the show 'Deal or no Deal'. On the UK version the prizes are: 1p, 10p, 50p, £1, £5, £10, £50, £100, £250, £500, £750, £1000, £3000, £5000, £10,000, £15,000, £20,000, £35,000, £50,000, £75,000, 100,000, £250,000 That is 22 different prize values and lo and behold - I have 22 cells in my database for each game (box1, box2, box3...box22). What I want is that when a game is created the prize values go into the database however, none can be repeated, there can only be one each prize in each game, its important that the prizes go into random cells in the database so members can play again and again (there's a league table and whatnot). I hope somebody can help with this. If its handy, the name of my Deal or no Deal table is called '[b]dond[/b]'. 1p would need to be represented in the database as 0.01, 10p = 0.10p and 5000 as 5000. Easy. Thanks :)
×
×
  • 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.