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.

91 lines
2.3 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file common.php
  5. * @version $Id$
  6. * @copyright 2007-2010 (c) PioDer <pioder@wp.pl>
  7. * @link http://www.pioder.pl/
  8. * @license see LICENSE.txt
  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. if (phpversion()<'5.0.7')
  15. {
  16. die('&micro;Forum requires PHP 5.0.7 or later');
  17. }
  18. //set global preferences from DataBase
  19. $sql="SELECT * FROM ".CONFIG_TABLE."";
  20. $query=DataBase::sql_query($sql,CRITICAL,'Could not obtain config information');
  21. while($result=DataBase::fetch($query))
  22. {
  23. if (($result['name']=='') or ($result['name']=='0'))
  24. {
  25. $forum_config['name']==false;
  26. }
  27. else
  28. {
  29. $forum_config[$result['name']] = $result['value'];
  30. }
  31. }
  32. //check for disable forum
  33. if ($_SESSION>0)
  34. {
  35. if (($forum_config['disable_forum']) and (User::UserInformation($_SESSION['uid'],'rank')<2))
  36. {
  37. die($forum_config['disable_forum']);
  38. }
  39. }
  40. else
  41. {
  42. if ($forum_config['disable_forum'])
  43. {
  44. die($forum_config['disable_forum']);
  45. }
  46. }
  47. define('TABLES_WIDTH',$forum_config['tables_width']);
  48. //check for banned user
  49. if ($_SESSION['uid']>0)
  50. {
  51. $ip = $_SERVER['REMOTE_ADDR'];
  52. $uid = $_SESSION['uid'];
  53. $sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'";
  54. $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain ban information'));
  55. $motive = $result['motive'];
  56. $db_ip = $result['IP'];
  57. $db_uid = $result['u_id'];
  58. if (($db_ip==$ip) || ($db_uid==$uid))
  59. {
  60. require('./includes/misc_functions.php');
  61. require('./lngs/'.DefaultLang(true).'/main.php');
  62. SessDelete($_SESSION['uid']);
  63. $_SESSION['uid']='0';
  64. message_forum($motive,'index.php', '10');
  65. }
  66. }
  67. //set to variable userdata loged user informations
  68. if ($_SESSION['uid']>0)
  69. {
  70. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`=".$_SESSION['uid']." LIMIT 1";
  71. }
  72. else
  73. {
  74. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
  75. }
  76. $query = DataBase::sql_query($sql, GENERAL,'Could not obtain loged user information');
  77. $userdata = DataBase::fetch($query);
  78. define('RANK', $userdata['rank']);
  79. //protect of database - add the backslashes
  80. /*foreach ($_POST as $name => $value)
  81. {
  82. $_POST[$name] = mysql_real_escape_string($value);
  83. }*/
  84. ?>