Guest User

Untitled

a guest
Jan 15th, 2012
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.89 KB | None | 0 0
  1. <?php require_once('Connections/toast_sql.php'); ?>
  2. <?php
  3. //initialize the session
  4. if (!isset($_SESSION)) {
  5.   session_start();
  6. }
  7.  
  8. // ** Logout the current user. **
  9. $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
  10. if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  11.   $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
  12. }
  13.  
  14. if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  15.   //to fully log out a visitor we need to clear the session varialbles
  16.   $_SESSION['MM_Username'] = NULL;
  17.   $_SESSION['MM_UserGroup'] = NULL;
  18.   $_SESSION['PrevUrl'] = NULL;
  19.   unset($_SESSION['MM_Username']);
  20.   unset($_SESSION['MM_UserGroup']);
  21.   unset($_SESSION['PrevUrl']);
  22.    
  23.   $logoutGoTo = "deconnection.php";
  24.   if ($logoutGoTo) {
  25.     header("Location: $logoutGoTo");
  26.     exit;
  27.   }
  28. }
  29. ?>
  30. <?php
  31. if (!isset($_SESSION)) {
  32.   session_start();
  33. }
  34. $MM_authorizedUsers = "";
  35. $MM_donotCheckaccess = "true";
  36.  
  37. // *** Restrict Access To Page: Grant or deny access to this page
  38. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  39.   // For security, start by assuming the visitor is NOT authorized.
  40.   $isValid = False;
  41.  
  42.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  43.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  44.   if (!empty($UserName)) {
  45.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  46.     // Parse the strings into arrays.
  47.     $arrUsers = Explode(",", $strUsers);
  48.     $arrGroups = Explode(",", $strGroups);
  49.     if (in_array($UserName, $arrUsers)) {
  50.       $isValid = true;
  51.     }
  52.     // Or, you may restrict access to only certain users based on their username.
  53.     if (in_array($UserGroup, $arrGroups)) {
  54.       $isValid = true;
  55.     }
  56.     if (($strUsers == "") && true) {
  57.       $isValid = true;
  58.     }
  59.   }
  60.   return $isValid;
  61. }
  62.  
  63. $MM_restrictGoTo = "connexion.php";
  64. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  65.   $MM_qsChar = "?";
  66.   $MM_referrer = $_SERVER['PHP_SELF'];
  67.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  68.   if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  69.   $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  70.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  71.   header("Location: ". $MM_restrictGoTo);
  72.   exit;
  73. }
  74. ?>
  75. <?php
  76. if (!function_exists("GetSQLValueString")) {
  77. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  78. {
  79.   if (PHP_VERSION < 6) {
  80.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  81.   }
  82.  
  83.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  84.  
  85.   switch ($theType) {
  86.     case "text":
  87.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  88.       break;    
  89.     case "long":
  90.     case "int":
  91.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  92.       break;
  93.     case "double":
  94.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  95.       break;
  96.     case "date":
  97.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  98.       break;
  99.     case "defined":
  100.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  101.       break;
  102.   }
  103.   return $theValue;
  104. }
  105. }
  106.  
  107. $colname_Recordset1 = "-1";
  108. if (isset($_SESSION['MM_Username'])) {
  109.   $colname_Recordset1 = $_SESSION['MM_Username'];
  110. }
  111. mysql_select_db($database_toast_sql, $toast_sql);
  112. $query_Recordset1 = sprintf("SELECT * FROM users WHERE pseudo = %s", GetSQLValueString($colname_Recordset1, "text"));
  113. $Recordset1 = mysql_query($query_Recordset1, $toast_sql) or die(mysql_error());
  114. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  115. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  116. ?>
  117. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  118. <html xmlns="http://www.w3.org/1999/xhtml">
  119. <head>
  120. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  121. <title>Document sans titre</title>
  122. </head>
  123.  
  124. <body>
  125. <p>votre pseudo est <?php echo $row_Recordset1['pseudo']; ?> .
  126. </p>
  127. <p>votre mot de passe est <?php echo $row_Recordset1['pass']; ?>.</p>
  128. <p>vous etes le <?php echo $row_Recordset1['id']; ?> inscrit.</p>
  129. <p>vous avez <?php echo $row_Recordset1['point']; ?> point.</p>
  130. <p>avoir 10 point en plus <a href="+depoint.php?user=<?php echo $row_Recordset1['pseudo']; ?>">ici</a>.</p>
  131. <p>&nbsp;<a href="<?php echo $logoutAction ?>">Déconnecter</a></p>
  132. <p><a href="modifier-profil.php?user=<?php echo $row_Recordset1['pseudo']; ?>">modifier profil</a></p>
  133. <p>&nbsp;</p>
  134. </body>
  135. </html>
  136. <?php
  137. mysql_free_result($Recordset1);
  138. ?>
Advertisement
Add Comment
Please, Sign In to add comment