Jump to content

Stop scripts from reading text.


crimsonmoon

Recommended Posts

I have a script that displays a rate on a page. This rate changes every minute and can be from 1 to 200. They get more benifits if they use the script when the rate is higer.

So the page displays what the rate is by pulling it from the MYSQL table.

I've got some who have a program that reads the text on the screen and if it's a high number then it uses the script.

How can I stop this.

I thought about a GD image for the rate but I've had issues with those not showing correctly almost like they are being cached.

Any other suggestions? They're obviously refreshing numerous times. I've thought about limited the amount of times you can visit the page per hour but that might ruin the fun.
Link to comment
https://forums.phpfreaks.com/topic/16494-stop-scripts-from-reading-text/
Share on other sites

Can you explain further what you mean by "I have a program that reads the text on the screen if the number is high enough?"  Because it sounds like if you don't want the program to run then why not encase the code that starts it in an if clause that evaluates to false when you don't want it to run (such as when the number is high).  It just isn't clear what you're trying to stop from happening.
Where would I put this? This is how I'm going it.

I have this page being called.

[code]
<?php
mysql_connect("localhost", "user", "pass");
mysql_select_db("db");

$click = mysql_fetch_array(mysql_query("select * from table"));
$image = imagecreate(140, 30);

$white = imagecolorallocate($image, 255, 255, 255);
$gray = imagecolorallocate($image, 210, 210, 210);
$black = imagecolorallocate($image, 0, 0, 0);

$string = "$click[variable]";


for ($i=0; $i<25; $i++) {
  $x1 = rand(0,140);
  $y1 = rand(0,30);
  $x2 = rand(0,140);
  $y2 = rand(0,30);
  imageline($image, $x1, $y1, $x2, $y2 , $gray); 
}


$size = rand(4, 5);
$x = rand(12 , 80);
$y = rand(7 , 12);
 


imagestring($image, $size, $x, $y, $string , $black);
header("content-type: image/png");
imagepng($image);
imagedestroy($image);
[/code]

Then I call the page above is the actual page showing it.

[code]
<img src=\"thepage.php\"/>
[/code]
the meta tags to stop caching goes in the HEAD of the script
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title>The Website Title</title>
</head>
<body>

Note that meta can go anywhere in the head, does not have to be above title
If the number of people trying these tricks is few, you can have IP address checks either in your scripts or at the webserver level. Apache mod_throttle is a module that checks the number of request per unit time from a particular IP and can stop serving those requests after a certain threshold level

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.