A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.2 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file common.php
  5. * @version $Id$
  6. * @copyright 2009(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/
  8. * @license GNU GPL v3
  9. **/
  10. if (is_dir('install'))
  11. {
  12. die('<font color="red" face="Verdana" size="6">Please delete or rename catalog "install"</font>');
  13. }
  14. //set global preferences from DataBase
  15. $sql="SELECT * FROM ".CONFIG_TABLE."";
  16. $query=DataBase::sql_query($sql,'CRITICAL','Could not obtain config information');
  17. while($result=mysql_fetch_array($query))
  18. {
  19. if (($result['name']=='') or ($result['name']=='0'))
  20. {
  21. $forum_config['name']==false;
  22. }
  23. else
  24. {
  25. $forum_config[$result['name']] = $result['value'];
  26. }
  27. }
  28. //check for disable forum
  29. if ($_SESSION>0)
  30. {
  31. if (($forum_config['disable_forum']) and (User::UserInformation($_SESSION['uid'],'rank')<2))
  32. {
  33. die($forum_config['disable_forum']);
  34. }
  35. }
  36. else
  37. {
  38. if ($forum_config['disable_forum'])
  39. {
  40. die($forum_config['disable_forum']);
  41. }
  42. }
  43. //check for banned user
  44. if ($_SESSION['uid']>0)
  45. {
  46. $ip = $_SERVER['REMOTE_ADDR'];
  47. $uid = $_SESSION['uid'];
  48. $sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'";
  49. $result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information'));
  50. $motive = $result['motive'];
  51. $db_ip = $result['IP'];
  52. $db_uid = $result['u_id'];
  53. if (($db_ip==$ip) || ($db_uid==$uid))
  54. {
  55. include('./includes/class_overall.php');
  56. include('./lngs/'.Over::DefaultLang().'/main.php');
  57. sess_delete($_SESSION['uid']);
  58. $_SESSION['uid']='0';
  59. message_forum($motive,'index.php', '10');
  60. }
  61. }
  62. //set to variable userdata loged user informations
  63. if ($_SESSION['uid']>0)
  64. {
  65. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`=".$_SESSION['uid']." LIMIT 1";
  66. }
  67. else
  68. {
  69. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
  70. }
  71. $query = DataBase::sql_query($sql, 'GENERAL','Could not obtain loged user information');
  72. $userdata = mysql_fetch_array($query);
  73. define('RANK', $userdata['rank']);
  74. define('TABLES_WIDTH',$forum_config['tables_width']);
  75. //protect of database - add the backslashes
  76. /*foreach ($_POST as $name => $value)
  77. {
  78. $_POST[$name] = mysql_real_escape_string($value);
  79. }*/
  80. ?>