public function add() { if (isset($_POST['vid_url']) && isset($_POST['jeu_id'])) { if (empty($_POST['jeu_id'])) { echo "3"; } if (empty($_POST['vid_url'])) { echo "2"; } else { if (!filter_var($_POST['vid_url'], FILTER_VALIDATE_URL)) { echo "5"; } else { $verif = 0; foreach (T_e_video_vid::findAll() as $t_e_video_vid) { if ($t_e_video_vid->vid_url == $_POST['vid_url'] && $t_e_video_vid->jeu_id == $_POST['jeu_id']) { echo "4"; $verif = 1; } } if ($verif == 0) { $newvideo = new T_e_video_vid(); $newvideo->jeu_id = parameters()["jeu_id"]; $newvideo->vid_url = parameters()["vid_url"]; echo "1"; } } } } else { echo "3"; } }
<hr> <?php $id = 1; foreach (T_e_photo_pho::FindAll() as $photo) { if ($photo->jeu_id == $data->jeu_id) { echo "<div id=\"divmin" . $id . "\" class=\"div_Photo_Jv_View\"><img id=\"" . $id . "\" class=\"photo_Jv_View\" src=\"" . $photo->pho_url . "\"/></div>"; echo "<div id=\"divlbx" . $id . "\" class=\"lightbox\"><img id=\"lbx" . $id . "\" class=\"photo_Jv_lb\" src=\"" . $photo->pho_url . "\"/></div>"; $id++; } } ?> <hr> <h2>Vidéos</h2> <hr> <?php foreach (T_e_video_vid::FindAll() as $video) { if ($video->jeu_id == $data->jeu_id) { echo "<div>"; $recupPozPoint = strripos($video->vid_url, '.'); $recupextension = substr($video->vid_url, $recupPozPoint + 1); if ($recupextension == "ogg" || $recupextension == "mp4") { echo "<video width=\"720\" height=\"405\" controls> "; /*foreach(T_e_photo_pho::FindAll() as $photo){ if($photo->jeu_id == $data->jeu_id ){ echo "poster=\"".$photo->pho_url."\">"; break; } }*/ echo "<source src=\"" . $video->vid_url . "\" type=\"video/mp4\">"; echo "</video>"; } else {