Return to Snippet

Revision: 67342
at September 12, 2014 13:22 by bcherdak


Initial Code
<?php
    //the file and directory you will be writing your database information to
    $file = 'libs/db_connect.php';
    //start checking                            
    if(!function_exists('mail')) { $mail_msg="No"; } else { $mail_msg="Yes"; }
    if (!is_writable($file)) { $file_msg="No"; } else { $file_msg="Yes"; }
    if (!function_exists('mysql_connect')) { $mysql_msg="No"; } else { $mysql_msg="Yes"; }
    if (ini_get('file_uploads') == 0) { $file_msg="No"; } else { $file_msg="Yes"; }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Pre-Installation checklist</title
</head>
<style type="text/css">
/*TABLE CSS*/
#wrap {
    margin: 10px auto 0;
    text-align: center;
    width: 500px;
}

.btn {
  font-family: Courier New;
  color: #ffffff;
  font-size: 16px;
  background: #3498db;
  padding: 10px 20px 10px 20px;
  text-decoration: none;
}

.btn:hover {
  background: #3cb0fd;
  text-decoration: none;
}

table a:link {
	color: #666;
	font-weight: bold;
	text-decoration:none;
}
table {
	font-family:Arial, Helvetica, sans-serif;
	color:#666;
	font-size:12px;
	background:#eaebec;
	border:#ccc 1px solid;
margin-bottom: 20px;
width: 100%;
}
table th {
	padding:21px 25px 22px 25px;
	border-top:1px solid #fafafa;
	border-bottom:1px solid #e0e0e0;
        background: #ededed;
}
table th:first-child {
	text-align: left;
	padding-left:20px;
}
table tr {
	text-align: center;
	padding-left:20px;
}
table td:first-child {
	text-align: left;
	padding-left:20px;
	border-left: 0;
}
table td {
	padding:18px;
	border-top: 1px solid #ffffff;
	border-bottom:1px solid #e0e0e0;
	border-left: 1px solid #e0e0e0;
	background: #fafafa;
}
table tr.even td {
	background: #f6f6f6;
}
table tr:last-child td {
	border-bottom:0;
}
</style>
<body>
<div id="wrap">

		<!-- WEBSITE GOES HERE -->

<table cellspacing='0'> <!-- cellspacing='0' is important, must stay -->

	<!-- Table Header -->
	<thead>
		<tr>
			<th>Required Fuctions</th>
			<th>Current</th>
			<th>Recommended</th>
		</tr>
	</thead>
	<!-- Table Header -->

	<!-- Table Body -->
	<tbody>
	
		<tr>
			<td>Is the <b><?php echo $file; ?></b> file writable?</td>
			<td><?php echo $file_msg; ?></td>
			<td>Yes</td>
		</tr>
		
		<tr>
			<td>Is the mail() function enabled?</td>
			<td><?php echo $mail_msg; ?></td>
			<td>Yes</td>
		</tr>



		<tr>
			<td>PHP Version</td>
			<td><?php echo function_exists('phpversion') ? phpversion() : ''; ?></td>
			<td><?php echo function_exists('phpversion') ? phpversion() : ''; ?></td>
		</tr>

		<tr>
			<td>Is MySQL enabled?</td>
			<td><?php echo $mysql_msg; ?></td>
			<td>Yes</td>
		</tr>

		<tr>
			<td>Is file uploading enabled?</td>
			<td><?php echo $file_msg; ?></td>
			<td>Yes</td>
		</tr>


	</tbody>
	<!-- Table Body -->

</table>


<?php
if (function_exists('mail') && is_writable($file) && function_exists('mysql_connect') && ini_get('file_uploads') == 1)
{
echo '<a href="" class="btn">Continue Installation</a>';
}
  else
{
echo 'Please enable/install extensions before continuing, otherwise, the script will not work as designed.';
}

?>



</div>
</body>
</html>

Initial URL

                                

Initial Description
Hey guys how is everything going I am currently working on my own content management system and decided I would release a little pre-installation checklist script that makes sure you have all the required functions enabled on your hosting environment and shows you what you currently have and what is required in the end. If you have all the requirements that the script requires, it shows a little button at the bottom to continue the installation, if not, an error.

 You can easily change the file you want to check writing to by editing $file

It comes with some styling already and in a nice table. Enjoy and let me know how it is.

Initial Title
Simple PHP pre-installation checklist script

Initial Tags
php

Initial Language
PHP