Guest

yankidank

By: a guest on Jan 25th, 2010  |  syntax: PHP  |  size: 1.21 KB  |  hits: 1,372  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. <?php
  2. include_once 'libs/dbconnect.php';
  3. include_once('Smarty.class.php');
  4. $main_smarty = new Smarty;
  5. include_once('config.php');
  6. include(mnminclude.'html1.php');
  7. include(mnminclude.'smartyvariables.php');
  8.  
  9. force_authentication();
  10. $amIgod = 0;
  11. $amIgod = $amIgod + checklevel('god');
  12. $main_smarty->assign('amIgod', $amIgod);
  13.  
  14. if($amIgod == 0){
  15.         header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
  16.         die();
  17. }
  18. $main_smarty->assign('isAdmin', $canIhaveAccess);
  19.  
  20. mysql_connect(EZSQL_DB_HOST,EZSQL_DB_USER,EZSQL_DB_PASSWORD);
  21. mysql_select_db(EZSQL_DB_NAME);
  22.  
  23. header("Content-Type: application/vnd.ms-excel");
  24. $filename = "Website_User_Data_" . date('d-m-Y') . ".xls";
  25. header("Content-Disposition: attachment;filename=\"$filename\"");
  26.  
  27. $result = mysql_query("SELECT * FROM ".table_prefix."users ORDER BY user_id") or die('MySQL query attempting to select user data failed!');
  28. while(false !== ($row = mysql_fetch_assoc($result))) {
  29.         echo $row[user_id]."\t";
  30.         echo $row[user_names]."\t";
  31.         echo $row[user_login]."\t";
  32.         echo $row[user_email]."\t";
  33.         echo $row[user_url] . "\t";
  34.         echo $row[user_date] . "\t";
  35.         echo $row[user_lastlogin]." \n";
  36.         //echo implode("\t", array_values($row)) . "\n";
  37. }
  38. ?>