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

This commit is contained in:
lopar 2018-06-24 14:34:43 +03:00
parent ed7a6124bc
commit 081a98a2f6

View File

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