Location: PHPKode > scripts > TrovaLavoro > trovalavoro/install.php
<?php
if(isset($_POST["in"]))
{
if(($_POST["host"] == "") || ($_POST["user"] == "") || ($_POST["data"] == "") || ($_POST["pas"] == "") || ($_POST["site"] == "") || ($_POST["email"] == ""))
{
$l = 1;
}
else
{
if(!preg_match("/@/i", $_POST["email"])) 
{
$r = 2;
}
else
{
$host = $_POST["host"];
$user = $_POST["user"];
$data = $_POST["data"];
$pas2 = $_POST["pas"];
$site = $_POST["site"];
$email = $_POST["email"];
$rd = mysql_connect($host,$user,$pas2);
mysql_select_db($data, $rd);
mysql_query("CREATE TABLE offerta(
id int(6) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 nome varchar(150),
 tel varchar(150),
 titolo varchar(150),
 regione varchar(150),
 text text,
 date varchar(12),
 ap bigint(1))")
 or die(mysql_error()); 
 mysql_query("CREATE TABLE richiesta(
id int(6) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 nome varchar(150),
 tel varchar(150),
 titolo varchar(150),
 regione varchar(150),
 text text,
 date varchar(12),
 ap bigint(1))")
 or die(mysql_error()); 
mysql_query("CREATE TABLE home(
id int(1) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 nome varchar(150),
 url varchar(150),
 a varchar(250),
 b text,
 c varchar(250),
 d text,
 contact text)")
 or die(mysql_error());
 mysql_query("CREATE TABLE res(
id int(7) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 nome varchar(150),
 tel varchar(150),
 text text,
 idi bigint(6))")
 or die(mysql_error());
 mysql_query("CREATE TABLE res2(
id int(7) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 nome varchar(150),
 tel varchar(150),
 text text,
 idi bigint(6))")
 or die(mysql_error());
  mysql_query("CREATE TABLE servizi(
id int(1) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 title varchar(250),
 text text)")
 or die(mysql_error());
   mysql_query("CREATE TABLE servizi2(
id int(1) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 title varchar(250),
 text text)")
 or die(mysql_error());
mysql_query("CREATE TABLE user(
id int(6) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 user varchar(30),
 pas varchar(200),
 mail varchar(100),
 reset varchar(100))")
 or die(mysql_error());
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$url = str_replace("install.php","",$url);
$pas = rand(1111111,9999999);
$te = "Username: admin \n Password: ".$pas."\n Go to: ".$url."admin/";
$pas = md5($pas);
mysql_query("INSERT INTO `user` (`user`,`pas`,`mail`) VALUES('admin','$pas','$email')");
mysql_query("INSERT INTO `home` (`nome`,`url`) VALUES('$site','$url')");
$mail = mail($email,"Data Account",$te,"From:hide@address.com");
$filename = '<?php
$host = "'.$_POST["host"].'";
$db = "'.$data.'";
$user = "'.$user.'";
$pass = "'.$pas2.'";
 ?>';
$fh = fopen('db/con.php', 'w+');
fwrite($fh, $filename);
unlink("install.php");
?>
<meta http-equiv="refresh" content="0; url=index.php" />
<?php
exit();
}
} 
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Install</title>
<style>
body{
clear:both;
}
#content{
width:300px;
height:480px;
margin:auto;
border-radius:10px;
background-color:EFFBF9;
border:1px solid #D3E1FA;
}
input{
width:240px;
height:30px;
margin-left:24px;
margin-top:24px;
padding:5px;
color:#666666;
background-color:#fff;
border:1px solid #ccc;
border-radius:5px;
}
#button{
width:250px;
height:40px;
margin-left:24px;
margin-top:24px;
color:#fff;
font-weight:bold;
background-color:#186257;
border-radius:5px;
background: -moz-linear-gradient(
		top,
		#218374 0%,
	    #186257);
background: -webkit-gradient(
		linear, left top, left bottom, 
		from(#218374),
		to(#186257));
}
</style>
</head>

<body>
<div id="content">
<form action="" method="post">
<input name="host" placeholder="Insert your host" type="text" />
<input name="data" placeholder="Insert your database name" type="text" />
<input name="user" placeholder="Insert your database username" type="text" />
<input name="pas" placeholder="Insert your database password" type="password" />
<input name="site" placeholder="Insert name for your website" type="text" />
<input name="email" placeholder="Insert your email address" type="text" />
<input name="in" id="button" value="Install" type="submit" />
</form>
<?php if(isset($l))
{ 
?>
<p align="center" style="margin-top:40px; color:#666666">Please fill in all required fields!</p>
<?php 
}
if(isset($r))
{
?>
<p align="center" style="margin-top:40px; color:#666666">Please insert a valid email address!</p>
<?php 
}
?>
</div>
</body>
</html>
Return current item: TrovaLavoro