Файл: Source/admin/add_prize.php
Строк: 72
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
include "common.php";
head();
?>
<script src="//cdn.ckeditor.com/4.4.7/basic/ckeditor.js"></script>
<div class="body content rows scroll-y">
<!-- Page header -->
<div class="page-heading">
<h1><b>Add prize</b> </h1>
</div>
<!-- End page header -->
<!-- Begin info box -->
<div class="row">
<div class="col-md-12">
<div class="box-info">
<h2>Add prize</h2>
<?php
if (isset($_POST['add'])) {
$ime = htmlspecialchars($_POST['ime']);
$opisanie = htmlspecialchars($_POST['opisanie']);
$snimka = htmlspecialchars($_POST['snimka']);
$snimka2 = htmlspecialchars($_POST['snimka2']);
$snimka3 = htmlspecialchars($_POST['snimka3']);
$tochki = (int) htmlspecialchars($_POST['tochki']);
$kolichestwo = (int) htmlspecialchars($_POST['kolichestwo']);
if ($ime == NULL) {
echo "<div class='alert alert-danger' role='alert'>Please add name.</div>";
} elseif ($opisanie == NULL) {
echo "<div class='alert alert-danger' role='alert'>Please add description.</div>";
} elseif ($snimka == NULL) {
echo "<div class='alert alert-danger' role='alert'>Please add images.</div>";
} else {
mysql_query("
INSERT INTO `vn_prizes` (
`title` ,
`description` ,
`image` ,
`image2` ,
`image3` ,
`points` ,
`quantity`
)
VALUES ( '{$ime}', '{$opisanie}', '{$snimka}', '{$snimka2}', '{$snimka3}', '{$tochki}', '{$kolichestwo}'
);");
echo '<div class="alert alert-success" role="alert">The prize was successfully added.</div>';
}
}
?>
<form action="" method="post">
<p>
<label>
Prize name
</label>
<input name="ime" class="form-control" type="text">
</p>
<p>
<label>
Description
</label>
<textarea name="opisanie" class="form-control" rows="3"></textarea>
<script>
CKEDITOR.replace('opisanie');
</script>
</p>
<p>
<label>
Image
</label>
<input name="snimka" class="form-control" type="text">
</p>
<p>
<label>
Image 2
</label>
<input name="snimka2" class="form-control" type="text">
</p>
<p>
<label>
Image 3
</label>
<input name="snimka3" class="form-control" type="text">
</p>
<p>
<label>
Points
</label>
<input name="tochki" class="form-control" type="text">
</p>
<p>
<label>
Quantity
</label>
<input name="kolichestwo" class="form-control" type="text">
</p>
<input type="submit" class="btn btn-success" name="add" value="Add Prize" />
</form>
</div>
<?php
footer();
?>
</div>
</div>