Jump to content

slyte33

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by slyte33

  1. Ok here is my code, this will simply show the number of players in the center of a 280 by 50px box, with a transparent background. My goal is to show these players in the banner listed above: <?php include("lib.php"); $player = check_user($secret_key, $db); $totplayers = $db->execute("select * from players"); $players = $totplayers->recordcount(); $image = imagecreatetruecolor(280, 50); $red = imagecolorallocate($image, 255, 0, 0); $black = imagecolorallocate($image, 0, 0, 0); // Make the background transparent imagecolortransparent($image, $black); $text_color = imagecolorallocate($image, 0, 0, 0); $white = ImageColorAllocate($image,255,255,255); $blue = imagecolorallocate($image, 0, 0, 255); $red = imagecolorallocate($image, 0 , 200, 0); $bg = imagecolorallocate($image, 255, 255, 255); $textcolor = imagecolorallocate($image, 1, 1, 1); imagestring($image, 3, 115, 15, "$players", $textcolor); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>
  2. $message = strip_tags($_POST['message']); $message is the same thing as echoing out the actual post, except this will strip all html tags from it.
  3. Ok so a much quicker and easier way to do this would be: $message = strip_tags($_POST['message']); then replace: echo $_POST['message']; with echo "$message";
  4. Sorry, i feel very dumb.. replace all you have with this: remove any characters contained in the slashes you dont want out: so you can remove any of this: ^[-_a-zA-Z0-9]+$ if (preg_match("/^[-_a-zA-Z0-9]+$/", $_POST['message'])) { echo "<div class='box'>Contains illegal characters!</div>"; exit; }
  5. Let's test something.. replace <textarea name="message" rows="10"></textarea> with <input type=text name=message> see if that helps, it will be a smaller box, but this is for tests
  6. replace if (!preg_match("/^[-_a-zA-Z0-9]+$/", $_POST['message'])) { echo "<div class='box'>Contains illegal characters!</div>"; } exit with if (!preg_match("/^[-_a-zA-Z0-9]+$/", $_POST['message'])) { echo "<div class='box'>Contains illegal characters!</div>"; exit; }
  7. Are you replacing $_POST['test'] with $_POST['message'] , as the i gave above says that. Also add an "exit;" at the end, before the "}"
  8. if (!preg_match("/^[-_a-zA-Z0-9]+$/", $_POST['test'])) { //If what your wanting contains those illegal characters... echo "Contains illegal characters"; }
  9. Your missing a ";" at line 5, add it to the end.
  10. How would I make the banner the main background image, as if it was a normal .gif image and not a .php file? Thanks for feedback
  11. I've just copied your index.php to my site, and i did not get 1 error about a t_string
  12. Hello, i've just signed up and will probably start coming here a lot. I've read a bit on the forums and like what I see I am curious is to how I could implant the number of players on my game, with an image. I DO have the script to make an image but what I want is actually more complex than what you are thinking. First examine this image: Where it says Players, i'd like it to display the amount of players, but with with a font that looks the same way as the players. I can easily create 0, 1, 2, 3... etc up to 9 to have this. I use ADODB which makes coding much easier, so if I were to make this image, i would go along with: $query = $db->execute("select * from players"); $count = $query->recordcount(); Then in the file that I already have the script made on, i would probably add something like this: imagestring($image, 3, 115, 15, "$count", white); If it is simply not possbile to add the numbers with the same font as the word "PLAYERS" then that is fine, but the next question would be.. How do I make the image I made in php be the background of the banner above? I've tried a lot and cannot seem to change anything except the background image of the picture. I hope I can be a good part of this community one day, and will start visiting here often. All help on this is MUCH appreciated! 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.