Advertisement
nalyk

propuneri.php

Mar 30th, 2011
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.40 KB | None | 0 0
  1.     $do = $_POST['do'];
  2.     echo $do."<br />";
  3.  
  4.     switch ($do) {
  5.         case "update":
  6.             if(isSet($_POST['content']))
  7.             {
  8.                 $content=$_POST['content'];
  9.                 $vid = getYTid($content);
  10.                 mysql_query("insert into propunere(id, uid, vid, data, stare) values ('', '$uid', '$vid', '$data', '0')");
  11.                 $sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
  12.                 $r=mysql_fetch_array($sql_in);
  13.                 $jsonurl = "https://graph.facebook.com/". $r['uid'];
  14.                 $json = file_get_contents($jsonurl,0,null,null);
  15.                 $json_output = json_decode($json);
  16.                 ?>
  17.                 <table cellpadding="0" cellspacing="2" width="500px">
  18.                     <tr class="comment">
  19.                         <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>
  20.                         <td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
  21.                         <td width="50" align="top" valign="left"><img src="pending.gif" align="left" border="0" alt="Pending" /></td>
  22.                     </tr>
  23.                 </table>
  24.                 <?php
  25.                 mysql_free_result($sql_in);
  26.                 mysql_close();
  27.             }
  28.             else
  29.             {
  30.                 $sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
  31.                 ?>
  32.                 <table cellpadding="0" cellspacing="2" width="500px">
  33.                 <?php
  34.                 while ($r = mysql_fetch_assoc($sql_in)){
  35.                 $jsonurl = "https://graph.facebook.com/". $r['uid'];
  36.                 $json = file_get_contents($jsonurl,0,null,null);
  37.                 $json_output = json_decode($json);
  38.                 ?>
  39.                     <tr class="comment">
  40.                         <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>
  41.                         <td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
  42.                         <td width="50" align="top" valign="left">
  43.                         <?php
  44.                         if ($r['stare'] == 0) {
  45.                         ?>
  46.                             <img src="pending.gif" align="left" border="0" alt="Pending" />
  47.                         <?php
  48.                         }
  49.                         else {
  50.                         ?>
  51.                             <img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
  52.                         <?php
  53.                         }
  54.                         ?>
  55.                         </td>
  56.                     </tr>
  57.                     <?php
  58.                     }
  59.                     ?>
  60.                 </table>
  61.                 <?php
  62.                 mysql_free_result($sql_in);
  63.                 mysql_close();
  64.                 }
  65.             break;
  66.         case "refresh":
  67.                 $sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
  68.                 ?>
  69.                 <table cellpadding="0" cellspacing="2" width="500px">
  70.                 <?php
  71.                 while ($r = mysql_fetch_assoc($sql_in)){
  72.                 $jsonurl = "https://graph.facebook.com/". $r['uid'];
  73.                 $json = file_get_contents($jsonurl,0,null,null);
  74.                 $json_output = json_decode($json);
  75.                 $stare = $r['stare'];
  76.                 ?>
  77.                     <tr class="comment">
  78.                         <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>
  79.                         <td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
  80.                         <td width="50" align="top" valign="left">
  81.                         <?php
  82.                         if ($stare == 0) {
  83.                         ?>
  84.                             <img src="pending.gif" align="left" border="0" alt="Pending" />
  85.                         <?php
  86.                         }
  87.                         else {
  88.                         ?>
  89.                             <img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
  90.                         <?php
  91.                         }
  92.                         ?>
  93.                         </td>
  94.                     </tr>
  95.                     <?php
  96.                     }
  97.                     ?>
  98.                 </table>
  99.                 <?php
  100.                 mysql_free_result($sql_in);
  101.                 mysql_close();
  102.             break;
  103.         case "stare":
  104.                 $sql_in=mysql_query("SELECT * FROM propunere where id LIKE $theid");
  105.                 $r=mysql_fetch_array($sql_in);
  106.                 $stare = $r['stare'];
  107.                 if ($stare == 0){
  108.                     mysql_query("UPDATE propunere SET stare = 1 WHERE id=$theid");
  109.                 }
  110.                 else {
  111.                     mysql_query("UPDATE propunere SET stare = 0 WHERE id=$theid");
  112.                 }          
  113.             break;
  114.         default:
  115.                 $sql_in=mysql_query("SELECT * FROM propunere order by id desc LIMIT 31");
  116.                 ?>
  117.                 <table cellpadding="0" cellspacing="2" width="500px">
  118.                 <?php
  119.                 while ($r = mysql_fetch_assoc($sql_in)){
  120.                 $jsonurl = "https://graph.facebook.com/". $r['uid'];
  121.                 $json = file_get_contents($jsonurl,0,null,null);
  122.                 $json_output = json_decode($json);
  123.                 ?>
  124.                     <tr class="comment">
  125.                         <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>
  126.                         <td style="padding:2px;" class="comment_box" align="left"><?php echo get_yt_title($r['vid']); ?></td>
  127.                         <td width="50" align="top" valign="left">
  128.                         <?php
  129.                         if ($r['stare'] == 0) {
  130.                         ?>
  131.                             <img src="pending.gif" align="left" border="0" alt="Pending" />
  132.                         <?php
  133.                         }
  134.                         else {
  135.                         ?>
  136.                             <img src="aprobat.gif" align="left" border="0" alt="Aprobat" />
  137.                         <?php
  138.                         }
  139.                         ?>
  140.                         </td>
  141.                     </tr>
  142.                     <?php
  143.                     }
  144.                     ?>
  145.                 </table>
  146.                 <?php
  147.                 mysql_free_result($sql_in);
  148.                 mysql_close();
  149.             break;
  150.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement