All pastes #975635 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-07 18:18 UTC
rendered paste body
<?
session_start();
$username = $_SESSION['username'];
$displayname = $_SESSION['displayname'];
include"../db.php" ;


       switch($_GET['act']){
                case 'home':
                        home();
                        break;
                case 'login':
                        login();
                        break;
                case 'invoice_manager':
                        invoice_manager();
                        break;

                case 'client_staff':
                        client_staff();
                        break;
                case 'service_packages':
                        client_staff();
                        break;
                case 'logout':
                        logout();
                        break;
                case 'account_information':
                        account_information();
                        break;
                case 'do_account_information_update':
                        do_account_information_update();
                        break;

                case 'account_information_update':
                        account_information_update();
                        break;
                case 'service_reports':
                        service_reports();
                        break;
                default:

                        home();

        }

	          function home(){
			  if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
			  $displayname = $_SESSION['displayname'];
			  include"template/top.php" ;
				$query="SELECT * FROM `content` WHERE `title` = 'gphome'";
				$result=mysql_query($query) or die(mysql_error());
				$num=mysql_numrows($result);
				$i=0;
				while ($i < $num) {
				$content = stripslashes(mysql_result($result,$i,"content"));
				$author = htmlentities(mysql_result($result,$i,"author"));
                	echo($content);
				$i++;
				}
			  include"template/bottum.php" ;
      		  }
			  
			  
			  
	          function logout(){
				session_start();
				$_SESSION = array();
				if (isset($_COOKIE[session_name()])) {
				setcookie(session_name(), '', time()-42000, '/');
				}
				session_destroy();
				echo('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
      		  }





			  
	          function login(){
				$ip = $_SERVER['REMOTE_ADDR'];
				$hostaddress = gethostbyaddr($ip);
				echo ('
						<link rel="stylesheet" href="template/css/style.css" type="text/css"/>
						<link rel="stylesheet" href="template/css/screen.css" type="text/css"/>    
						
						<style type="text/css">
						body {
						background: #e8e8e8 url(template/images/loginbg.gif) repeat-x;
						}
						.style1 {
						font-size: 36px;
						font-weight: bold;
						}
						</style>	
						
						<table height="100%" width="100%" cellpadding="0" cellspacing="0">
						<tr>
						<td align="center" valign="middle">
						<div class="style1" id="encompasslogo">G-Portal</div>
						
						<form method="post" action="login.php">
						<table cellpadding="0" cellspacing="0" border="0" width="396" height="255" class="loginTable">
						<tr><th colspan="2">
						<div class="logintext">
						Welcome user from 
						<?
						
						'.$ip.'
						?><br/>
						Please login to begin.					  </div>
						</th></tr>
						
						<tr>
						<td colspan="2">
						<table width="100%" border="0" cellpadding="0" cellspacing="0" class="loginText" >
						<tr><td colspan="3"><img src="template/images/spacer.gif" border="0" width="1" height="5"></td></tr>
						<tr>
						<td align="right" width="145">Username</td>
						<td><img src="template/images/spacer.gif" height="1" width="5"></td>
						<td align="left"><input name="username" type="text" class="input" id="username" value="" size="20" /></td>
						</tr>
						<tr><td><img src="template/images/spacer.gif" border="0" width="1" height="5"></td></tr>
						<tr>
						<td align="right">Password</td>
						<td><img src="template/images/spacer.gif" height="0" width="5"></td>
						<td align="left"><input type="password" name="password" size="20" value="" class="input" /></td>
						</tr>
						</table>							</td>
						</tr>
						<tr>
						<td height="30" colspan="2" align="center">
						<input type="submit" name="submitButton" value="Submit" onClick="javascript:closePopUp();" onMouseOver="this.className=\'buttonOver\';" onMouseOut="this.className=\'button\';" class="button" />							</td>
						</tr>
						<tr>
						<td width="198" align="center"><div align="center" style="color: #FFFFFF; font-size: 11px;" class="login">
						
						<p><img src="template/images/lock.gif" alt="Login Securely" align="top"/>
						Encrypted Login </p>
						
						
						</div></td>
						<td width="198" align="center">  <p>&nbsp;</p></td>
						</tr>						
						</table>
						</form>								
						
						<br/>		
						<div id="loginCopyright">&copy;2008 Genesis I-Tech Solutions.com. </div>
						<div style="color: orange; font-size:11px;">v1.0.0</div>
						</td>
						</tr>
						</table>');
      		  }





function service_reports(){
if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
$displayname = $_SESSION['displayname'];
$username = $_SESSION['username'];
include"template/top.php" ;
echo ('
<style type="text/css">
.style17 {color: #FFFFFF}
</style>

<fieldset><legend><strong><span class="style17">Last 30 Service Reports</span></strong></legend><br><table width="100%" border="0" cellspacing="0" cellpadding="5">') ;
$query="SELECT * FROM `service_reports` WHERE `username` = '$username' ORDER BY sr_date DESC LIMIT 30";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$crow++;
$row_color = (((1&$crow)) ? "#666666" : "#999999");
$id = stripslashes(mysql_result($result,$i,"id"));
$sr_date = stripslashes(mysql_result($result,$i,"sr_date"));
$contact = htmlentities(mysql_result($result,$i,"contact"));
$time_total = htmlentities(mysql_result($result,$i,"time_total"));
$sr_desc = htmlentities(mysql_result($result,$i,"sr_desc"));
echo('<tr bgcolor="'.$row_color.'" onmouseover="this.bgColor = \'#E68A00\'" onmouseout="this.bgColor = \''.$row_color.'\'">
<td onclick="window.location=\'service_reports.php?act='.$id.'\';" onmouseover="this.style.cursor=\'hand\';"><strong>Date: </strong>'.$sr_date.' | <strong>Billable Time : </strong>'.$time_total.' <strong>Contact: </strong>'.$contact.' <br>
<strong>SR Title:</strong> '.$sr_desc.' </td>
</tr>');
$i++;
}
echo ('</table></fieldset>') ;
include"template/bottum.php" ;

}	  



function account_information(){
if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
$displayname = $_SESSION['displayname'];
$username = $_SESSION['username'];
include"template/top.php" ;
echo ('
						<link rel="stylesheet" href="template/css/style.css" type="text/css"/>
						<link rel="stylesheet" href="template/css/screen.css" type="text/css"/>    

<style type="text/css">
.style17 {color: #FFFFFF}
</style>

<fieldset><legend><strong><span class="style17">Account Information</span></strong></legend><br>') ;
$query="SELECT * FROM `client_company` WHERE `username` = '$username'";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$id = stripslashes(mysql_result($result,$i,"id"));
$username = stripslashes(mysql_result($result,$i,"username"));
$company = htmlentities(mysql_result($result,$i,"company"));
$contact = htmlentities(mysql_result($result,$i,"name1"));
$email = htmlentities(mysql_result($result,$i,"email"));
$website = htmlentities(mysql_result($result,$i,"website"));
$address1 = htmlentities(mysql_result($result,$i,"address1"));
$address2 = htmlentities(mysql_result($result,$i,"address2"));
$city = htmlentities(mysql_result($result,$i,"city"));
$state = htmlentities(mysql_result($result,$i,"state"));
$zip = htmlentities(mysql_result($result,$i,"zip"));
$country = htmlentities(mysql_result($result,$i,"country"));
$accttype = htmlentities(mysql_result($result,$i,"accttype"));
$reg_date = htmlentities(mysql_result($result,$i,"reg_date"));
$tel = htmlentities(mysql_result($result,$i,"tel"));
$status = htmlentities(mysql_result($result,$i,"status"));
echo ('
<style type="text/css">
<!--
.style1 {
	color: #000000;
	font-weight: bold;
}
.style2 {color: #000000}
-->
</style>
<table width="100%" border="0" cellspacing="1" cellpadding="5">
  <tr>
    <td width="23%" bgcolor="#D8D8D8"><div align="right" class="style1">Status</div></td>
    <td width="27%">'.$status.'</td>
    <td width="22%" bgcolor="#D8D8D8"><div align="right" class="style1">Member Since </div></td>
    <td width="28%">'.$reg_date.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Primary Contact </div></td>
    <td>'.$contact.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Email</div></td>
    <td>'.$email.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Company</div></td>
    <td>'.$company.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Tel </div></td>
    <td>'.$tel.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Address 1</div></td>
    <td>'.$address1.'</td>
    <td><div align="right"><span class="style2"></span></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Address 2 </div></td>
    <td>'.$address2.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Sales Rep </strong></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">City</div></td>
    <td>'.$city.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Primary Engineer </strong></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">State</div></td>
    <td>'.$state.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Account Type </strong></div></td>
    <td>'.$accttype.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Zip / Postal Code </div></td>
    <td>'.$zip.'</td>
    <td><div align="right"><span class="style2"></span></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style1">Country</div></td>
    <td>'.$country.'</td>
    <td><div align="right"><span class="style2"></span></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2">				    <div align="center">
  <input type="button"
				            onmouseover="this.className=\'buttonOver\';"
							onmouseout="this.className=\'button\';"
							class="button"
							onclick="javascript:window.location=\'index.php?act=account_information_update\';loading();"
							value="Edit Account Information"/>
  &nbsp;&nbsp;
      <input type="button"
				            onmouseover="this.className=\'buttonOver\';"
							onmouseout="this.className=\'button\';"
							class="button"
							onclick="javascript:window.location=\'index.php?act_change_password\';loading();"
							value="Change Password"/>	
      &nbsp;</div></td>
    <td>&nbsp;</td>
  </tr>
</table>


') ;
$i++;
}
include"template/bottum.php" ;

}	





function account_information_update(){
if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
$displayname = $_SESSION['displayname'];
$username = $_SESSION['username'];
include"template/top.php" ;
echo ('
<style type="text/css">
.style17 {color: #FFFFFF}
</style>
						<link rel="stylesheet" href="template/css/style.css" type="text/css"/>
						<link rel="stylesheet" href="template/css/screen.css" type="text/css"/>    

<fieldset><legend><strong><span class="style17">Account Information</span></strong></legend><br>') ;
$query="SELECT * FROM `client_company` WHERE `username` = '$username'";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$id = stripslashes(mysql_result($result,$i,"id"));
$username = stripslashes(mysql_result($result,$i,"username"));
$company = htmlentities(mysql_result($result,$i,"company"));
$contact = htmlentities(mysql_result($result,$i,"name1"));
$email = htmlentities(mysql_result($result,$i,"email"));
$website = htmlentities(mysql_result($result,$i,"website"));
$address1 = htmlentities(mysql_result($result,$i,"address1"));
$address2 = htmlentities(mysql_result($result,$i,"address2"));
$city = htmlentities(mysql_result($result,$i,"city"));
$state = htmlentities(mysql_result($result,$i,"state"));
$zip = htmlentities(mysql_result($result,$i,"zip"));
$country = htmlentities(mysql_result($result,$i,"country"));
$accttype = htmlentities(mysql_result($result,$i,"accttype"));
$reg_date = htmlentities(mysql_result($result,$i,"reg_date"));
$tel = htmlentities(mysql_result($result,$i,"tel"));
$status = htmlentities(mysql_result($result,$i,"status"));
echo ('
<style type="text/css">
<!--
.style1 {
	color: #000000;
	font-weight: bold;
}
.style2 {color: #000000}
-->
</style>
<form name="form1" method="post" action="index.php?act=do_account_information_update">
  <table width="100%" border="0" cellspacing="1" cellpadding="5">
    <tr>
      <td width="23%" bgcolor="#D8D8D8"><div align="right" class="style1">Status</div></td>
      <td width="27%">'.$status.'</td>
      <td width="22%" bgcolor="#D8D8D8"><div align="right" class="style1">Member Since </div></td>
      <td width="28%">'.$reg_date.'</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Primary Contact </div></td>
      <td>'.$contact.'</td>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Email</div></td>
      <td><input name="email" type="text" id="email" value="'.$email.'" maxlength="50"></td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Company</div></td>
      <td><input name="company" type="text" id="company" value="'.$company.'"></td>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Tel </div></td>
      <td><input name="tel" type="text" id="tel" value="'.$tel.'" maxlength="50"></td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Address 1</div></td>
      <td><input name="address1" type="text" id="address1" value="'.$address1.'" maxlength="50"></td>
      <td><div align="right"><span class="style2"></span></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Address 2 </div></td>
      <td><input name="address2" type="text" id="address2" value="'.$address2.'" maxlength="50"></td>
      <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Sales Rep </strong></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">City</div></td>
      <td><input name="city" type="text" id="city" value="'.$city.'" maxlength="50"></td>
      <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Primary Engineer </strong></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">State</div></td>
      <td><input name="state" type="text" id="state" value="'.$state.'" maxlength="50"></td>
      <td bgcolor="#D8D8D8"><div align="right" class="style2"><strong>Account Type </strong></div></td>
      <td>'.$accttype.'</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Zip / Postal Code </div></td>
      <td><input name="zip" type="text" id="zip" value="'.$zip.'" maxlength="50"></td>
      <td><div align="right"><span class="style2"></span></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#D8D8D8"><div align="right" class="style1">Country</div></td>
      <td>'.$country.'</td>
      <td><div align="right"><span class="style2"></span></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><label>
        <label></label>
      </label>
      <label>
      <div align="center">
        <input type="submit" name="Submit" value="Submit">&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="Reset">
      </div>
      </label></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
') ;
$i++;
}
include"template/bottum.php" ;

}	




function client_staff(){
if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
$displayname = $_SESSION['displayname'];
$username = $_SESSION['username'];
include"template/top.php" ;
echo ('
<style type="text/css">
.style17 {color: #FFFFFF}
</style>

<style type="text/css">
.style18 {
	color: #000000;
	font-weight: bold;
}
.style2 {color: #000000}
</style>

<fieldset><legend><strong><span class="style17">Client Staff</span></strong></legend><br>') ;
$query="SELECT * FROM `client_staff` WHERE `username` = '$username' ORDER BY name1";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$id = stripslashes(mysql_result($result,$i,"id"));
$username = stripslashes(mysql_result($result,$i,"username"));
$contact = htmlentities(mysql_result($result,$i,"name1"));
$email = htmlentities(mysql_result($result,$i,"email"));
$dept = htmlentities(mysql_result($result,$i,"dept"));
$branch = htmlentities(mysql_result($result,$i,"branch"));
$tel = htmlentities(mysql_result($result,$i,"tel"));
echo ('<fieldset>
<table width="100%" border="0" cellspacing="1" cellpadding="5">
  <tr>
    <td width="23%" bgcolor="#D8D8D8"><div align="right" class="style18">Name</div></td>
    <td width="27%">'.$contact.'</td>
    <td width="22%" bgcolor="#D8D8D8"><div align="right" class="style18">Tel</div></td>
    <td width="28%">'.$tel.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style18">Department</div></td>
    <td>'.$dept.'</td>
    <td bgcolor="#D8D8D8"><div align="right" class="style18">Email</div></td>
    <td>'.$email.'</td>
  </tr>
  <tr>
    <td bgcolor="#D8D8D8"><div align="right" class="style18">Branch</div></td>
    <td>'.$branch.'</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</fieldset>
') ;
$i++;
}
include"template/bottum.php" ;
}	




	          function do_account_information_update(){
			  if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
			  $displayname = $_SESSION['displayname'];
			  $username = $_SESSION['username'];
				mysql_query("UPDATE client_company SET company = '".$_POST['company']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET address1 = '".$_POST['address1']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET address2 = '".$_POST['address2']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET city = '".$_POST['city']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET state = '".$_POST['state']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET zip = '".$_POST['zip']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET email = '".$_POST['email']."' WHERE username = '$username'");
				mysql_query("UPDATE client_company SET tel = '".$_POST['tel']."' WHERE username = '$username'");
				echo ('<meta http-equiv="refresh" content="0;URL=index.php?act=account_information">');
      		  }




function invoice_manager(){
if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=index.php?act=login">');
$displayname = $_SESSION['displayname'];
$username = $_SESSION['username'];
include"template/top.php" ;
echo ('
<style type="text/css">
.style17 {color: #FFFFFF}
</style>

<fieldset><legend><strong><span class="style17">Last 30 Service Reports</span></strong></legend><br><table width="100%" border="0" cellspacing="0" cellpadding="5">') ;
$query="SELECT * FROM `service_reports` WHERE `username` = '$username' ORDER BY sr_date DESC LIMIT 30";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$crow++;
$row_color = (((1&$crow)) ? "#666666" : "#999999");
$id = stripslashes(mysql_result($result,$i,"id"));
$sr_date = stripslashes(mysql_result($result,$i,"sr_date"));
$contact = htmlentities(mysql_result($result,$i,"contact"));
$time_total = htmlentities(mysql_result($result,$i,"time_total"));
$sr_desc = htmlentities(mysql_result($result,$i,"sr_desc"));
echo('<tr bgcolor="'.$row_color.'" onmouseover="this.bgColor = \'#E68A00\'" onmouseout="this.bgColor = \''.$row_color.'\'">
<td onclick="window.location=\'service_reports.php?act='.$id.'\';" onmouseover="this.style.cursor=\'hand\';"><strong>Date: </strong>'.$sr_date.' | <strong>Billable Time : </strong>'.$time_total.' <strong>Contact: </strong>'.$contact.' <br>
<strong>SR Title:</strong> '.$sr_desc.' </td>
</tr>');
$i++;
}
echo ('</table></fieldset>') ;
include"template/bottum.php" ;

}	  






?>