Advertisement
Guest User

Untitled

a guest
Jan 16th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. <?php require_once('Connections/toast_sql.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. session_start();
  5. }
  6. $MM_authorizedUsers = "";
  7. $MM_donotCheckaccess = "true";
  8.  
  9. // *** Restrict Access To Page: Grant or deny access to this page
  10. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  11. // For security, start by assuming the visitor is NOT authorized.
  12. $isValid = False;
  13.  
  14. // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  15. // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  16. if (!empty($UserName)) {
  17. // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  18. // Parse the strings into arrays.
  19. $arrUsers = Explode(",", $strUsers);
  20. $arrGroups = Explode(",", $strGroups);
  21. if (in_array($UserName, $arrUsers)) {
  22. $isValid = true;
  23. }
  24. // Or, you may restrict access to only certain users based on their username.
  25. if (in_array($UserGroup, $arrGroups)) {
  26. $isValid = true;
  27. }
  28. if (($strUsers == "") && true) {
  29. $isValid = true;
  30. }
  31. }
  32. return $isValid;
  33. }
  34.  
  35. $MM_restrictGoTo = "user_profil.php";
  36. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
  37. $MM_qsChar = "?";
  38. $MM_referrer = $_SERVER['PHP_SELF'];
  39. if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  40. if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  41. $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  42. $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  43. header("Location: ". $MM_restrictGoTo);
  44. exit;
  45. }
  46.  
  47. if (!function_exists("GetSQLValueString")) {
  48. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  49. {
  50. if (PHP_VERSION < 6) {
  51. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  52. }
  53.  
  54. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  55.  
  56. switch ($theType) {
  57. case "text":
  58. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  59. break;
  60. case "long":
  61. case "int":
  62. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  63. break;
  64. case "double":
  65. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  66. break;
  67. case "date":
  68. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  69. break;
  70. case "defined":
  71. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  72. break;
  73. }
  74. return $theValue;
  75. }
  76. }
  77.  
  78. $colname_Recordset1 = "-1";
  79. if (isset($_SESSION['MM_Username'])) {
  80. $colname_Recordset1 = $_SESSION['MM_Username'];
  81. }
  82. mysql_select_db($database_toast_sql, $toast_sql);
  83. $query_Recordset1 = sprintf("SELECT * FROM users WHERE pseudo = %s", GetSQLValueString($colname_Recordset1, "text"));
  84. $Recordset1 = mysql_query($query_Recordset1, $toast_sql) or die(mysql_error());
  85. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  86. $totalRows_Recordset1 = mysql_num_rows($Recordset1);$colname_Recordset1 = "-1";
  87. if (isset($_SESSION['MM_Username'])) {
  88. $colname_Recordset1 = $_SESSION['MM_Username'];
  89. }
  90.  
  91. //mysql_query('UPDATE users SET point =(point+10) WHERE pseudo = "'.$_SESSION['MM_Username'].'"');
  92. //header ('location: user_profil.php');
  93. ?>
  94. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  95. <html xmlns="http://www.w3.org/1999/xhtml">
  96. <head>
  97. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  98. <title>Document sans titre</title>
  99. </head>
  100. <body>
  101. <?php
  102. echo $_SESSION['MM_Username'];
  103. ?>
  104. </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement