Jump to content


Photo

Im about ready to pull my hair out


  • Please log in to reply
4 replies to this topic

#1 NuStar

NuStar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 January 2004 - 03:59 AM

I have a login form
Username/password

user logs in
goes to admin.php page

on the admin.php page, I have/want something like this

Welcome {User's First Name}.

how do I program this in dreamweaver?

I have dw mx 2004

please help

I am using php/mysql

the login.php checks username/password


Thanks

jeff

#2 NuStar

NuStar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 January 2004 - 04:29 AM

<?php require_once('Connections/Home1st.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin.php";
$MM_redirectLoginFailed = "failed_login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Home1st, $Home1st);

$LoginRS__query=sprintf("SELECT UserName, Password FROM employee WHERE UserName='%s' AND Password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $Home1st) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;

//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>

#3 NuStar

NuStar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 January 2004 - 04:30 AM

<html>
<head>
<title>Log-in</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.style2 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="743" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="345" height="98">&nbsp;</td>
<td width="398"><img src="images/logo.jpg" width="250" height="110">&nbsp;</td>
</tr>
<tr>
<td height="184"><!--DWLayoutEmptyCell-->&nbsp; </td>
<td valign="top"><form action="<?php echo $loginFormAction; ?>" method="POST" name="login" id="login">
<table width="62%" border="1">
<tr bgcolor="#000000">
<td colspan="2"><span class="style2">Log-In </span></td>
</tr>
<tr>
<td><strong>Username:</strong></td>
<td><strong>
<input name="username" type="text" id="username">
</strong></td>
</tr>
<tr>
<td><strong>Password:</strong></td>
<td><input name="password" type="password" id="password"></td>
</tr>
</table>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="Submit" value="Log-In">
<input name="reset" type="reset" id="reset" value="Reset">
</p>
</form></td>
</tr>
</table>
</body>
</html>

#4 NuStar

NuStar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 January 2004 - 04:32 AM

code from admin.php page

<?php require_once('Connections/Home1st.php'); ?>
<?php
//initialize the session
session_start();

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
session_unregister('MM_Username');
session_unregister('MM_UserGroup');

$logoutGoTo = "login.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
mysql_select_db($database_Home1st, $Home1st);
$query_rsUsername = "SELECT * FROM employee";
$rsUsername = mysql_query($query_rsUsername, $Home1st) or die(mysql_error());
$row_rsUsername = mysql_fetch_assoc($rsUsername);
$totalRows_rsUsername = mysql_num_rows($rsUsername);
?>
<html>
<head>
<title>Log-in</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-style: italic;
}
-->
</style>
</head>

<body>
<table width="781" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="250" rowspan="2" valign="top"><img src="images/logo.jpg" width="250" height="125"></td>
<td width="471" height="27">&nbsp;</td>
<td width="60" valign="top"><div align="right">
<p><a href="<?php echo $logoutAction ?>">Logout</a></p>
</div></td>
</tr>
<tr>
<td height="98">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="19">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="242" colspan="3" valign="top"><p>Welcome {First Name}.</p>
<p>Admin Section</p> <p><a href="addemployee.php">Add New Employee</a><br>
<a href="viewemployees.php">View Employees<br>
</a>Edit Employees</p>
<p>Create Work Order Request <br>
Edit Work Order Request</p>
<p>Create Membership Agreement</p></td>
</tr>
</table>

</body>
</html>
<?php
mysql_free_result($rsUsername);
?>


#5 NuStar

NuStar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 January 2004 - 05:03 AM

<?php echo ucfirst($row_rsUsername['FirstName']); ?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users