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.

89 lines
2.3 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. 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. //check for banned user
  48. if ($_SESSION['uid']>0)
  49. {
  50. $ip = $_SERVER['REMOTE_ADDR'];
  51. $uid = $_SESSION['uid'];
  52. $sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'";
  53. $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information'));
  54. $motive = $result['motive'];
  55. $db_ip = $result['IP'];
  56. $db_uid = $result['u_id'];
  57. if (($db_ip==$ip) || ($db_uid==$uid))
  58. {
  59. include('./includes/misc_functions.php');
  60. include('./lngs/'.DefaultLang().'/main.php');
  61. SessDelete($_SESSION['uid']);
  62. $_SESSION['uid']='0';
  63. message_forum($motive,'index.php', '10');
  64. }
  65. }
  66. //set to variable userdata loged user informations
  67. if ($_SESSION['uid']>0)
  68. {
  69. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`=".$_SESSION['uid']." LIMIT 1";
  70. }
  71. else
  72. {
  73. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
  74. }
  75. $query = DataBase::sql_query($sql, 'GENERAL','Could not obtain loged user information');
  76. $userdata = DataBase::fetch($query);
  77. define('RANK', $userdata['rank']);
  78. define('TABLES_WIDTH',$forum_config['tables_width']);
  79. //protect of database - add the backslashes
  80. /*foreach ($_POST as $name => $value)
  81. {
  82. $_POST[$name] = mysql_real_escape_string($value);
  83. }*/
  84. ?>