Jump to content

Display User Account Details


lordjordysmith

Recommended Posts

Hi all

 

I need some help with displaying user account details i am currently able to show only the email address and i would like to show the name school name and yeargroup

 

heres my code for myaccount.php

<?php require_once('Connections/isn_1.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "1,2,3,4";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login.php?login=false";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>My Account - <?php echo($_SESSION['MM_Username']); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@import url("style.css");
</style>
</head>
<body class="about">
<!-- Start NavBar -->
<div id="topnavbar">
<dl>
	<dt id="home"><a href="index.php">Home</a></dt>
        <dt id="about"><a href="about.php">About</a></dt>
        <dt id="account"><a href="myaccount.php">Account</a></dt>
        <dt id="login"><a href="login.php">Login</a></dt>
        </dl>
    <dl id="rightnavbar">
    	<dt id="ISN"><a href="index.php">ISN</a></dt>
    </dl>
</div>
<!-- End NavBar -->
<div id="page-container"> 

<div id="header"> 
</div> 
    
<div id="sidebar-a"></div> 

<div id="content"> 
<div class="padding">
  <center>
    <table width="631" border="0">
      <tr>
        <td colspan="2">Personal Details</td>
          </tr>
      <tr>
        <td width="229"> </td>
        <td width="648"></td>
          </tr>
      <tr>
        <td>Name</td>
        <td></td>
          </tr>
      <tr>
        <td>Email</td>
        <td><?php echo($_SESSION['MM_Username']); ?></td>
          </tr>
      <tr>
        <td>School Name</td>
        <td></td>
          </tr>
      <tr>
        <td>Year Group</td>
        <td></td>
          </tr>
      <tr>
        <td>DOB</td>
        <td></td>
          </tr>
      <tr>
        <td> </td>
        <td><a href="updateprofile.php">Modify my details</a></td>
          </tr>
        </table>
    <a href="logout.php">Logout?</a>
      </center>
</div> 
</div> 

<div id="footer"> 
<div id="altnav"> 
	<a href="index.php">Home</a> - 
	<a href="login.php">Login</a> - 
	<a href="register.php">Register</a> - 
	<a href="about.php">About</a> -
        <a href="terms.php">Terms & Conditions</a>
</div> 
<div id="copyright">© 2011 InterSchoolsNetwork, All Rights Reserved - A <a href="http://jordansmithsolutions.co.uk">Jordan Smith Solutions</a> & <a href="http://www.joecocorp.webs.com/">JoeCo Corp Production</a><br /> 
</div> 
</div> 
</div> 
</body>
</html>
<?php
mysql_free_result($rsUpdateUser);
?>

 

If you need any other code to help answer it for me then let me no please

Link to comment
Share on other sites

no where in your query are you setting a session value if one isn't set. so, if the session doesn't exist it wont echo anything out. its worth mentioning also that you may wanna reconsider echoing out a straight session/cookie/post/get value also. Its always worth making sure the values are what are expected first otherwise you are opening your site up to serious security risks from exploits.

Link to comment
Share on other sites

Thanks for getting back to me both of you

 

Connections/isn_1.php is just the database connection data

 

Unfortunately i am new to php so i am trying to use what i can get so the code is what i have got from tutorials but none of them have mentioned this session id the most i have that is to do with sessions is the parts named session

 

hopefully you can help direct me with what i can do

 

many thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.