|
PHP After Login Record display
Hello!
I have a php page that is designed as a users profile! When i use the search engine i constructed on my site to search for members i am able to launch the profile with no problems, becuase my search engine lists all members from my database once search has been performed\along with a link to there profile. I recently dicided to include a after login profile using the same profile mentioned above, by starting a PHP sesion. The problem i am having is that unless i use a record update form or a search engine i dont seem to be able to display the logged in users profile data from the database.
Could anyone offer any advice please!!!
All i am looking for is to have the logged in users data to display from the database into my profile page once they log in.
Thanks for any help offered.
I decided to just post all the code in my page to avoid confusion to anyone.
- PHP: Select all
<?php require_once('Connections/dbelite.php'); ?><?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** 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 == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "Login_failed.php"; 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($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsWorker = "-1"; if (isset($_GET['id'])) { $colname_rsWorker = $_GET['id']; }
mysql_select_db($database_dbelite, $dbelite); $query_rsWorker = sprintf("SELECT tbl_worker.workername, tbl_worker.workersurname, tbl_worker.workergender, tbl_worker.workerage, tbl_worker.workertown, tbl_worker.workeraddress, tbl_worker.workeremail, tbl_worker.workerphone, tbl_worker.workerprogram, tbl_worker.workerabout, tbl_worker.workerjoinreasons, tbl_worker.workerfurtherinfo, tbl_worker.workerphoto FROM tbl_worker WHERE workerid = %s", GetSQLValueString($colname_rsWorker, "int")); $rsWorker = mysql_query($query_rsWorker, $dbelite) or die(mysql_error()); $row_rsWorker = mysql_fetch_assoc($rsWorker); $totalRows_rsWorker = mysql_num_rows($rsWorker); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome To Your Personal Account</title> <link href="style/screen.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; font-size: 12pt; } .style3 {color: #0099FF} .style4 { color: #006600; font-weight: bold; } .style5 { color: #FFFFFF; font-weight: bold; } --> </style> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <table width="636" height="681" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="636" height="84" valign="top"><div align="center"> <table width="641" height="26" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#99FF33"><div align="center" class="style1">Elite Mail Services | Homeworkers Profile </div></td> </tr> </table> <p>You are now <span class="style3">logged</span> in as: <?php echo $row_rsWorker['workername']; ?> <?php echo $row_rsWorker['workersurname']; ?></p> </div> <p> </p></td> </tr> <tr> <td valign="top"><table width="640" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="444" valign="top"><div align="center"> <table width="406" height="569" border="0" cellpadding="0" cellspacing="0" id="tbl_insert"> <tr> <td width="152" height="45"><div align="left"><span class="style4">Name:</span></div></td> <td width="148"><?php echo $row_rsWorker['workername']; ?></td> </tr> <tr> <td height="48"><div align="left"><span class="style4">Surname:</span></div></td> <td><?php echo $row_rsWorker['workersurname']; ?></td> </tr> <tr> <td height="41"><div align="left"><span class="style4">Gender:</span></div></td> <td><?php echo $row_rsWorker['workergender']; ?></td> </tr> <tr> <td height="46"><div align="left"><span class="style4">Age:</span></div></td> <td><?php echo $row_rsWorker['workerage']; ?></td> </tr> <tr> <td height="43"><div align="left"><span class="style4">City:</span></div></td> <td><?php echo $row_rsWorker['workertown']; ?></td> </tr> <tr> <td height="44"><div align="left"><span class="style4">I am a member of:</span></div></td> <td><?php echo $row_rsWorker['workerprogram']; ?></td> </tr> <tr> <td height="91"><div align="left"><span class="style4">About me:</span></div></td> <td><?php echo $row_rsWorker['workerabout']; ?></td> </tr> <tr> <td height="101"><div align="left"><span class="style4">Why i joined:</span></div></td> <td><?php echo $row_rsWorker['workerjoinreasons']; ?></td> </tr> <tr> <td><div align="left"><span class="style4">Extra information:</span></div></td> <td><?php echo $row_rsWorker['workerfurtherinfo']; ?></td> </tr> </table> </div></td> <td width="196" valign="top"><table width="197" height="397" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="194"><img src="uploads/<?php echo $row_rsWorker['workerphoto']; ?> " width="199" height="200" style:"width:300px; max-width:300px" alt="<?php echo $row_rsWorker['workername']; ?> <?php echo $row_rsWorker['workersurname']; ?>" /></td> </tr> <tr> <td valign="top"><table width="198" height="169" border="0" cellpadding="0" cellspacing="0"> <tr> <td><div align="center"> <table width="185" height="157" border="2" cellpadding="0" cellspacing="0" bordercolor="#99FF33"> <tr> <td height="22" bgcolor="#99FF33"><div align="center"><span class="style5">User control panel</span></div></td> </tr> <tr> <td valign="top"><table width="185" height="135" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="141"><div align="right">Edit Profile:</div></td> <td width="44"><div align="center"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','38','height','22','src','button3','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFFFFF','movie','button3' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="38" height="22"> <param name="movie" value="button3.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="button3.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="38" height="22" bgcolor="#FFFFFF"></embed> </object> </noscript></div></td> </tr> <tr> <td><div align="right">View Account Balance:</div></td> <td><div align="center"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','38','height','22','src','button4','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFFFFF','movie','button4' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="38" height="22"> <param name="movie" value="button4.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="button4.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="38" height="22" bgcolor="#FFFFFF"></embed> </object> </noscript></div></td> </tr> <tr> <td><div align="right">Contact Support:</div></td> <td><div align="center"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','38','height','22','src','button5','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFFFFF','movie','button5' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="38" height="22"> <param name="movie" value="button5.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="button5.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="38" height="22" bgcolor="#FFFFFF"></embed> </object> </noscript></div></td> </tr> <tr> <td><div align="right">Delete Account:</div></td> <td><div align="center"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','38','height','22','src','button6','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFFFFF','movie','button6' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="38" height="22"> <param name="movie" value="button6.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="button6.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="38" height="22" bgcolor="#FFFFFF"></embed> </object> </noscript></div></td> </tr> </table></td> </tr> </table> </div></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table> <table width="636" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#99FF33"><div align="center"></div></td> </tr> </table> <p align="center"> </p> <p> </p> </body> </html> <?php mysql_free_result($rsWorker); ?>
|