Jump to content

Andy-H

Members
  • Posts

    2,000
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Andy-H

  1. You could do it in a txt file make a file called count.txt with the value 0 written in it permissions 777 $img = array(); $img[] = '<img src="img1.jpg" />'; $img[] = '<img src="img2.jpg" />'; $img[] = '<img src="img3.jpg" />'; $img[] = '<img src="img4.jpg" />'; $img[] = '<img src="img5.jpg" />'; $count = (int)file_get_contents('count.txt'); echo $img[$count]; if ($count == count($img) - 1){ $count = 0; }else{ $count++; } $file = 'count.txt'; $f = fopen($file, 'w'); fwrite($f, $count); fclose($f); I think thats how to do it but I only just started playing with these functions.
  2. Make a table with 1field count(INT(1)) - default value 0 $query = "SELECT `count` FROM table LIMIT 1"; $result = @mysql_query($query); $row = mysql_fetch_row($result); $count = $row[0]; $img = array(); $img[] = '<img src="img1.jpg" />'; $img[] = '<img src="img2.jpg" />'; $img[] = '<img src="img3.jpg" />'; $img[] = '<img src="img4.jpg" />'; $img[] = '<img src="img5.jpg" />'; echo $img[$count]; if ($count != 4){ $count++; }else{ $count = 0; } mysql_query("UPDATE table SET `count` = '$count' LIMIT 1");
  3. <input type="text" name="username" value="<?php echo $_POST['username']; ?>" >
  4. I'm no good with regular expressions (at all), been meaning to read your tutorial. lol
  5. Basics Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' $1 = invalid variable..
  6. The way I usedto do it for a mafia game I coded was have a seperate table called staff, Staff ---- id INT username VARCHAR level INT(1) Staff_IP Last_IP VARCHAR pin INT Then I would check if their username session was stored in that table ie. $query = "SELECT pin, level FROM staff WHERE username = " . mysql_real_escape_string($username) . " LIMIT 1"; $result = @mysql_query($query); $n = mysql_num_rows($result); if ($n == 1){ $row = mysql_fetch_row($result); $pin = $row[0]; $level = $row[1]; $required_level = 1 // 1 for help desk // 2 for mod // 2 for admin if ($level < $required_level){ die("Access denied."); }else{ //code //check if they enter correct 4 digit staff pin... } }else{ die("Restricted access."); } I would also log the IP of the last person who made an action on that account and check it against the staff members IP
  7. Lol, thanks. I'll draw up a nice little diagram //Edit: Scrap that, I'll nick one and Harvard reference it =P
  8. Windows Firewall is a firewall utility that comes bundled with Microsoft’s Windows XP, Windows Server 2003 and Windows Vista operating systems. It is a personal firewall and as with most Microsoft software, it is not open source and can not be edited. Not only does it take care of filtering incoming data but it also takes care of outgoing data, it works with your router and probes every network data packet deciding weather or not to forward it to it’s destination. Windows firewall protects your computer in the following ways: • Denying Remote Login. • Preventing SMTP session hijacking. • Scanning E-mail bombs that carry viruses and other malware. • Not allowing suspicious Macros to run on PC. • Keeping track of Virus, Spam and Trojans. • Deleting / blocking risk ware. Everyone think that sound's OK?
  9. so it does lol
  10. implode is a function used on an array data-type. not a file... http://php.net/implode
  11. require "file.ext"; This will require the file and give an error killing the page like a die() command if it fails or the file has already been required require_once "file.ext"; Same as require but command is ignored if the file has already been required. include "file.ext"; This will give an error if it fails but continue running the script like the trigger_error() function include_once "file.ext"; will be ignored if the file has already been required, give an error if it fails and continue the rest of the script. I think thats how it goes anyway
  12. http://uk.youtube.com/watch?v=ZXaxE42OTA4 LMFAO!!!
  13. Found this pic and thaught I'd make a topic for people to add funny stuff they find scattered around the web. Yes, I am sad and EXTREMELY bored. lol
  14. If the code is re-directing you that means that $OnlinePayment must be set. The problem must be with the switch statement. Have you tried echoing $Class?
  15. Learn something new every day lol
  16. Never heard that one before, I'd just include the files...
  17. $q= "SELECT count(id) AS items_count FROM gallery>;<"; $r= mysql_query($q) or die (mysql_error()); $q= "SELECT * FROM gallery ORDER BY id DESC LIMIT ".$page*$page_size.",".$page_size.">;<"; $r= mysql_query($q) or die (mysql_error()); Why the semicolons inside the query string?
  18. if ($OnlinePayment) { switch ($Class) { case "Group": mail($To, $Subject, $Body, $Headers); print "<meta http-equiv=\"refresh\" content=\"0;URL=checkout-group.htm\">"; $redirect = TRUE; break; case "Lunch Time Quickie": mail($To, $Subject, $Body, $Headers); print "<meta http-equiv=\"refresh\" content=\"0;URL=checkout-quickie.htm\">"; $redirect = TRUE; break; case "Private": mail($To, $Subject, $Body, $Headers); print "<meta http-equiv=\"refresh\" content=\"0;URL=checkout-private.htm\">"; $redirect = TRUE; break; case "Workshop": mail($To, $Subject, $Body, $Headers); print "<meta http-equiv=\"refresh\" content=\"0;URL=checkout-workshop.htm\">"; $redirect = TRUE; break; } } if (isset($redirect)) { print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.htm\">"; } else { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; }
  19. $mike = "'1', '2', '3', '4', '5'"; $nike = " '1', '2', '3'"; If the data is stored that way you would need to explode all of the data in the string using $mike = explode("', '", $mike); /*Then remove the first char from the first value in the array, and the last char from the last array value. */ $i = count($mike) - 1; $mike[0] = substr($mike[0], 1); $mike[$i] = substr($mike[$i], 0, -1); /*Repeat this process with the $nike var.*/ $nike = explode("', '", $nike); $n = count($nike) - 1; $nike[0] = substr($nike[0], 1); $nike[$n] = substr($nike[$n], 0, -1); // Now merge the arrays. $combo = array_merge($mike, $nike); With any luck you should now have the array Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 1 [6] = 2 [7] = 3 ) *** Not tested... Missed an apostrophe from the first explode call.. Then the edit button disappeared ??? Just a thaught, $merged = array($mike . ',' . $nike); Maybe that would work too ??
  20. It is quite a simple function TBH. http://php.net/implode basically it takes two arguements, an array and a dilemiter, it then implodes the array into a string with each value seperated by the dilemiter. ie. $array = array("www", "google", "com"); $string = implode('.', $array); echo $string; /* output www.google.com */
  21. You can also use number_format($row->Earns, 2); Which will round it to 2 decimal places. Assuming your working with currency. Doesnt haveto be 2 tho, can be any number.
  22. Since the data is held in double quotes, wont the apostrophes be counted as part of the string?
  23. $mike = "'1', '2', '3', '4', '5'"; $nike = " '1', '2', '3'"; If the data is stored that way you would need to explode all of the data in the string using $mike = explode(", '", $mike); /*Then remove the first char from the first value in the array, and the last char from the last array value. */ $i = count($mike) - 1; $mike[0] = substr($mike[0], 1); $mike[$i] = substr($mike[$i], 0, -1); /*Repeat this process with the $nike var.*/ $nike = explode("', '", $nike); $n = count($nike) - 1; $nike[0] = substr($nike[0], 1); $nike[$n] = substr($nike[$n], 0, -1); // Now merge the arrays. $combo = array_merge($mike, $nike); With any luck you should now have the array Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 1 [6] = 2 [7] = 3 ) *** Not tested...
  24. $refer = mysql_query("SELECT SUM(uCash) as Earns FROM users WHERE uReferrer = 1") or die(mysql_error()); $row = mysql_fetch_object($refer); echo number_format($row->Earns);
  25. $query = "SELECT COUNT( * ) AS refs FROM Users WHERE uRefferer = '$refferingUsersID'"; $result = mysql_query($query)or trigger_error(mysql_error()); $row = mysql_fetch_object($result); echo 'Total users reffered: ' . number_format($row->refs);
×
×
  • 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.