<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Гитарные войны</title>
</head>
<body>
<header>Гитарные войны.<br>Добавь свой рейтинг.
<?php
define('GW_UPLOADPATH', 'images/');
require_once ("connect.php");
if(isset($_POST['submit'])) {
$name = $_POST['name'];
$score = $_POST['score'];
$screenshot = $_FILES['screenshot']['name'];
if(!empty($name) && !empty($score)) {
$dir = $_SERVER["DOCUMENT_ROOT"] .GW_UPLOADPATH;
if(move_uploaded_file($_FILES['screenshot']['tmp_name'],"$target")){
$zero = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$query = "INSERT INTO guitarwars VALUES (0, NOW(),'$name','$score','$screenshot')";
$result = mysqli_query($zero,$query);
echo '<p>Спасибо за то, что добавили свой рейтинг!</p>';
echo '<p><strong>Имя:</strong> ' . $name. '<br>';
echo '<strong>Рейтинг:</strong> ' . $score . '<p>';
echo '<img src="'.GW_UPLOADPATH.$screenshot.'"
alt="Изображение, подтверждающее подлинность изображения"><br />';
echo '<p><a href="index.php"> << Назад к списку рейтингов</a></p>';
$name = "";
$csore = "";
$screenshot = "";
mysqli_close($zero);
}
}
}
?>
<hr />
<form enctype="multipart/form-data" method="POST" active="<?php echo $_SERVER['PHP_SELF'];?>" >
<input type="hidden" name="MAX_FILE_SIZE" value="32786" />
<label for="name">Имя: </label>
<input type="text" id="name" name="name"
value="<?php if(!empty($name)) echo $name; ?>" /><br/>
<label for="score">Рейтинг: </label>
<input type="text" id="score" name="score"
value="<?php if(!empty($score)) echo $score ?>" />
<label for="screenshot">Имя файла: </label>
<input type="file" id="screenshot" name="screenshot"
value="<?php if(!empty($screenshot)) echo $screenshot ?>" />
<hr />
<input type="submit" name="submit" value="Включение в партию" />
</form>
</body>
</html>