some times my mysql is down because of for example the server load so i has been generated this code
Benefits
- it give you cool html/css page if the connection to mysql is lost becuase of for example the user or password is incorrect.
- It prevents search engines from archiving the current page and this is great becuase its an error page and this by this code:
<meta name="robots" content="noindex,nofollow">
demo
Cautions
Before making any changes to your config.php, save a copy of the original so you can revert to it if necessary.
useage
open your config file and try to modify it with this condition
if (!@mysql_select_db('name',@mysql_connect('host','dbuname','ppass'))) {
include ("noconnection.html");
exit;
}
- $connect is the mysql_select_db function for example read the config example:config.php [336 B].
- exit; is working on stop the page after include the html file
Html/Css
use quick view tool:noconnection.html [1.31 KB]
<?php header('Retry-After: 172800'); ?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="robots" content="noindex,nofollow">
<title>Temporarily Closed</title>
<style type="text/css">
<!--
body {
background: url(background.gif) repeat;
margin: 5px 5px;
text-align: center;
}
div.transbox
{
text-align: left;
margin: 20% auto 0px auto;
width: 420px;
height: 180px;
background-color: #ffffff;
border: 1px solid black;
filter:alpha(opacity=60);
opacity:0.6;
-moz-border-radius-bottomleft: 7px;
-moz-border-radius-bottomright: 7px;
}
div.transbox p
{
margin-left: 30px;
font-family: "Verdana", sans-serif;
font-weight: bold;
color: #000000;
}
div.transbox h1
{
margin-left: 30px;
}
-->
</style>
</head>
<body>
<div class="transbox">
<p><h1>Mysql Error</h1></p>
<p>I can't join to the Specific mysql database.</p>
<p>The mysql is down maybe by server load!</p>
</div>
</body>
</html>
download
download the config example with the background + noconnection.html example take a look to the files blew
