0% found this document useful (0 votes)
41 views7 pages

04212

The document contains PHP code for a video gallery website. It defines functions for displaying a single video, the video gallery, and recent videos. It queries the database to get video data and generates HTML to display the videos, gallery pagination, and related/recent videos.

Uploaded by

Brilian Cast
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views7 pages

04212

The document contains PHP code for a video gallery website. It defines functions for displaying a single video, the video gallery, and recent videos. It queries the database to get video data and generates HTML to display the videos, gallery pagination, and related/recent videos.

Uploaded by

Brilian Cast
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

<?

php

if(!defined("CMSBalitbang")) {

die("<h1>Permission Denied</h1>You don't have permission to access the this page.");

function tampil() {

include "koneksi.php";

$kd=$_GET['kd'];

$kode=$_GET['kode'];

$video .="<table width='100%' bgcolor='#0D030F' background='../images/gris_user.gif'><tr><td><a


href='index.php?id=video' title='Galeri Video'>Galeri Video</a></td></tr></table>";

$video .='<table width="100%" cellspacing="0" cellpadding="0" >';

$result = mysql_query("SELECT * FROM t_video where idkategori='".


mysql_escape_string($kode)."' and id='".mysql_real_escape_string($kd)."'");

$row = mysql_fetch_array($result);

$video .="<tr><td width='70%' valign='top'


><h3>$row[judul]</h3><br>$row[kode]<br><br><hr>$row[tanggal]</hr><br>$row[ket]<br><br>";

$video .="<HR><H3>KOMENTAR</H3></HR>";

$video .="<div id='fb-root'></div><script


src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script><fb:comments
href='http://sman3kotasukabumi.sch.id/html/index.php?
id=tampil&kode=$row[idkategori]&kd=$row[id]' num_posts='2' width='500'
colorscheme='dark'></fb:comments>";

$video .="</td>";

$video .="<td width='30%' valign='top'>";

$kol=1;

$aris=mysql_query("SELECT * FROM t_video where idkategori='".


mysql_escape_string($kode)."' and id<>'".mysql_real_escape_string($kd)."'");

$video .="<center>";

$video .='<table width="100%" cellspacing="2" cellpadding="2"


bgcolor="#0D030F"><tr bgcolor="#420C4F">';

$video .="<td><font size=4><b><center>Video Terkait</center></b></td></tr><tr>";


$hit = 0;

while ($ar=mysql_fetch_array($aris)){

if ($hit >= $kol) {

$video .= "</tr><tr>";

$hit = 0;

$hit++;

$video .="<td align=center valign=top><br />

<a href='index.php?id=tampil&kode=$ar[idkategori]&kd=$ar[id]' title='$ar[ket]'>

<img alt='video' src='../images/video/gb$ar[id].jpg' width=175


height=125></a>&nbsp;&nbsp;<br />$ar[judul]<br /></td>";

$video .="</tr></table><br >";

$video .="</center>";

$video .="</td></tr></table><br >";

return $video;

function video() {

include "koneksi.php";

$hal=$_GET['hal'];$kode=$_GET['kode'];

$brs=4;

$kol=10;

$byk_result=mysql_query("select * from t_video where idkategori='". mysql_escape_string($kode)."'");

$byk=mysql_num_rows($byk_result);
if ($byk<=$brs)

$jml=0;

else

$jml=floor($byk / $brs);

$sisa= $byk % $brs;

if ($sisa!=0)

$jml++;

if ($hal=="")

$awal=0;

else

$awal=$brs*($hal-1);

if ($hal=="") $hal=1;

$back=$hal-1;

$next=$hal+1;

if ($hal==1) $back=1;

if ($hal==$jml) $next=$jml;

$mulai=1;

$batas=$jml;

if ($jml>$kol)

$batas=$kol;

if ($hal>$kol) {

$mulai=1+$hal-$kol;

$batas=$hal;

}
$query = "SELECT * FROM t_video where idkategori='". mysql_escape_string($kode)."' order by id DESC
LIMIT ".$awal.",".$brs."";

$query_result_handle = mysql_query ($query)

or die (mysql_error());

// check that there is news

$num_of_rows = mysql_num_rows ($query_result_handle) ;

// tambah alan untuk delete multiple

$video .= '<table cellspacing=2 cellpadding=5 width=100% > <form action="index.php" method="get"


name="video">

<tr><td width="200" >Pilih Kategori : <select name=kode


onchange="document.location.href=\'index.php?id=video&kode=\'+document.video.kode.value" >';

$sql2="select * from t_videokategori order by idkategori";

if(!$query2=mysql_query($sql2)) die ("Pengambilan gagal1 gambar atas");

while($r=mysql_fetch_array($query2)) {

if ($kode==$r[idkategori]) $video .="<option value='$r[idkategori]'


selected>$r[kategori]</option>";

else $video .="<option value='$r[idkategori]'>$r[kategori]</option>";

$video .='</select></td><td><input type=submit value="Pilih" class="art-button"


onclick="document.location.href=\'index.php?id=video&kode=\'+document.video.kode.value"
></td></tr></form></table>';

$video .= "<table width='100%' cellspacing='0' cellpadding='0' border='0' bgcolor='#0D030F'>";

if ($jml!=0) {

$g .= "<tr bgcolor='#420C4F'><td colspan=3 ><center><font class='ver10'><a href='index.php?


id=video&kode=$kode&hal=1' style='color:000000;text-decoration:none' title='Hal 1'>Awal </a>

<a href='index.php?id=video&kode=$kode&hal=$back' style='color:000000;text-decoration:none'


title='$back'>Sebelum </a> |";

for($i=$mulai;$i<=$batas;$i++)

{
if ($i==$hal)

$g .= "<b><a href='index.php?id=video&kode=$kode&hal=$i' style='color:000000;text-


decoration:none' title='Hal $i dari $byk Data'> $i </a></b> |";

else

$g .= "<a href='index.php?id=video&kode=$kode&hal=$i' style='color:000000;text-


decoration:none' title='Hal $i dari $byk Data'> $i </a> |";

$g .= "<a href='index.php?id=video&kode=$kode&hal=$next' style='color:000000;text-


decoration:none' title='$next'> Lanjut</a>

<a href='index.php?id=video&kode=$kode&hal=$jml' style='color:000000;text-decoration:none'


title='Page $jml'> Akhir</a></font></center></td></tr>";

$i=0;

$video .= $g;

while ($row = mysql_fetch_array($query_result_handle))

$a="";$b="";

if ($i==0) {$i=1;$a="<tr>"; }

else {$i=0;$b="</tr>";}

$gbr="<img src='../images/video/gb$row[id].jpg' width=280 height=200 class='art-article' >";

$video .="$a<td width=50%><center>";

if ($i==1) {

$video .=" <a href='index.php?id=tampil&kode=$row[idkategori]&kd=$row[id]'


title='$row[ket]'>

$gbr</a>";

else {

$video .="<a href='index.php?id=tampil&kode=$row[idkategori]&kd=$row[id]'


title='$row[ket]'>

$gbr</a>";
}

$video .="<br>$row[tanggal]";

$video .="<br>$row[judul]<br>&nbsp;</td>$b";

$video .= "</table><br>";

if ($kode==''){

$col = 3;

$g = mysql_query("SELECT * FROM t_video ORDER BY id DESC LIMIT 0,9");

$video .="<table width='100%' cellspacing='0' cellpadding='0' border='0' ><tr


bgcolor='#420C4F'><td><h3>&nbsp;Video Terbaru</h3></td></tr></table>";

$video .="<center>";

$video .="<table bgcolor='#0D030F'><tr>";

$cnt = 0;

while ($w = mysql_fetch_array($g)) {

if ($cnt >= $col) {

$video .= "</tr><tr>";

$cnt = 0;

$cnt++;

$video .="<td align=center valign=top><br />

<a href='index.php?id=tampil&kode=$w[idkategori]&kd=$w[id]' title='$w[ket]'>

<img alt='video' src='../images/video/gb$w[id].jpg' width=210


height=160></a>&nbsp;&nbsp;&nbsp;&nbsp;<br />$w[tanggal]<br />$w[judul]<br /><br /></td>";

$video .="</tr></table>";

$video .="</center>";

}
return $video;

?>

You might also like