Dynamic Web Page (Problem with checker)

Back to General discussions forum

Marchel Sugi     2015-06-26 19:57:19
User avatar

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, .

Quandray     2015-06-29 17:22:37
User avatar

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.

TestUser     2015-06-30 13:21:23
User avatar

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.

Marchel Sugi     2015-07-01 10:01:00
User avatar

Hi, all..

Thanks for checking this problem out. :) Yes, you are correct, R.G, I place the answer on 000webhost. Thanks again for everything :)

Marchel Sugi     2015-07-01 10:19:09
User avatar

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!

Marchel Sugi     2015-07-01 10:45:56
User avatar

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. :)

irinazolotonos     2017-05-04 07:17:02

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.

Quandray     2017-05-04 08:57:17
User avatar

Hi, You need to remove the <html><head></head><body> & </body></html>

irinazolotonos     2017-05-04 10:03:59

Thank you very much, it worked.

plinovodja     2017-12-21 12:44:01

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!

Quandray     2017-12-21 20:11:09
User avatar

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".

plinovodja     2017-12-22 09:41:25

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.

Please login and solve 5 problems to be able to post at forum