update send pretend

This commit is contained in:
themohooks 2025-02-17 22:19:26 +03:00
parent b41ec07317
commit 0275ff30c6
3 changed files with 15 additions and 11 deletions

View file

@ -12,12 +12,14 @@ class SendPretend
{ {
public function __construct() public function __construct()
{ {
DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id'=>$_POST['cid'], ':idd'=>$_POST['photo_id'])); if (DB::query('SELECT contest_id FROM photos WHERE user_id=:uid', array(':uid' => Auth::userid()))[0]['contest_id'] != $_POST['cid']) {
echo json_encode( DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id' => $_POST['cid'], ':idd' => $_POST['photo_id']));
array( echo json_encode(
'errorcode' => 0, array(
'error' => 0 'errorcode' => 0,
) 'error' => 0
); )
);
}
} }
} }

View file

@ -151,7 +151,9 @@ function convertUnixToRussianDateTime($unixTime)
data: $(this).serialize(), data: $(this).serialize(),
success: function(response) { success: function(response) {
var jsonData = JSON.parse(response); var jsonData = JSON.parse(response);
if (jsonData.errorcode === 0) {
alert('Фотография успешно отправлена на претенденты на Фотоконкурс');
}
} }
}); });

View file

@ -425,10 +425,10 @@ $(document).ready(function()
</div> </div>
</td> </td>
</tr> </tr>
<tr> <!--tr>
<td class="lcol">Модель камеры:</td> <td class="lcol">Модель камеры:</td>
<td style="padding-bottom:17px"><input type="text" name="cammod" style="width:300px" value=""></td> <td style="padding-bottom:17px"><input type="text" name="cammod" style="width:300px" value=""></td>
</tr> </!--tr>
<tr> <tr>
<td class="lcol">Пользователь:</td> <td class="lcol">Пользователь:</td>
<td> <td>
@ -501,7 +501,7 @@ $(document).ready(function()
<tr> <tr>
<td></td> <td></td>
<td><br><input type="submit" value="&nbsp; &nbsp; &nbsp; Искать &nbsp; &nbsp; &nbsp;"></td> <td><br><input type="submit" value="&nbsp; &nbsp; &nbsp; Искать &nbsp; &nbsp; &nbsp;"></td>
</tr> </tr-->
</tbody></table> </tbody></table>
</form> </form>
</tbody> </tbody>