home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / blocks / block-Subscription.php < prev    next >
PHP Script  |  2004-01-29  |  2KB  |  55 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com)         */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14.  
  15. if (eregi("block-Subscription.php",$_SERVER['PHP_SELF'])) {
  16.     Header("Location: index.php");
  17.     die();
  18. }
  19.  
  20. global $prefix, $db, $sitename, $subscription_url, $user, $cookie;
  21.  
  22. if (paid()) {
  23.     cookiedecode($user);
  24.     $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_subscriptions WHERE userid='$cookie[0]'"));
  25.     if ($subscription_url != "") {
  26.         $content = "<center>"._YOUARE." <a href='$subscription_url'>"._SUBSCRIBER."</a> "._OF." $sitename<br>";
  27.     } else {
  28.         $content = "<center>"._YOUARE." "._SUBSCRIBER." "._OF." $sitename<br>";
  29.     }
  30.     $diff = $row[subscription_expire]-time();
  31.     $yearDiff = floor($diff/60/60/24/365);
  32.     $diff -= $yearDiff*60*60*24*365;
  33.     if ($yearDiff < 1) {
  34.         $diff = $row[subscription_expire]-time();
  35.     }
  36.     $daysDiff = floor($diff/60/60/24);
  37.     $diff -= $daysDiff*60*60*24;
  38.     $hrsDiff = floor($diff/60/60);
  39.     $diff -= $hrsDiff*60*60;
  40.     $minsDiff = floor($diff/60);
  41.     $diff -= $minsDiff*60;
  42.     $secsDiff = $diff;
  43.     if ($yearDiff < 1) {
  44.         $rest = "$daysDiff "._SBDAYS."<br>$hrsDiff "._SBHOURS."<br>$minsDiff "._SBMINUTES."<br>$secsDiff "._SBSECONDS."";
  45.     } elseif ($yearDiff == 1) {
  46.         $rest = "$yearDiff "._SBYEAR."<br>$daysDiff "._SBDAYS."<br>$hrsDiff "._SBHOURS."<br>$minsDiff "._SBMINUTES."<br>$secsDiff "._SBSECONDS."";
  47.     } elseif ($yearDiff > 1) {
  48.         $rest = "$yearDiff "._SBYEARS."<br>$daysDiff "._SBDAYS."<br>$hrsDiff "._SBHOURS."<br>$minsDiff "._SBMINUTES."<br>$secsDiff "._SBSECONDS."";
  49.     }
  50.     $content .= "<br><b>"._SUBEXPIREIN."<br><br><font color='#FF0000'>$rest</font></b></center>";
  51. } else {
  52.     $content = "<center>"._NOTSUB." $sitename. "._SUBFROM." <a href='$subscription_url'>"._HERE."</a> "._NOW."";
  53. }
  54.  
  55. ?>