[For 1.8] Custom 404 Page Creation
#1
Example:https://anonshare.eu/exampleerrorpage.php
reload the page and you will notice that the image change

Add this code to the last line on your .htaccess
ErrorDocument 404 /404.php
Create a file called 404.php, and add this to it:
<?php
   define('IN_MYBB', 1);
   require_once("global.php");

   add_breadcrumb("404 Error", $_SERVER['PHP_SELF']);

   eval("\$page = \"".$templates->get("404")."\";");

   output_page($page);
?>
Upload the 404.php file to your main website's directory.
Create a new template on your main theme with the name 404 and add this to it:
<html>
<head>
<h1><center><a href="https://anonshare.eu/">Back Home</a></center></h1>
<h1><center>We couldn't find it.</center></h1>
<center>We couldn't find what you were looking for, double check your search.</center>
<center>
<script type="text/javascript">
  var imageURLs = [
       "https://anonshare.eu/images/404images/1.png"
     , "https://anonshare.eu/images/404images/hiclipart.com%20(1).png"
     , "https://anonshare.eu/images/404images/3.png"
     , "https://anonshare.eu/images/404images/4.png"
     , "https://anonshare.eu/images/404images/5.png"
     , "https://anonshare.eu/images/404images/6.png"
  ];
  function getImageTag() {
    var img = '<img src=\"';
    var randomIndex = Math.floor(Math.random() * imageURLs.length);
    img += imageURLs[randomIndex];
    img += '\" alt=\"Some alt text\"/>';
    return img;
  }
</script>
</head>
<body>
<script type="text/javascript">
  document.write(getImageTag());
</script><center>

</body>
</html>

change the link to "Back Home"

Hope it was helpful
[Image: banner.gif]
Reply
#2
Tank you for you contribution.

One suggestion would be to cache the error template to save 1 query Toungue , like so:
$templatelist = "404";
require_once("global.php");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)