Advertisement
AleeFerreira

cls - changestatus.php

Aug 10th, 2013
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2. header("Location-Type: text/html; charset=utf-8;");
  3.  
  4. $ke = $_GET["key"];
  5. $type = $_POST["type_box"];
  6. $type = utf8_decode($type);
  7.  
  8. if (isset($ke)) {
  9.     include ('connect.php');
  10.     if ($type == 'Vendido') {
  11.         $q = mysql_query("select image from ads where adsid='$ke'");
  12.         if ($q) {
  13.             if (mysql_num_rows($q)) {
  14.                 $r = mysql_fetch_array($q);
  15.                 $img = $r["image"];
  16.                 $l = "ads/thumbs/".$img;
  17.                 unlink($l);
  18.                 $query = mysql_query("delete from ads where adsid='$ke'");
  19.                 if ($query) {
  20.                     echo "<script>alert('Obrigado por usar o CLS Classificados.\n Seu anúncio foi excluído do banco de dados pela alteração de status para Vendido.');</script>";
  21.                     echo "<script>window.setTimeout(\"location.href='index.php?pg=profile';\", 1000);</script>";
  22.                 }
  23.                 $s = mysql_query("update users set adsid=-1 where adsid='$ke'");
  24.             }
  25.         }
  26.     } else {
  27.         $q = mysql_query("update ads set status='$type' where adsid='$ke'");
  28.         if ($q) {
  29.             echo "<script>alert('Status alterado com sucesso!');</script>";
  30.             echo "<script>window.setTimeout(\"location.href='index.php?pg=profile';\", 1000);</script>";
  31.         }
  32.     }
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement