Back to General discussions forum
Hi,
I have problems in Dynamic Web Page task,
as the checker always said that "value can't exceed 8 digits..",
while I'm pretty sure that my code result won't pass even 7 digits.
Site is running fine: Answer
<?php
$modders = 1305;
$result = 1;
do {
$rand_num = rand(10000, 1000000);
$result = $rand_num % $modders;
} while ($result > 0);
echo "Random value is " . $rand_num;
?>
Thank You, .
In Firefox, if I do a "View Page Source" on http://sugicode.net16.net/simple.php I see
Random value is 131805
<!-- Hosting24 Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
<!-- End Of Analytics Code -->
That checker probably isn't expecting anything after the first line.
Thank you Friends for pointing to this problem.
I think I even know what hosting it is - http://www.000webhost.com/ isn't it?
I'll try to improve the checker in a few days. Meanwhile you may try to change response type to plain text:
header('Content-Type: text/plain');
put this at the very top of the code and perhaps server will stop adding javascript stuff.
Hi, all..
Thanks for checking this problem out. :) Yes, you are correct, R.G, I place the answer on 000webhost. Thanks again for everything :)
Adding:
header('Content-Type: text/plain');
... doesn't help. :D
Instead, it came out with my answer,
plus what Quandray already have said without the needs to 'view page source'.
I'll leave it like that for now,
Thanks!
Well, I found the solution to stop the webserver for adding the script and PASS this test.
I just add:
exit();
.. in the bottom of my code.
Thank's all. :)
Hi! I have problem in Dynamic Web Page task. The checker said that "Your output does not start with "Random value is "...", but my page has this structure: <html><head></head><body>Random value is 19220</body></html> I decided this task on asp.net. Maybe because of this? Thank You.
Hi, You need to remove the <html><head></head><body> & </body></html>
Thank you very much, it worked.
Hey, a very good site! I tried first with Javascript:
Random value is <span id="demo"></span>
<script>
var x = Math.floor(Math.random() * 100) * 1859;
document.getElementById("demo").innerHTML = x;
</script>
Page generates numbers properly, but checker says all the time: "Your output does not start with "Random value is "...". I even removed <html> and <body> tags, still generates good numbers but checker refuses to accept. Thanks!
Rodion's sample page is http://rodiongork.atwebpages.com/simple.php.
If I "View Source" on that, I only see "Random Value is #####".
With your page at http://somepoints.net/iva/simple.html "View Source" shows it followed with "other stuff".
Ok, it seems that I misunderstood the task, I thought that the task was to generate web page that says “Random Value is #####”, not the the web page whose source code contains only “Random Value is #####”. Anyway, I did it in php. Thanks for the answer.