Files
test-php-2015/src/inmon.php
2020-12-30 10:43:12 +07:00

28 lines
913 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
if (isset($_POST['sum'])){
$sum = $_POST['sum'];
if (is_numeric($sum)==false){
exit ("Нужно ввести число <a href='lk.php'>Вернуться назад</a>.");
}
}
if (empty($sum)){
exit ("Нужно ввести число <a href='lk.php'>Вернуться назад</a>.");
}
if ($sum<0) { $sum=-$sum; }
$uid = $_SESSION['id'];
include("bdcon.php");
mysqli_autocommit($db, false);
$dt = date("d-m-Y H:i");
$comm = "Приход. Пополнение на сайте.";
$qe3 = mysqli_query($db, "Insert into history (uid,tdate,`inout`,`comm`) values($uid,STR_TO_DATE('$dt','%d-%m-%Y %H:%i'),$sum,'$comm')");
if ($qe3) {
mysqli_commit($db);
echo "Все прошло успешно. Вернуться в <a href='lk.php'>Личный кабинет</a>.";
}
else {
mysqli_rollback($db);
echo "Произошла ошибка.";
}
?>