require("../inc/connect.php"); session_start();
$uname=isset($_SESSION['uname'])? $_SESSION['uname']:header("location:../login.php"); ?><!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>Untitled Document</title>
<style media="all" type="text/css">@import "../css/all.css";</style></head><body> <center><div class="container"><div class="header"> <?phpinclude("common/header.php"); ?></div><div class="top-menu"> <?phpinclude("common/top-menu.php"); ?></div><div class="side-panel"> Administrator<?phpinclude("common/side-panel.php");?></div><div class="contents"> <br /><h1>Edit Content</h1><br /> <br /><center><?php
if(isset($_POST['contentEdit'])){mysql_query("UPDATE rmcicontents SET value='".$_POST['content']."' WHERE content_code='".$_POST['c_code']."'");?> CONTENT SUCCESFULLY UPDATED<br />
<br /><a href="javascript: history.go(-2);">Back</a><?php }else if(isset($_GET['c_code'])){
$sql=mysql_query("SELECT * FROM rmcicontents WHERE content_code='{$_GET['c_code']}'"); $q=mysql_fetch_object($sql);?><form action="" method="post"><table width="500"><tr><th colspan="2">Content Information</th></tr>
<tr><td>Title</td><td><input type="text" name="c_code" value="<?php echo $_GET['c_code']; ?>" readonly="readonly" /></td></tr><tr><td colspan="2">Description</td></tr><tr>
<td colspan="2"><textarea name="content" cols="80"><?php echo $q->value; ?> </textarea></td></tr<tr>
<td colspan="2" align="center"><input type="submit" value="Save" name="contentEdit" /> <a href="javascript: history.go(-1);">Back</a></td>
</tr></table></form><?php}else{?><span style="color:#F00">No Content Selected</span<?php}?> </div><div class="footer"> <?phpinclude("common/footer.php"); ?></div></div></div></center></body></html> SETTINGS.PHP <?php require("../inc/connect.php");
Business Process Analysis 1-70
session_start();
$uname=isset($_SESSION['uname'])? $_SESSION['uname']:header("location:../login.php");?> <!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>Untitled Document</title>
<style media="all" type="text/css">@import "../css/all.css";</style> </head><body><center><div class="container"> <div class="header"><?php include("common/header.php");?></div> <div class="top-menu"><?php include("common/top-menu.php");?> </div><div class="side-panel"> Administrator<?php include("common/side-panel.php"); ?></div><div class="contents"> <br /><h1>Settings</h1></div><div class="footer"><?phpinclude("common/footer.php");? ></div></div></center></body></html> VIEW_USER.PHP <?php require("../inc/connect.php"); session_start(); $uname=isset($_SESSION['uname'])? $_SESSION['uname']:header("location:../login.php");?> <!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>Untitled Document</title>
<style media="all" type="text/css">@import "../css/all.css";</style></head><body> <center><div class="container"> <div class="header"><?php include("common/header.php");?> </div><div class="top-menu"> <?phpinclude("common/top-menu.php"); ?></div> <div class="side-panel"><?php include("common/side-panel.php"); ?></div><div class="contents"> <br /><h1>View User</h1> <table><tr><td><?php if(isset($_GET['uname'])){
Business Process Analysis 1-71
$sql=mysql_query("SELECT * FROM rmciusers INNER JOIN rmcilogin ON
(rmciusers.uname=rmcilogin.uname) WHERE rmciusers.uname='".$_GET['uname']."'"); while($row=mysql_fetch_array($sql)){
echo "<table width='500'><tr><th colspan='2'>User Information</th></tr>
<tr><th>UserName</th><td>".$row['uname']."</td></tr><tr><th>Name</th><td>".$row['lname'].', '. $row['fname'].' '.$row['mname']."</td> </tr><tr><th>Address</th><td>".$row['addr']."</td></tr><tr><th>ZIP</th><td>". $row['zip']."</td></tr><tr><th>City / Municipality </th><td>". $row['citmun']."</td></tr><tr><th>Province</th><td>".$row['prov']."</t></tr> <tr><th>Civil Status</th><td>".$row['cstat']."</td></tr><tr> <th>Gender</th><td>".$row['gender']."</td> </tr><tr><th>Birthday</th><td>".$row['bdate']."</td></tr><tr><th>Registration Date</th><td>". $row['addedDate']."</td></tr></table>";}?;</td><td><table width="500"> <tr><th colspan="3">Contact Information</th> </tr><tr><th>#</th><th>Type</th><th>Detail</th></tr><?php
$sql=mysql_query("SELECT * FROM rmcicontactinfo WHERE owner_code='".$_GET['uname']."'"); for($i=1;$row=mysql_fetch_array($sql);$i++){
echo "<tr>
<td>".$i."</td><td>".$row['type']."</td><td>".$row['detail']."</td></tr>";}?
></table</td></tr></table><?php}else{?><center><span style="color:#F00;"> No User Selected </span>
</center><?php}?><br /><br />
<a href="javascript: history.go(-1);">Back</a> </div><div class="footer"><?php include("common/footer.php"); ?></div></div></center></body></html> CLIENTS.PHP <?php require("../inc/connect.php"); session_start(); $uname=isset($_SESSION['uname'])? $_SESSION['uname']:header("location:../login.php");?> <!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>Rational Merchandising Concepts Inc</title><style media="all" type="text/css">@import "../css/all.css";</style>
<script type="text/javascript">function confirmUserDelete(uname){var sure=confirm("Are you sure you want to Delete This User?");if(sure==false){return;}
window.location="delete_user.php?uname="+uname;}</script></head> <body><center><div class="container">
<div class="header"><?php include("common/header.php");?> </div><div class="top-menu">
Business Process Analysis 1-72
<?phpinclude("common/top-menu.php"); ?></div><div class="side-panel"> Administrator<?php include("common/side-panel.php");?> </div><div class="contents"><br /> <h1>Clients</h1><center><?php $start=isset($_GET['start'])?$_GET['start']:0; $recperpage=10;
$sql=mysql_query("SELECT * FROM rmciclients INNER JOIN rmcilogin ON
(rmciclients.uname=rmcilogin.uname) WHERE rmcilogin.ulevel=1 LIMIT $start , $recperpage"); $next=$start+$recperpage;
$prev=$start-$recperpage-1;
$first=0;$last=mysql_num_rows(mysql_query("SELECT * FROM rmciclients"))-1; ?><a href="clients.php?start=<?php echo $first; ?>"> |< </a> <a href="clients.php?start=<?php $tmp=$prev<0?0:$prev; echo $tmp; ?>"> <<
</a> <a href="clients.php?start=<?php echo $next; ?>"> >> </a>
<a href="clients.php?start=<?php echo $last; ?>"> >| </a><table width="80%" style="text- align:center;" border="1" cellpadding="0" cellspacing="0"><tr><th>#</th><th>User Name</th><th>Name</th><th>Address</th><th>Date Registered</th><th>Action</th> </tr><?phpfor($i=$start+1;$row=mysql_fetch_array($sql);$i++){echo '<tr><td>'.$i.'</td><td>'. $row['uname'].'</td><td>'.$row['name'].'</td><td>'.$row['addr'].'</td><td>'. $row['addedDate'].'</td><td><a href="#"onClick="confirmUserDelete(\''. $row['uname'].'\')">Del</a></td></tr>';}?></table> </center></div><div class="footer"><?php include("common/footer.php");?></div> </div></center></body></html> EDIT_USER.PHP <?php require("../inc/connect.php"); session_start();$err=""; isset($_SESSION['uname'])?null:header("location:../login.php");if(isset($_POST['editUser'])){ $uname=$_POST['uname'];$lname="";$fname="";$mname="";$addr="";$zip="";$citmun=""; $prov="";$stat=$_POST['stat'];$gender=$_POST['gender'];$bdate=$_POST['byear']."". $_POST['bmonth']."".$_POST['bday'];$email="";$lline="";$mphone="";$fax="";$_POST['lname']! =""?$lname=$_POST['lname']:$err.="Please include contact's last name<br />";preg_match('/^[A-Za- z
]{'.strlen($lname).'}/',$lname)?null:$err.="Invalid Last name<br />";
$_POST['fname']!=""?$fname=$_POST['fname']:$err.="Please include contact's First name<br />";preg_match('/^[A-Za-z0-9 ]{'.strlen($fname).'}/',$fname)?null:$err.="Invalid First name<br />"$mname=$_POST['mname'];
preg_match('/^[A-Za-z0-]{'.strlen($mname).'}/',$mname)?null:$err.="Invalid Middle name<br />"; $_POST['addr']!=""?$addr=$_POST['addr']:$err.="Please include contact's address<br />";
Business Process Analysis 1-73
preg_match('/^[A-Za-z0-9\#\-\_\.\, ]{'.strlen($addr).'}/',$addr)?null:$err.="Address is invalid<br />"; $zip=$_POST['zip'];
preg_match('/^[09]{'.strlen($zip).'}/',$zip)?null:$err.="Only numbers are allowed for ZIP<br/>"; $citmun=$_POST['citmun'];preg_match('/^[A-Za-z ]{'.strlen($citmun).'}/',$citmun)?null:$err.="You entered an Invalid City or Municipality<br/>";
$prov=$_POST['prov'];preg_match('/^[A-Za-z ]{'.strlen($prov).'}/',$prov)?null:$err.="You entered an Invalid Province name<br/>";
for($i=1;isset($_POST['email$i']);$i++){preg_match('/^[A-Za-z0-9-_@.]{'.strlen($_POST['email'. $i]).'}/',strlen($_POST['email'.$i]))?null:$err.="You entered an Invalid e-mail<br/>";}if($err=="") {$sql="DELETE FROM rmciusers WHERE uname='$uname'";
mysql_query($sql);$sql="DELETE FROM rmcicontactinfo WHERE owner_code='$uname'";mysql_query($sql);
$sql="INSERT rmciusers VALUES ('$uname', '$lname', '$fname', '$mname', '$addr', '$zip', '$citmun', '$prov', '$stat', '$gender', '$bdate', curdate())";mysql_query($sql);for($i=1;isset($_POST['email'.$i]); $i++){$sql="INSERT rmcicontactinfo VALUES
('','$uname','email','".$_POST['email'.$i]."')"; $_POST['email'.$i]!=""?mysql_query($sql):null; for($i=1;isset($_POST['lline'.$i]);$i++){
$sql="INSERT rmcicontactinfo VALUES ('','$uname','lline','".$_POST['lline'.$i]."')"; $_POST['lline'.$i]!=""?mysql_query($sql):null;}
for($i=1;isset($_POST['mphone'.$i]);$i++){
$sql="INSERT rmcicontactinfo VALUES ('','$uname','mphone','".$_POST['mphone'.$i]."')";
$_POST['mphone'.$i]!=""?mysql_query($sql):null;}$err="<span style='color:blue'>User Information Succesfully Updated</span>";
}?>
<!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>Untitled Document</title>
<style media="all" type="text/css">@import "../css/all.css";</style></head><body> <center><div class="container"> <div class="header"><?php include("common/header.php"); ?></div><div class="top-menu"> <?phpinclude("common/top-menu.php"); ?></div><div class="side-panel"> Administrator<?php include("common/side-panel.php"); ?></div><div class="contents"> <br /><h1>Edit User</h1>
<span style="color:#F00; margin-left:20px;"><?php echo $err; ?></span>
<?phpif(isset($_GET['uname'])||isset($_POST['uname'])){$uname=isset($_GET['uname'])?
$_GET['uname']:$_POST['uname'];$lname="";$fname="";$mname="";$addr="";$zip="";$citmun=""; $prov="";$stat="";$gender="";$bmon="";$bday="";$byear="";
$r=mysql_fetch_object(mysql_query("SELECT * FROM rmciusers WHERE uname='".$uname."'"));
Business Process Analysis 1-74
$lname=$r->lname;$fname=$r->fname;$mname=$r->mname;$addr=$r->addr;$zip=$r->zip; $citmun=$r->citmun;$prov=$r->prov;
$stat=$r->cstat;$gender=$r->gender; $bmon=substr($r->bdate,5,2);
$bday=substr($r->bdate,8,2);$byear=substr($r->bdate,0,4);}?> <form action="edit_user.php" method="post">
<table cellpadding="0" cellspacing="0" class="listing form" style="text-align:left; margin- left:20px;"><tr><th colspan="4">Edit User Information</th></tr><tr><td>User Name</td><td colspan="3" style="text-align:left;"><input type="text" name="uname" readonly="readonly" value="<?php echo $uname; ?>"/></td></tr><tr>
<td>Last Name*<span id="fnameCheck" class="err"></span><br/><input type="text" name="lname"onkeyup="validateThis('name',this.value,'fnameCheck')" value="<?php $tmp=isset($lname)?$lname:""; echo $tmp; ?>" /></td>
<td>First Name*<span id="lnameCheck" class="err"></span><br/><input type="text" name="fname"onkeyup="validateThis('name',this.value,'lnameCheck')" value="<?php
$tmp=isset($fname)?$fname:""; echo $tmp; ?>" /></td><td colspan="2">Middle Name <span id="mnameCheck" class="err"></span><br/><input type="text"
name="mname"onkeyup="validateThis('mname',this.value,'mnameCheck')" value="<?php $tmp=isset($mname)?$mname:""; echo $tmp; ?>" /></td></tr><tr><td
colspan="4">Address*<br/><input size="60" type="text" name="addr"
onkeyup="validateThis('addr',this.value,'addrCheck')" value="<?php $tmp=isset($addr)?$addr:""; echo $tmp; ?>" /> <span id="addrCheck" class="err"></span></tr><tr><td colspan="4"> <table cellpadding="0"cellspacing="0"><tr><td>
ZIP <span id="zipCheck" class="err"></span><br/><input type="text" name="zip" size="4" maxlength="4" onkeyup="validateThis('numbers',this.value,'zipCheck')" value="<?php
$tmp=isset($zip)?$zip:""; echo $tmp; ?>" /></td><td>City/Municipality <span id="citmunCheck"class="err"></span><br/><input type="text" name="citmun"
onkeyup="validateThis('noSpCharWithNum',this.value,'citmunCheck')" value="<?php $tmp=isset($citmun)?$citmun:""; echo $tmp; ?>" /></td><td>Province <span id="provCheck"class="err"></span><br/><input type="text" name="prov"
onkeyup="validateThis('noSpCharWithNum',this.value,'provCheck')" value="<?php $tmp=isset($prov)?$prov:""; echo $tmp; ?>" /></td></tr></table></td></tr><tr><td> Status<br/> <input type="radio" name="stat" value="Single" <?php
$tmp=$stat=="Single"?"CHECKED":""; echo $tmp; ?> />Single<br/> <input type="radio" name="stat" value="Married" <?php $tmp=$stat=="Married"?"CHECKED":""; echo $tmp; ?> />Married<br/>
<input type="radio" name="stat" value="wid" <?php
$tmp=$stat=="wid"?"CHECKED":""; echo $tmp; ?> />Widow/er</td><td>Gender<br/><input type="radio" name="gender" value="male"
<?php $tmp=$gender=="male"?"CHECKED":""; echo $tmp; ?>/>Male<input type="radio" name="gender" value="female"<?php $tmp=$gender=="female"?"CHECKED":""; echo $tmp; ?> />Female</td><td colspan="2">Birthday<br/><table cellpadding="0" cellspacing="0"><tr> <td><select name="bmonth"><?php
$mon=array("January","Febuary","March","April","May","June","July","August","September","Octo ber","November","December");$i=0;while($i<12){echo "<option value='".($i+1)."' ";
Business Process Analysis 1-75
$tmp=$bmon=="".$i+1||$bmon=="0".$i+1?"SELECTED":""; echo $tmp;echo " > ". $mon[$i]."</option>";$i++;}?></select></t><td><select name="bday"><?php$i=31; while($i>0){echo "<option ".$tmp=$bday==$i?" SELECTED":""; echo $tmp;echo " >". $i."</option>";$i--;}?></select></td><td>
<select name="byear"><?php$i=1930; while($i<gmdate("Y")){echo "<option ";
$tmp=$byear==$i?" SELECTED":""; echo $tmp; echo " >".$i."</option>";$i++;}?></select>
</td></tr></table</td></tr><tr><td colspan="4">Email<br />
<?php$sql=mysql_query("SELECT * FROM rmcicontactinfo WHERE owner_code='".$uname."' AND type='email'");
for($i=1;$row=mysql_fetch_array($sql);$i++){
?> <input type="text" name="email<?php echo $i; ?>"
onblur="validateThis('email',this.value,'emailCheck')" value="<?php echo $row['detail']; ?>" /><span id="emailCheck" class="err"></span>
<?php}?></td></tr> <tr><td colspan="4">Landline<br /><?php
$sql=mysql_query("SELECT * FROM rmcicontactinfo WHERE owner_code='".$uname."' AND type='lline'");
for($i=1;$row=mysql_fetch_array($sql);$i++){
?> <input type="text" name="lline<?php echo $i; ?>" value="<?php echo $row['detail']; ?>" /><?php}?></td></tr>
<tr><td colspan="4">Mobile Phone<br /><?php$sql=mysql_query("SELECT * FROM rmcicontactinfo WHERE owner_code='".$uname."'
ANDtype='mphone'");for($i=1;$row=mysql_fetch_array($sql);$i++){?> <input type="text" name="mphone<?php echo $i; ?>" value="<?php echo $row['detail']; ?>" /><?php} ?> </td></tr><tr><td colspan="4" align="right">
<input type="submit" value="Submit" name="editUser" /><input type="reset" value="Clear All" /></td> </tr></table></form>
<a href="javascript: history.go(<?php $tmp=isset($_POST['editUser'])?"-2":"-1"; echo $tmp; ? >);">Back</a></div><div class="footer"> <?phpinclude("common/footer.php");?></div></div></div></center></body></html> USERS.PHP <?php require("../inc/connect.php"); session_start(); $uname=isset($_SESSION['uname'])? $_SESSION['uname']:header("location:../login.php");?> <!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>Untitled Document</title>
<style media="all" type="text/css">@import
"../css/all.css";</style><scripttype="text/javascript">function confirmUserDelete(uname){var sure=confirm("Are you sure you want to Delete This User?");if(sure==false){return;}
Business Process Analysis 1-76
window.location="delete_user.php? uname="+uname;}</script></head><body><center><divclass="container"><div class="header"><? php include("common/header.php");?></div> <div class="top-menu"><?php include("common/top-menu.php");?></div> <div class="side-panel">Administrator <?phpinclude("common/side-panel.php"); ?></div><div class="contents"><br /> <h1>Users</h1><center><?php $start=isset($_GET['start'])?$_GET['start']:0;
$recperpage=10;$sql=mysql_query("SELECT * FROM rmciusers INNER JOIN rmcilogin ON (rmciusers.uname=rmcilogin.uname) WHERE rmcilogin.ulevel=2 LIMIT $start , $recperpage"); $next=$start+$recperpage;$prev=$start-$recperpage-1;$first=0;