View Profile in Form Creator Form CMS
This script is called view-profile_.php
The View Profile in Form Creator Form CMS script is one of a group of PHP scripts that handle both the administrative and end-user aspects of a general purpose HTML Form Creator that allows not just input boxes but multiple selection enabled select/option lists as well. In addition to the expectable editing scripts for both administrative and end-user functions, there's also a Search and Match script so that users can use the scripts to find other users with various individual or group commonalities, including proximity searches, i.e., find all the users within various distances. There are even private messaging scripts.
- HTML Form Creator
- Edit Options in HTML Form Creator Form
- Administrator Page for HTML Form Creator
End-User HTML Form Creator Scripts
- HTML Form Creator—Register with Captcha
- HTML Form Creator—View Profile
- HTML Form Creator—Edit Profile
- HTML Form Creator—Search and Match
- HTML Form Creator—Search and Match — Security
- HTML Form Creator—Search and Match — JavaScript
- HTML Form Creator—Search and Match — Form
- HTML Form Creator—Search and Match — PHP
- HTML Form Creator—Enter Record in Form
- HTML Form Creator—View Record in Form
- HTML Form Creator—Profile and Account Management
- HTML Form Creator—Login to Profile and Account Management
- HTML Form Creator—Logout of Profile and Account Management
- HTML Form Creator—Delete Group Account
- HTML Form Creator—Forgot User Name
- HTML Form Creator—Forgot Password
- HTML Form Creator—Form to Send Private Message
- HTML Form Creator—Send Private Message
- HTML Form Creator—Private Message Outbox
- HTML Form Creator—Private Message Inbox
- HTML Form Creator—Delete Private Message from Inbox
- HTML Form Creator—Delete Private Message from Outbox
- HTML Form Creator—Private Message Logout
- HTML Form Creator—Search and Match Session Monitoring
- HTML Form Creator—Configure File for Database Connection
- HTML Form Creator—Captcha Script for Registration and Login
Administrative HTML Form Creator Scripts
The purpose of this script is to provide a way in which the user can view his user profile.
First, we start up a session (in the checkid_.php script) and include the config.php script to ensure that our connection to our database is made correctly. This file has the codes below in it:
$theemailaddress = "yoursite@yoursite.com"; //EDIT ME
$roothostname = "localhost";
$theusername = "yourusername"; //EDIT ME
$thepassword = "yourpassword"; //EDIT ME
$thedatabasename = "yourdb"; //EDIT ME
mysql_connect("".$roothostname."","".$theusername."","".$thepassword."") or die(mysql_error());
mysql_select_db("".$thedatabasename."") or die(mysql_error());
We also use the checkid_.php script to ensure that the session id variable is set, and send the user to register-with-captcha_.php if it is not. Then we put the session variable 'username' into $U—we will be checking that it is set in a second. Then we define a named constant '_NODIRECTACCESS'. We include the config.php file (in the includes folder) which uses the PHP defined() function to check on this constant. If it is not set, we are thrown out of the config.php file like yesterday's trash.
Next we check if the session variables 'groupname', 'username', and 'userid' are set. If not, we are sent to the login script. We make sure $U is still equal to the session variable 'username', that it is not an empty string, and that it's at least 6 characters long or . . . you guessed it . . . the login script. We make sure the session id is set and send them away if not.
In the PHP section, we use the SELECT statement to select data from the database table my_members. The * tells the script we want everything, but the WHERE username = '$U' statement limits the "everything" to everything in this user's record. We use the mysql_fetch_array() function to get the result set from the SELECT MySQL query into an array.
We put a link, Return to Profile and Account Management, at the top of the display on the web page to allow easy exit. As we display the contents of the user's record/row, the htmlentities() function and the stripslashes() function are used for display security.
The script below is called: view-profile_.php
<?php
include_once"checkid_.php";
$U=$_SESSION['username'];
define('_NODIRECTACCESS', TRUE);
include_once"includes/config.php";
if (!isset($_SESSION['groupname']) || !isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['username']<>$U || !isset($U) || $U=="" || strlen($U)<6 || !isset($_SESSION['sessionid'])){echo '<script language="javascript">alert("Please login."); window.location = "login_.php";</script>';}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252" >
<TITLE>View Profile</TITLE>
<meta name="description" content="View Profile">
<meta name="keywords" content="View Profile,View Profile,profile,account,my account,view account,javascript, dhtml, DHTML">
<style type="text/css">
BODY {margin-left:0; margin-right:0; margin-top:0;text-align:left}
td {font:normal 13px Verdana; color:black;text-align:left;padding:0 6px 0 6px}
h1 {font:bold 28px Verdana; color:black;text-align:center}
h2 {font:bold 24px Verdana;text-align:center}
h3 {font:bold 15px Verdana;}
#c {width:100%;text-align:center}
#t {margin-left:auto !important;margin-right:auto !important;padding:20px;border:2px solid blue;background-color:#eee;}
</style>
<script language="javascript">
mactest=(navigator.userAgent.indexOf("Mac")!=-1)
Netscape=(navigator.appName.indexOf("Netscape") != -1)
msafari=(navigator.userAgent.indexOf("Safari")!= -1)
wsafari=0; if(!mactest&&msafari){wsafari=1;msafari=0}
is_opera = 0; if(window.opera){is_opera=1}
is_ie_mac = 0; is_ie=0;if(document.all){is_ie=1}
if(is_ie&&mactest){is_ie_mac=1}
function fixwidth(){if(mactest&&!msafari&&is_ie_mac){alert("This browser is dead. Please use Firefox or Safari.");}}
</script>
</head>
<body onload="fixwidth()">
<center><h1>View Membership Data</h1></center>
<?php
$result = mysql_query("SELECT * FROM my_members WHERE username = '$U'") or die(mysql_error());
$row = mysql_fetch_array($result);
echo "<center><table border='0' cellspacing='5' cellpadding='5' id='t'>";
echo "<tr><td><a HREF='profile-and-account-management.php'><center>Return to Profile and Account Management</center></a><tr><td> </td></tr>";
echo "<tr><th style='text-align:center;font-size:18px;color:blue'><b>".htmlentities(stripslashes($row['username']), ENT_QUOTES)."'s Membership</b></th></tr><tr><td><hr></th></tr>";
echo "<tr><td style='text-align:left'><b>Group Name:</b> ".htmlentities(stripslashes($row['groupname']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>Location:</b> ".htmlentities(stripslashes($row['city']), ENT_QUOTES).", ";
echo htmlentities(stripslashes($row['state']), ENT_QUOTES)." ";
echo htmlentities(stripslashes($row['zip']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>ID:</b> ".htmlentities(stripslashes($row['id']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>User Name:</b> ".htmlentities(stripslashes($row['username']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>Email Address:</b> ".htmlentities(stripslashes($row['email']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>IP:</b> ".htmlentities(stripslashes($row['ip']), ENT_QUOTES)."</td></tr>";
echo "<tr><td style='text-align:left'><b>Signup Date:</b> ".htmlentities(stripslashes($row['signup_date']), ENT_QUOTES)."</td></tr><br></table></center><BR>";
mysql_close();
?>
</body>
</html>