Хренение имени получателя в сессии, чтобы избежать разлогина.

This commit is contained in:
lopar 2018-06-24 14:34:43 +03:00
parent ed7a6124bc
commit 081a98a2f6
1 changed files with 4 additions and 4 deletions

View File

@ -30,9 +30,10 @@ if ($_SESSION['receiverName']) {
$allowOperations = true;
$receiverId = $receiver['id'];
$submit = filter_input(INPUT_POST, 'action');
$telegraphText = filter_input(INPUT_POST, 'message');
if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) {
if ($submit == 'sendMessage' && $user['money'] >= 1) {
$telegraphText = filter_input(INPUT_POST, 'message');
if ($telegraphText) {
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, $telegraphText);
@ -96,8 +97,7 @@ if ($_SESSION['receiverName']) {
<input type="text" name="message" id="message" size="52"
placeholder="Сообщение: (Максимум 100 символов)">
<input type="hidden" name="action" value="telegraph">
<input type="submit" value="Отправить"
onclick="if(!confirm('Послать сообщение?')) { return false; }">
<input type="submit" value="Отправить">
</fieldset>
</form>
</td>