<?php
/*
Name: install.php
Description: installer for pets ( php easy ticket system )
Purpose: to install the data base and inital settings
Maker: lee johnstone
Site: http://freakcms.com
Support: http://freakcms.com/contact.php
--------------------------------------------------------------------------------------------------------------------------
YOU MAY NOT
1. Use this for commercial usage
2. Claim the code as your own
3. Remove any copyrights from its original authors
YOU MAY
1. Upgrade, Update, Adjust, Modify this script, providing you keep all original comments.
2. Redistribute this code under the same license and none other.
3. Modify and use this script on your own site as you wish, providing you keep the copyright markings from original authors.
More information here.
http://freakcms.com
--------------------------------------------------------------------------------------------------------------------------
*/
if(isset($_GET[step]) && $_GET[step]=="1"){ $title = "Usage Agreement"; }
if(isset($_GET[agree]) && $_GET[step]=="1"){ $title = "Data base Details"; }
if(isset($_GET[agree]) && $_GET[step]=="2"){ $title = "Create Database Connection"; }
if(isset($_GET[agree]) && $_GET[step]=="3"){ $title = "Core Setup"; }
if(isset($_GET[agree]) && $_GET[step]=="4"){ $title = "Create DB And Finish"; }
if(!isset($_GET[step])){$title = "Information";}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-au">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style>
div.install_info{
width:50%;
margin:0 auto;
background-color:#000;
color:#FFF;
font-size:12px;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-weight:bold;
margin-top:20px;
padding: 20px 20px 20px 20px;
border-radius:45px;
}
h1{ font-size:xx-large;
color:#FF6464;
}
h4, h3{ font-size:large;
color:#FF6464;
}
td.set_name{
color:#FFF;
font-size:12px;
width:100px;
}
td.set_desc{
color: #F33;
font-size:12px;
width:250px;
}
input{
color: #F33;
font-size:12px;
background-color:#333;
padding:5px 5px 5px 5px;
border-radius:2px;
border:#F33 thin solid;
}
select{
color: #F33;
font-size:12px;
background-color:#333;
padding:5px 5px 5px 5px;
border-radius:2px;
}
div.cont{
float:right;
}
form.db{
width:400px;
margin:0 auto;
}
label{
padding-right:10px;
}
a.cont, button{
background-color:#090;
border:#000 thin solid;
border-radius:15px;
padding: 2px 2px 2px 2px;
font-size:xx-large;
text-decoration:none;
color:#FFF;
}
a.cont_no{
background-color: #F33;
border:#000 thin solid;
border-radius:15px;
padding: 2px 2px 2px 2px;
font-size:xx-large;
text-decoration:none;
color:#FFF;
}
</style>
<title>PETS by Freakcms.com | Installtion : <?php echo $title;?></title>
</head>
<body>
<?php
if(!$_GET['install']){
echo '
<div class="install_info">
<article>
<h1>PHP Easy Ticket System Installer (PETS-I)</h2>
<h4>Information</h4>
<p>(PETS) Is a easy way to keep track of feed back, error reports or just simple contact. Along with a full back end/administration login and control it sends emails to both user and administration to initiate the contact process.</p>
<h4>Features</h4>
<p>Css styled for easy theme tweaks or changes.<br>
Full php class system.<br>
Email and Information Templates for easy editing.</p>
<h4>Requirements</h4>
<p> Read Write permissions<br>
Email system<br>
PHP5+<br>
MySQL 5+</p>
<h4>Directory Permission Testing</h4>';
//check for directory permissions before we go ahead
$check1 = fopen("data/dbcon.php", "w+");
if($check1==false){
die("<p><font color=red>Please Make data/dbcon.php read/writeable</font></p>");
}else{
echo '<p><font color=green>data/dbcon.php is writeable<img src="data/tick.png"></font></p>';
}
if($check1){
echo '<p><div class="cont"><a class="cont" href="?install=true&step=1">Continue</a><div></p></article></div>';
}else{
echo '</p><font color=red>please fix the writeable problems before u procced</font></p></article></div>';
}
}
if($_GET['step']=="1"){
echo '<div class="install_info">
<article align="center">
<h1>Terms And Conditions</h1>
<textarea rows="20" cols="75" wrap="hard">
YOU MAY NOT
1. Use this for commercial usage
2. Claim the code as your own
3. Remove any copyrights from its original authors
YOU MAY
1. Upgrade, Update, Adjust, Modify this script, providing you keep all original comments.
2. Redistribute this code under the same license and none other.
3. Modify and use this script on your own site as you wish, providing you keep the copyright markings from original authors.
More information here.
http://freakcms.com
</textarea>
<p>By Clicking yes you agree to our terms and conditions</p>
<div class="cont"><a class="cont_no" href="install.php">No</a><a class="cont" href="?install=true&step=2&agree=true">Yes</a></div>
</div>
</article>';
}
if($_GET['step']=="2"){
if($_GET['agree']=="true"){
?>
<div class="install_info">
<article align="center">
<h1>Database Create and Connect</h1>
<form method="POST" action="?install=true&step=3&agree=true">
<table class="set">
<tr>
<td class="set_name"><h3>Core</h3></td>
<td class="set_input"></td>
<td class="set_desc"> </td>
</tr>
<tr class=set>
<td class="set_name">Site name</td>
<td class="set_input"><input class="set" type="text" name="site_name" size="30" ></td>
<td class="set_desc"><label>Your Web Site Name Example ( Example: Freakcms )</label></td>
</tr>
<tr class=set>
<td class="set_name" >Site title</td>
<td class="set_input"><input class="set" type="text" name="page_title" size="30" ></td>
<td class="set_desc"><label>Ticket System Page Title ( Example: Freakcms Ticket System )</label></td>
</tr>
<tr class=set>
<td class="set_name">Admin name</td>
<td class="set_input"><input class="set" type="text" name="adm" size="30"></td>
<td class="set_desc"><label>Your adminstration name</label></td>
</tr>
<tr class=set>
<td class="set_name" >Password</td>
<td class="set_input"><input class="set" type="text" name="pwd" size="30"></td>
<td class="set_desc"><label>Your adminstration password</label></td>
</tr>
<tr class=set>
<td class="set_name" >Password again</td>
<td class="set_input"><input class="set" type="text" name="pwd2" size="30"></td>
<td class="set_desc"><label>Your adminstration password again</label></td>
</tr>
<tr>
<td class="set_name"><h3>Security</h3></td>
<td class="set_desc"></td>
<td> </td>
</tr>
<tr class=set>
<td class="set_name">secret question</td>
<td class="set_input"><input class="set" type="text" name="secert_q" size="30" > </td>
<td class="set_desc"><label>Used for the submit and deletion forms</label></td>
</tr>
<tr class=set>
<td class="set_name">secret answer</td>
<td class="set_input"><input class="set" type="text" name="secert_a" size="30"></td>
<td class="set_desc"><label>Used for the submit and deletion forms</label></td>
</tr>
<tr class=set>
<td class="set_name">check ips</td>
<td class="set_input"><select class="set" size="1" name="check_ip">
<option value="1">true</option>
<option value="0">false</option>
</select> </td>
<td class="set_desc"><label>Checks tickets for duplicate ips entrys.</label></td>
</tr>
<tr class=set>
<td class="set_name">check emails</td>
<td class="set_input"><select class="set" size="1" name="check_em">
<option value="1">true</option>
<option value="0">false</option>
</select> </td>
<td class="set_desc"><label>Check tickets for duplicate email entrys and email validation</label></td>
</tr>
<tr>
<td class="set_name"><h3>Mail</h3></td>
<td class="set_input"></td>
<td class="set_desc"> </td>
</tr>
<tr class=set>
<td class="set_name">Admin email</td>
<td class="set_input"><input class="set" type="text" name="adm_mail" size="30"></td>
<td class="set_desc"><label>Ticket system administer email</label></td>
</tr>
<tr class=set>
<td class="set_name">Script Email</td>
<td class="set_input"><input class="set" type="text" name="script_mail" size="30"></td>
<td class="set_desc"> <label>Email used to send ticket information to users</label></td>
</tr>
<tr class=set>
<td class="set_name">Site mail</td>
<td class="set_input"><input class="set" type="text" name="site_mail" size="30"></td>
<td class="set_desc"><label>Main site email</label></td>
</tr>
<tr>
<td class="set_name"><h3>Links</h3></td>
<td class="set_input"></td>
<td class="set_desc"><label>Make sure to define either http:// or https://</label></td>
</tr>
<tr class=set>
<td class="set_name">site link</td>
<td class="set_input"><input class="set" type="text" name="site_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'];?>/index.php"></td>
<td class="set_desc"><label>direct link to the ticket page</label></td>
</tr>
<tr class=set>
<td class="set_name">Admin link</td>
<td class="set_input"><input class="set" type="text" name="adm_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'];?>/adm.php"></td>
<td class="set_desc"><label>direct link to the admin page</label></td>
</tr>
<tr class=set>
<td class="set_name">remove link</td>
<td class="set_input"><input class="set" type="text" name="rem_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'];?>/index.php?remove&ticket="></td>
<td class="set_desc"><label>direct link to the remove form</label></td>
</tr>
<tr class=set>
<td class="set_name">status link</td>
<td class="set_input"><input class="set" type="text" name="status_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'];?>/index.php?status&ticket="></td>
<td class="set_desc"><label>direct link to the status form</label></td>
</tr>
<tr class=set>
<td class="set_name">valid link</td>
<td class="set_input"><input class="set" type="text" name="valid_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'];?>/index.php?validate&ticket="></td>
<td class="set_desc"><label>direct link to the validation form</label></td>
</tr>
<tr class=set>
<td class="set_name">remove valid link</td>
<td class="set_input"><input class="set" type="text" name="remval_link" size="30" value="http://<?php echo $_SERVER['HTTP_HOST'].'/'.$_SERVER[PHP_SELF];?>/index.php?delete&ticket="></td>
<td class="set_desc"><label>direct link to the remove validation page</label></td>
</tr>
</table>
<button type="submit" value="Next" name="setupdb">Next</button>
</form>
</div>
</article>
<?php
}
}
if($_GET['step']=="3"){
if($_GET['agree']=="true"){
if($_POST['setupdb']){
if(!$_POST['pwd']==$_POST['pwd2']){
echo ' Your Passwords did not match ';
die();
}
echo '<div class="install_info">
<article align="center">
<h1>Populate the database</h1>';
include 'data/dbcon.php';
OpenDb();
//sort out some vars
$adm = $_POST['adm'];
$pwd = md5($_POST['pwd']);
$site_name = $_POST['site_name'];
$site_link = $_POST['site_link'];
$adm_link = $_POST['adm_link'];
$page_title = $_POST['page_title'];
$site_mail = $_POST['site_mail'];
$adm_mail = $_POST['adm_mail'];
$script_mail = $_POST['script_mail'];
$secert_q = $_POST['secert_q'];
$secert_a = $_POST['secert_a'];
$check_ip = $_POST['check_ip'];
$check_em = $_POST['check_em'];
$valid_link = $_POST['valid_link'];
$status_link = $_POST['status_link'];
$rem_link = $_POST['rem_link'];
$remval_link = $_POST['remval_link'];
$max_ticket = $_POST['max_ticket'];
//check and create config table if it doesnt exists
$sql = "
INSERT INTO core (`adm`, `pwd`, `site_name`, `site_link`, `adm_link`, `page_title`, `site_mail`, `adm_mail`, `script_mail`, `secert_q`, `secert_a`, `check_ip`, `check_em`, `valid_link`, `status_link`, `rem_link`, `remval_link`, `total`, `max_ticket`) VALUES
('$adm', '$pwd', '$site_name', '$site_link', '$adm_link', '$page_title', '$site_mail', '$adm_mail', '$script_mail', '$secert_q', '$secert_a', '$check_ip', '$check_em', '$valid_link', '$status_link', '$rem_link', '$remval_link', '0', '$max_ticket')";
echo '<p><font color=green>Adding core Settings....<img src="data/tick.png"></font></p>';
mysql_query($sql) or die(mysql_error());
echo '<p><font color=green>Data base installed and updated.<img src="data/tick.png"></font></p>
<p>Login to your admin account now</p>
<div class="cont"><a class="cont" href="adm.php">Login</a></div>
</article></div>';
}
}
}
echo '</body></html>';
?> |