Просмотр файла katrinka.ru/admin/upd_posts.php

Размер файла: 820B
  1. <?php
  2. include '../wap/config.php';
  3. $xtime=mktime(0,0,0,6,3,2003);
  4. if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
  5. echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
  6. exit;
  7. }
  8. $res=pg_query($conn, "select id,posts from users where moder=0 order by id;");
  9. $rows=pg_numrows($res);
  10. for ($i=0; $i<$rows; $i++) {
  11. $aposts=0;
  12. $id=pg_result($res,$i,0);
  13. $posts=pg_result($res,$i,1);
  14. $resp=pg_query($conn,"select count(*) from chat where fr_u='$id' and time < '$xtime';");
  15. if (pg_numrows($resp)) {
  16. $aposts=pg_result($resp,0,0);
  17. $posts=$posts+$aposts;
  18. }
  19. if ($aposts) pg_query($conn,"update users set posts='$posts' where id='$id';");
  20. pg_query($conn,"delete from chat where fr_u='$id' and time < '$xtime';");
  21. print $id;
  22. }
  23. pg_close($conn);
  24. print "Ok";
  25. ?>