$do = $_POST['do'];
echo $do."<br />";
switch ($do) {
case "update":
if(isSet($_POST['content']))
{
$content=$_POST['content'];
$vid = getYTid($content);
mysql_query("insert into propunere(id, uid, vid, data, stare) values ('', '$uid', '$vid', '$data', '0')");
$sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
$r=mysql_fetch_array($sql_in);
$jsonurl = "https://graph.facebook.com/". $r['uid'];
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
?>
<table cellpadding="0" cellspacing="2" width="500px">
<tr class="comment">
<td width="50" align="top" valign="left"><a href="<?php echo $json_output->link; ?>" title="<?php echo $json_output->name; ?>" target="_blank"><img src="https://graph.facebook.com/<?php echo $r['uid']; ?>/picture" align="left" border="0" alt="<?php echo $json_output->name; ?>" /></a></td>
<td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
<td width="50" align="top" valign="left"><img src="pending.gif" align="left" border="0" alt="Pending" /></td>
</tr>
</table>
<?php
mysql_free_result($sql_in);
mysql_close();
}
else
{
$sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
?>
<table cellpadding="0" cellspacing="2" width="500px">
<?php
while ($r = mysql_fetch_assoc($sql_in)){
$jsonurl = "https://graph.facebook.com/". $r['uid'];
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
?>
<tr class="comment">
<td width="50" align="top" valign="left"><a href="<?php echo $json_output->link; ?>" title="<?php echo $json_output->name; ?>" target="_blank"><img src="https://graph.facebook.com/<?php echo $r['uid']; ?>/picture" align="left" border="0" alt="<?php echo $json_output->name; ?>" /></a></td>
<td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
<td width="50" align="top" valign="left">
<?php
if ($r['stare'] == 0) {
?>
<img src="pending.gif" align="left" border="0" alt="Pending" />
<?php
}
else {
?>
<img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
mysql_free_result($sql_in);
mysql_close();
}
break;
case "refresh":
$sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
?>
<table cellpadding="0" cellspacing="2" width="500px">
<?php
while ($r = mysql_fetch_assoc($sql_in)){
$jsonurl = "https://graph.facebook.com/". $r['uid'];
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
$stare = $r['stare'];
?>
<tr class="comment">
<td width="50" align="top" valign="left"><a href="<?php echo $json_output->link; ?>" title="<?php echo $json_output->name; ?>" target="_blank"><img src="https://graph.facebook.com/<?php echo $r['uid']; ?>/picture" align="left" border="0" alt="<?php echo $json_output->name; ?>" /></a></td>
<td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
<td width="50" align="top" valign="left">
<?php
if ($stare == 0) {
?>
<img src="pending.gif" align="left" border="0" alt="Pending" />
<?php
}
else {
?>
<img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
mysql_free_result($sql_in);
mysql_close();
break;
case "stare":
$sql_in=mysql_query("SELECT * FROM propunere where id LIKE $theid");
$r=mysql_fetch_array($sql_in);
$stare = $r['stare'];
if ($stare == 0){
mysql_query("UPDATE propunere SET stare = 1 WHERE id=$theid");
}
else {
mysql_query("UPDATE propunere SET stare = 0 WHERE id=$theid");
}
break;
default:
$sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
?>
<table cellpadding="0" cellspacing="2" width="500px">
<?php
while ($r = mysql_fetch_assoc($sql_in)){
$jsonurl = "https://graph.facebook.com/". $r['uid'];
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
?>
<tr class="comment">
<td width="50" align="top" valign="left"><a href="<?php echo $json_output->link; ?>" title="<?php echo $json_output->name; ?>" target="_blank"><img src="https://graph.facebook.com/<?php echo $r['uid']; ?>/picture" align="left" border="0" alt="<?php echo $json_output->name; ?>" /></a></td>
<td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
<td width="50" align="top" valign="left">
<?php
if ($r['stare'] == 0) {
?>
<img src="pending.gif" align="left" border="0" alt="Pending" />
<?php
}
else {
?>
<img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
mysql_free_result($sql_in);
mysql_close();
break;
}