%PDF- %PDF-
Direktori : /home/nailstv/public_html/ |
Current File : /home/nailstv/public_html/_szavazat.php |
<?php if(empty($_POST)) die; require_once 'config/config.php'; Registry::set('debug', false); $db = Db::getInstance(); settype($_POST['video'], 'integer'); if($_POST['irany'] == 'p'){ $rec['ertek'] = 1; } else { $rec['ertek'] = -1; } if(isset($_SESSION[Registry::get('site')]['user_id'])){ $rec['felhasznalo_id'] = $_SESSION[Registry::get('site')]['user_id']; $rec['video_id'] = $_POST['video']; $rec['datum'] = date("Y-m-d H:i:s"); $bind = array($rec['video_id'], $rec['felhasznalo_id']); $sql = "SELECT video_id FROM video_szavazas WHERE video_id = ? AND felhasznalo_id = ?"; $row = $db->GetRow($sql, $bind); } if(empty($rec['felhasznalo_id'])) { echo '<div class="white-popup review-callback login"><p>You have to login to use this function.<br/><br/><a href="login" class="btn btn-site-color">Login</a> <a href="registration" class="btn btn-default">Registration</a></p></div>'; } elseif(!empty($row)) { echo '<div class="white-popup review-callback re"><p>You have already voted to this video</p></div>'; } else { $db->insert($rec, 'video_szavazas'); echo '<div class="white-popup review-callback ok"><p>Thanks for voting.</p></div>'; } ?>