Security Chcek
What is a security check?:
Many programmers will devise some sort of security number that
corresponds to a specific score. The security check allows the
programmer to compare the security code and the score and make
sure that they match.
How do I use the security check?:
Although this option is nice, it is not easy to use. You must
essentially write a PERL script. I know that this sounds tough,
but it isn't too bad. PERL does not distinguish between strings
and values, so I will just call them all strings. To designate a
string in PERL, you must put $ before the name. Mathematical
operations are the same in PERL as in MMF. Here are some examples:
$name = 2+2; #The string $name now contains "4"
$name = $name*3; #The string $name now contains "12"
$name = cos($name); #Trig functions work with radians, NOT
degrees.
I think that you get the idea behind that. You may have noticed
the use of semicolons after each command. These are needed. You
MUST PUT A SEMICOLON (;) AFTER EVERY LINE (this excludes
conditionals). If you fail to do so, you will get an internal
server error. Certain characters are not valid in strings (&,$,#,@,|,\,
and some more, but I don't know them all). In order to use them
in strings, you must put a \ before them. This line will store
"&$#@\":
$string = "\&\$\#\@\\"
Using \ followed by a character will never produce an error, so
feel free to use one before any character that you think might be
invalid. Using an invalid character will produce an internal
server error.
To combine strings, use a . opertor.
$string = "he"."llo"; #$string now contains
"Hello"
$string = $string.", Matt"; #$string now contains
"Hello, Matt"
Strings can be included in the middle of a quote. For example:
$string = "Hi";
$newstring = "I want to say $string to my friend."
#$newstring contains "I want to say Hi to my friend."
The next thing that you will likely need is an if statement. They
are formatted as follows:
if(string or expression <comparison> string or expression)
{
command on truth;
command on truth;
}
else
{
command on false;
command on false;
}
The comparisons are:
== equal to (only for numbers)
eq eqaul to (only for strings)
<> not equal to (only for numbers)
ne not equal to (only for strings)
>
<
>=
<=
Note that there is no semicolon after the conditional test if()
nor after else. Here are some other functions that may be of use:
sqrt(expression)->This takes the square root of expression. ex:
$name = sqrt(4); #$name now contains "2"
for( ; condition for loop to execute; )
{
command in loop;
command in loop;
}->This executes a loop while the condition is true. Ex:
$x = 0;
for( ; $x < 5; )
{
$x = $x + 1;
} #This loop will execute until $x is greater than 5.
For more information on PERL, go to http://www.perl.com/pub/v/documentation.
Now, ABOUT THE CHECK:
$scored = player's score
$secure = player's security code
After determining whether the score and security code match-up,
store either "T" or "F". For example:
$test= "F";
After you have done that, you must use a return statement. The
return statement automatically exits the security check and
informs the add.cgi script whether or not the security check
failed. A return statement is formatted as follows:
return $variable;
-OR-
return "<some string>";
So, return $test; and return "T"; are both valid.
Returning "F" is he only way to tell the add.cgi that
the check failed. All failures are stored in cheaters.dat file in
the directory. The only way to view this file as of yet is
through a text editor.
Damn, that's hard! Is there any way that
you could help me with this?:
Yes, I will be happy to help. Just contact me in any of the ways
listed at the end of this text file. Also, I check out example.txt.