Jump to content

Im about ready to pull my hair out


Recommended Posts

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

Link to comment
Share on other sites

<?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 );

}

}

?>

Link to comment
Share on other sites

<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"> </td>

<td width="398"><img src="images/logo.jpg" width="250" height="110"> </td>

</tr>

<tr>

<td height="184"><!--DWLayoutEmptyCell-->  </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>

                                 <input type="submit" name="Submit" value="Log-In">

<input name="reset" type="reset" id="reset" value="Reset">

</p>

</form></td>

</tr>

</table>

</body>

</html>

Link to comment
Share on other sites

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"> </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"> </td>

<td> </td>

</tr>

<tr>

<td height="19"> </td>

<td> </td>

<td> </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);

?>

 

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.