Pardon for a weird title, didn't know how to put it. Essentially, I can't write anything after my existing PHP code (it contains a class, a couple of functions and an echo of a function). I tried basic HTML, and more PHP, none of it works.
Remembering back to when I did Python, it seems that it's a loop that's still running, thus preventing anything else from working.
My code:
<?php
//We're using a newer and older generation algorithms in order to create different results
//The time and date is used as a basic "salting" mechanism, which will make the number hard to determine without knowing the generation time
//I should consider using more secure generation, such as "random_int"
//EXTREMELY WIP!!!
class authGeneration
{
private function gen($maxOne) {
$begin_value_one = date("sih") * rand(1,100);
$auth_value_one = mt_rand($begin_value_one, $maxOne);
echo $auth_value_one;
}
private function genAdd($maxTwo) {
$begin_value_two = date("his") + mt_rand(1000,1000000);
$auth_value_two = rand($begin_value_two, $maxTwo);
echo $auth_value_two;
}
public function finalGen() {
$begin_value_three = date("dmY");
$auth = $this->gen(999999999) + $this->genAdd(999999999); //No more than 999999999, no less than 100000000 (for both)
$add = $auth + $begin_value_three;
echo parseFloat ($add);
}
}
function authCode() {
$obj = new authGeneration();
echo $obj->finalGen();
}
echo "Authentication code: "; authCode();
echo "MD5 Checksum: "; md5(authCode); //Doesn't work :(
The first echo of authCode();
works, however, the line below it doesn't, regardless of what I write there. Any idea as to what the issue is? Or if it's the aforementioned "loop", how do I escape it? Feel free to outline my stupidity.
Note, PHP isn't my specialty, I primarily use Java and/or C# (because they're more fun than PHP), and just decided to do something fun in PHP, therefore my knowledge of the language is relatively limited.