[Simplesheet-commits] SF.net SVN: simplesheet: [4] trunk
Status: Inactive
Brought to you by:
ronaldmaas
|
From: <ron...@us...> - 2007-07-21 11:28:38
|
Revision: 4
http://simplesheet.svn.sourceforge.net/simplesheet/?rev=4&view=rev
Author: ronaldmaas
Date: 2007-07-21 04:28:35 -0700 (Sat, 21 Jul 2007)
Log Message:
-----------
Intermediate commit. Work in progress to get a working copy suitable for demo purposes.
Modified Paths:
--------------
trunk/activityreport.php
trunk/admin/accessgroupadmin.php
trunk/admin/accessgroupfileadmin.php
trunk/admin/agentadmin.php
trunk/admin/customeradmin.php
trunk/admin/eventtypeadmin.php
trunk/admin/ihadmin.php
trunk/admin/index.php
trunk/admin/payinstadmin.php
trunk/admin/projectadmin.php
trunk/admin/ticketprioradmin.php
trunk/admin/ticketstateadmin.php
trunk/billing.php
trunk/cashflowreport.php
trunk/createinvoice.php
trunk/db.php
trunk/footer.php
trunk/header.php
trunk/index.php
trunk/listinvoice.php
trunk/oireport.php
trunk/postpayment.php
trunk/reports.php
trunk/revenuereport.php
trunk/showticket.php
trunk/styles.php
trunk/ticketaction.php
trunk/ticketing.php
trunk/tickettrack.sql
Modified: trunk/activityreport.php
===================================================================
--- trunk/activityreport.php 2007-07-20 12:48:26 UTC (rev 3)
+++ trunk/activityreport.php 2007-07-21 11:28:35 UTC (rev 4)
@@ -1,358 +1,382 @@
-<?
- include("header.php");
-
- if ($nextstep == "") {
- do_step1();
- } elseif ($nextstep == "2") {
- do_step2();
- }
-
- include("footer.php");
-
-function do_step1 () {
- global $conn;
-
- $result = pg_Exec($conn, "SELECT customerid,company_name from customer order by company_name");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
-<p>Available Functions</p>
-<a href="reports.php">Reports Home</a><br><br>
-
-Please select either a company to report on, an agent to report on, or both to generate an Activity Report.
-<form action="activityreport.php" method="post" target="reportwindow">
-<input type="hidden" name="nextstep" value="2">
-<select name="customerid">
-<option value="">All Companies
-<?
- $x = 0;
- while($row = @pg_fetch_object($result,$x)) {
- $x++;
-?>
- <option value="<? echo $row->customerid; ?>"><? echo $row->company_name; ?>
-<?
- }
-?>
-
-</select>
-<br>
-<select name="agentid">
-<option value="">All Agents
-<?
- $result = pg_Exec($conn, "SELECT agentid,name from agents order by name");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
- $x = 0;
- while($row = @pg_fetch_object($result,$x)) {
- $x++;
-?>
- <option value="<? echo $row->agentid; ?>"><? echo $row->name; ?>
-<?
- }
-?>
-
-</select><br>
-<Br>
-<table border=0>
-<tr><td>From: </td><td>
- <SELECT NAME="month">
- <OPTION VALUE="1">January
- <OPTION VALUE="2">February
- <OPTION VALUE="3">March
- <OPTION VALUE="4">April
- <OPTION VALUE="5">May
- <OPTION VALUE="6">June
- <OPTION VALUE="7">July
- <OPTION VALUE="8">August
- <OPTION VALUE="9">September
- <OPTION VALUE="10">October
- <OPTION VALUE="11">November
- <OPTION VALUE="12">December
- </SELECT>
- <SELECT NAME="day">
- <OPTION VALUE="1">1
- <OPTION VALUE="2">2
- <OPTION VALUE="3">3
- <OPTION VALUE="4">4
- <OPTION VALUE="5">5
- <OPTION VALUE="6">6
- <OPTION VALUE="7">7
- <OPTION VALUE="8">8
- <OPTION VALUE="9">9
- <OPTION VALUE="10">10
- <OPTION VALUE="11">11
- <OPTION VALUE="12">12
- <OPTION VALUE="13">13
- <OPTION VALUE="14">14
- <OPTION VALUE="15">15
- <OPTION VALUE="16">16
- <OPTION VALUE="17">17
- <OPTION VALUE="18">18
- <OPTION VALUE="19">19
- <OPTION VALUE="20">20
- <OPTION VALUE="21">21
- <OPTION VALUE="22">22
- <OPTION VALUE="23">23
- <OPTION VALUE="24">24
- <OPTION VALUE="25">25
- <OPTION VALUE="26">26
- <OPTION VALUE="27">27
- <OPTION VALUE="28">28
- <OPTION VALUE="29">29
- <OPTION VALUE="30">30
- <OPTION VALUE="31">31
- </SELECT>
- <SELECT NAME="year">
- <OPTION VALUE="2000">2000
- <OPTION VALUE="2001">2001
- <OPTION VALUE="2002">2002
- <OPTION VALUE="2003">2003
- <OPTION VALUE="2004">2004
- <OPTION VALUE="2005">2005
- <OPTION VALUE="2006">2006
- </SELECT></td></tr>
-<tr><td>To:</td><td><SELECT NAME="month2">
- <OPTION VALUE="1">January
- <OPTION VALUE="2">February
- <OPTION VALUE="3">March
- <OPTION VALUE="4">April
- <OPTION VALUE="5">May
- <OPTION VALUE="6">June
- <OPTION VALUE="7">July
- <OPTION VALUE="8">August
- <OPTION VALUE="9">September
- <OPTION VALUE="10">October
- <OPTION VALUE="11">November
- <OPTION VALUE="12">December
- </SELECT>
- <SELECT NAME="day2">
- <OPTION VALUE="1">1
- <OPTION VALUE="2">2
- <OPTION VALUE="3">3
- <OPTION VALUE="4">4
- <OPTION VALUE="5">5
- <OPTION VALUE="6">6
- <OPTION VALUE="7">7
- <OPTION VALUE="8">8
- <OPTION VALUE="9">9
- <OPTION VALUE="10">10
- <OPTION VALUE="11">11
- <OPTION VALUE="12">12
- <OPTION VALUE="13">13
- <OPTION VALUE="14">14
- <OPTION VALUE="15">15
- <OPTION VALUE="16">16
- <OPTION VALUE="17">17
- <OPTION VALUE="18">18
- <OPTION VALUE="19">19
- <OPTION VALUE="20">20
- <OPTION VALUE="21">21
- <OPTION VALUE="22">22
- <OPTION VALUE="23">23
- <OPTION VALUE="24">24
- <OPTION VALUE="25">25
- <OPTION VALUE="26">26
- <OPTION VALUE="27">27
- <OPTION VALUE="28">28
- <OPTION VALUE="29">29
- <OPTION VALUE="30">30
- <OPTION VALUE="31">31
- </SELECT>
- <SELECT NAME="year2">
- <OPTION VALUE="2000">2000
- <OPTION VALUE="2001">2001
- <OPTION VALUE="2002">2002
- <OPTION VALUE="2003">2003
- <OPTION VALUE="2004">2004
- <OPTION VALUE="2005">2005
- <OPTION VALUE="2006">2006
- </SELECT>
-</td></tr></table>
-<br><br>
-<input type="submit" value="Generate Report">
-</form>
-
-<? pg_close($conn);
-
-}
-
-function do_step2 () {
- global $conn, $agentid, $month, $day, $year, $month2, $day2, $year2, $customerid;
-
- if ($agentid != "") {
- $agentWhere = " AND ticketevent.agentid = $agentid ";
- }
- if ($customerid != "") {
- $companyWhere = " AND customer.customerid = $customerid ";
- }
-
- $result = pg_Exec($conn, "SELECT agents.name, customer.company_name, projects.name as projectname, ticket.ticketnumber, ticket.taskdescription, ticketevent.timespent, ticketevent.billable, ticketevent.rate, ticketevent.timestamp, ticketevent.customerdetail from ticket,ticketevent,projects,customer WHERE ticketevent.agentid = agents.agentid AND customer.customerid = projects.customerid AND projects.projectid = ticket.projectid $companyWhere $agentWhere AND ticketevent.invoicenumber <> 0 AND (ticketevent.timestamp BETWEEN '$month/$day/$year' AND '$month2/$day2/$year2 11:59:59 PM') AND ticketevent.ticketnumber = ticket.ticketnumber ORDER BY ticketevent.timestamp");
-
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-
- if (pg_numrows($result) == 0) {
- echo "There was no activity for that agent during that timeframe.";
- exit;
- }
- $linecount = 0;
-?>
-
-<center>
-<!--<img src="latuslogo.jpg"><br>-->
-<? if ($customerid != "") {echo "<font size=+2><b>".pg_Result($result, 0, "company_name")."</b></font><br>";} ?>
-<? if ($agentid != "") {echo "<font size=+2><b>".pg_Result($result, 0, "name")."</b></font><br>";} ?>
-<b>Activity Report</b><br>
-<? echo $month."/".$day."/".$year." - ".$month2."/".$day2."/".$year2;?><br>
-<br>
-
-<table border=0 cellpadding=0 cellspacing=0 width="85%"bgcolor=#000000>
-<tr>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="120">
- <font color="#ffffff">Date</font>
- </th>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="45">
- <font color="#ffffff">Ticket #</font>
- </th>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="5">
- </th>
- <th bgcolor=#000000>
- <font color="#ffffff">Agent / Company</font>
- </th>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="5">
- </th>
- <th bgcolor=#000000>
- <font color="#ffffff">Description</font>
- </th>
- <th bgcolor=#000000 width="5">
- </th>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="45">
- <font color="#ffffff">Time</font>
- </th>
- <th bgcolor=#000000 width="1">
- </th>
- <th bgcolor=#000000 width="85">
- <font color="#ffffff">Amount Billed</font>
- </th>
- <th bgcolor=#000000 width="1">
- </th>
-</tr>
-<?
- $bgcolor = "#FFFFFF";
- $moneytotal = 0;
- $timetotal = 0;
- $x = 0;
- while($row = @pg_fetch_object($result,$x)) {
- $x++;
- $timetotal += $row->timespent;
-?>
-<tr>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top>
- <?
- list($myDate,$junk) = split(' ',$row->timestamp);
- list($myYear,$myMonth,$myDay) = split ('-', $myDate);
- echo date("F j, Y", mktime(1,0,0,$myMonth,$myDay,$myYear));
- ?>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top align=middle>
- <a href="showticket.php?ticketnumber=<? echo $row->ticketnumber; ?>"><? echo $row->ticketnumber; ?></a>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" width="5">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top>
- <b><? if ($agentid == "") {echo $row->name;}?></b><? if ($agentid == "" && $customerid == "") {echo " / ";} if ($customerid == "") {echo $row->company_name.":";} ?> <? echo $row->projectname;?>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" width="5">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top>
- <b><? echo $row->taskdescription; ?></b> - <? echo $row->customerdetail; ?>
- </td>
- <td bgcolor="<? echo $bgcolor;?>" width="5">
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top align=middle>
- <? echo $row->timespent; ?>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td bgcolor="<? echo $bgcolor;?>" valign=top align=right>
- <?
- if ($row->billable == "t") {
- $moneytotal += $row->timespent * $row->rate;
- ?>
- $<? echo number_format(($row->timespent * $row->rate),2); ?>
- <?
- } else {
- ?>
- N/A
- <?
- }
- ?>
- </td>
-</tr>
-<?
- if ($bgcolor == "#FFFFFF") {
- $bgcolor = "#DDDDDD";
- } else {
- $bgcolor = "#FFFFFF";
- }
- }
-?>
-<tr>
- <td height=1 colspan=11>
- </td>
-</tr>
-<tr>
- <td colspan=11 align=right bgcolor="#ffffff">
- <b>Totals:</b>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td valign=right bgcolor="#ffffff" align=middle>
- <b><?echo $timetotal;?></b>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
- <td valign=right bgcolor="#ffffff" align=right>
- <b>$<? echo number_format($moneytotal,2); ?></b>
- </td>
- <td bgcolor=#000000 width="1">
- </td>
-</tr>
-<tr>
- <td height=1 colspan=11 bgcolor="#ffffff">
- </td>
- <td height=1 colspan=3>
- </td>
-</tr>
-</table>
-
-<?
-pg_close($conn);
-}
-?>
+<?php
+
+ include("header.php");
+
+ $nextstep = $_REQUEST["nextstep"];
+
+ if ($nextstep == "") {
+ do_step1();
+ } elseif ($nextstep == "2") {
+ do_step2();
+ }
+
+ include("footer.php");
+
+ function do_step1 () {
+ $result = mysql_query( "SELECT customerid,company_name from customer order by company_name");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+?>
+<p>Available Functions</p>
+<a href="reports.php">Reports Home</a><br><br>
+
+Please select either a company to report on, an agent to report on, or both to generate an Activity Report.
+<form action="activityreport.php" method="post" target="reportwindow">
+<input type="hidden" name="nextstep" value="2">
+<select name="customerid">
+<option value="">All Companies
+<?php
+ while($row = mysql_fetch_array($result)) {
+?>
+ <option value="<? echo $row["customerid"]; ?>"><? echo $row["company_name"]; ?>
+<?php
+ }
+?>
+
+</select>
+<br>
+<select name="agentid">
+<option value="">All Agents
+<?php
+ $result = mysql_query("SELECT agentid,name from agents order by name");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+ while($row = mysql_fetch_array($result)) {
+?>
+ <option value="<? echo $row["agentid"]; ?>"><? echo $row["name"]; ?>
+<?php
+ }
+?>
+
+</select><br>
+<Br>
+<table border=0>
+<tr><td>From: </td><td>
+<select name="month">
+ <option value="1">January
+ <option value="2">February
+ <option value="3">March
+ <option value="4">April
+ <option value="5">May
+ <option value="6">June
+ <option value="7">July
+ <option value="8">August
+ <option value="9">September
+ <option value="10">October
+ <option value="11">November
+ <option value="12">December
+</select>
+<select name="day">
+ <option value="1">1
+ <option value="2">2
+ <option value="3">3
+ <option value="4">4
+ <option value="5">5
+ <option value="6">6
+ <option value="7">7
+ <option value="8">8
+ <option value="9">9
+ <option value="10">10
+ <option value="11">11
+ <option value="12">12
+ <option value="13">13
+ <option value="14">14
+ <option value="15">15
+ <option value="16">16
+ <option value="17">17
+ <option value="18">18
+ <option value="19">19
+ <option value="20">20
+ <option value="21">21
+ <option value="22">22
+ <option value="23">23
+ <option value="24">24
+ <option value="25">25
+ <option value="26">26
+ <option value="27">27
+ <option value="28">28
+ <option value="29">29
+ <option value="30">30
+ <option value="31">31
+</select>
+<select name="year">
+ <option value="2006">2006
+ <option value="2007">2007
+ <option value="2008">2008
+ <option value="2009">2009
+ <option value="2010">2010
+ <option value="2011">2011
+ <option value="2012">2012
+</select></td></tr>
+<tr><td>To:</td><td><select name="month2">
+ <option value="1">January
+ <option value="2">February
+ <option value="3">March
+ <option value="4">April
+ <option value="5">May
+ <option value="6">June
+ <option value="7">July
+ <option value="8">August
+ <option value="9">September
+ <option value="10">October
+ <option value="11">November
+ <option value="12">December
+</select>
+<select name="day2">
+ <option value="1">1
+ <option value="2">2
+ <option value="3">3
+ <option value="4">4
+ <option value="5">5
+ <option value="6">6
+ <option value="7">7
+ <option value="8">8
+ <option value="9">9
+ <option value="10">10
+ <option value="11">11
+ <option value="12">12
+ <option value="13">13
+ <option value="14">14
+ <option value="15">15
+ <option value="16">16
+ <option value="17">17
+ <option value="18">18
+ <option value="19">19
+ <option value="20">20
+ <option value="21">21
+ <option value="22">22
+ <option value="23">23
+ <option value="24">24
+ <option value="25">25
+ <option value="26">26
+ <option value="27">27
+ <option value="28">28
+ <option value="29">29
+ <option value="30">30
+ <option value="31">31
+</select>
+<select name="year2">
+ <option value="2006">2006
+ <option value="2007">2007
+ <option value="2008">2008
+ <option value="2009">2009
+ <option value="2010">2010
+ <option value="2011">2011
+ <option value="2012">2012
+</select>
+</td></tr></table>
+<br><br>
+<input type="submit" value="Generate Report">
+</form>
+
+<?php
+
+ }
+
+ function do_step2 () {
+
+ $agentid = $_REQUEST["agentid"];
+ $month = $_REQUEST["month"];
+ $day = $_REQUEST["day"];
+ $year = $_REQUEST["year"];
+ $month2 = $_REQUEST["month2"];
+ $day2 = $_REQUEST["day2"];
+ $year2 = $_REQUEST["year2"];
+ $customerid = $_REQUEST["customerid"];
+
+ if ($agentid != "") {
+ $agentWhere = " AND ticketevent.agentid = $agentid ";
+ }
+ if ($customerid != "") {
+ $companyWhere = " AND customer.customerid = $customerid ";
+ }
+ $result = mysql_query( "SELECT agents.name, customer.company_name, projects.name as projectname, ticket.ticketnumber, ticket.taskdescription, ticketevent.timespent, ticketevent.billable, ticketevent.rate, ticketevent.timestamp, ticketevent.customerdetail from ticket,ticketevent,projects,customer,agents WHERE ticketevent.agentid = agents.agentid AND customer.customerid = projects.customerid AND projects.projectid = ticket.projectid $companyWhere $agentWhere AND ticketevent.invoicenumber <> 0 AND (ticketevent.timestamp BETWEEN '$year-$month-$day' AND '$year2-$month2-$day2 23:59:59') AND ticketevent.ticketnumber = ticket.ticketnumber ORDER BY ticketevent.timestamp");
+
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+
+ if (mysql_num_rows($result) == 0) {
+ echo "There was no activity for that agent during that timeframe.";
+ exit;
+ }
+ $linecount = 0;
+?>
+
+<center>
+<!--<img src="latuslogo.jpg"><br>-->
+<?php
+ $row = mysql_fetch_array($result);
+ if ($customerid != "") {echo "<font size=+2><b>".$row["company_name"]."</b></font><br>";}
+ if ($agentid != "") {echo "<font size=+2><b>".$row["name"]."</b></font><br>";}
+?>
+<b>Activity Report</b><br>
+<?php
+ echo $month."/".$day."/".$year." - ".$month2."/".$day2."/".$year2;
+?>
+<br>
+<br>
+
+<table border=0 cellpadding=0 cellspacing=0 width="85%"bgcolor=#000000>
+<tr>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="120">
+ <font color="#ffffff">Date</font>
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="45">
+ <font color="#ffffff">Ticket #</font>
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="5">
+ </th>
+ <th bgcolor=#000000>
+ <font color="#ffffff">Agent / Company</font>
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="5">
+ </th>
+ <th bgcolor=#000000>
+ <font color="#ffffff">Description</font>
+ </th>
+ <th bgcolor=#000000 width="5">
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="45">
+ <font color="#ffffff">Time</font>
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+ <th bgcolor=#000000 width="85">
+ <font color="#ffffff">Amount Billed</font>
+ </th>
+ <th bgcolor=#000000 width="1">
+ </th>
+</tr>
+<?php
+ $bgcolor = "#FFFFFF";
+ $moneytotal = 0;
+ $timetotal = 0;
+ $result2 = mysql_data_seek($result, 0);
+ while($row = mysql_fetch_array($result)) {
+ $timetotal += $row["timespent"];
+?>
+<tr>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" valign=top>
+
+<?php
+ list($myDate,$junk) = split(' ',$row["timestamp"]);
+ list($myYear,$myMonth,$myDay) = split ('-', $myDate);
+ echo date("F j, Y", mktime(1,0,0,$myMonth,$myDay,$myYear));
+?>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" valign=top align=middle>
+ <a href="showticket.php?ticketnumber=<?php echo $row["ticketnumber"]; ?>"><?php echo $row["ticketnumber"]; ?></a>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" width="5">
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" valign=top>
+ <b>
+<?php
+ if ($agentid == "") {
+ echo $row["name"];
+ }?>
+ </b>
+<?php
+ if ($agentid == "" && $customerid == "")
+ {echo " / ";
+ }
+ if ($customerid == "") {
+ echo $row["company_name"].":";
+ }
+ echo $row["projectname"];
+?>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<? echo $bgcolor;?>" width="5">
+ </td>
+ <td bgcolor="<? echo $bgcolor;?>" valign=top>
+ <b><?php echo $row["taskdescription"];?>
+ </b> - <?php echo $row["customerdetail"];?>
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" width="5">
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<?php echo $bgcolor;?>" valign=top align=middle>
+ <?php echo $row["timespent"]; ?>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td bgcolor="<? echo $bgcolor;?>" valign=top align=right>
+<?php
+ if ($row["billable"] == "t") {
+ $moneytotal += $row["timespent"] * $row["rate"];
+?>
+ $<?php echo number_format(($row["timespent"] * $row["rate"]),2); ?>
+<?php
+ } else {
+?>
+ N/A
+<?php
+ }
+?>
+ </td>
+</tr>
+<?php
+ if ($bgcolor == "#FFFFFF") {
+ $bgcolor = "#DDDDDD";
+ } else {
+ $bgcolor = "#FFFFFF";
+ }
+ }
+?>
+<tr>
+ <td height=1 colspan=11>
+ </td>
+</tr>
+<tr>
+ <td colspan=11 align=right bgcolor="#ffffff">
+ <b>Totals:</b>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td valign=right bgcolor="#ffffff" align=middle>
+ <b><?php echo $timetotal;?></b>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+ <td valign=right bgcolor="#ffffff" align=right>
+ <b>$<?php echo number_format($moneytotal,2); ?></b>
+ </td>
+ <td bgcolor=#000000 width="1">
+ </td>
+</tr>
+<tr>
+ <td height=1 colspan=11 bgcolor="#ffffff">
+ </td>
+ <td height=1 colspan=3>
+ </td>
+</tr>
+</table>
+
+<?php
+}
+?>
Modified: trunk/admin/accessgroupadmin.php
===================================================================
--- trunk/admin/accessgroupadmin.php 2007-07-20 12:48:26 UTC (rev 3)
+++ trunk/admin/accessgroupadmin.php 2007-07-21 11:28:35 UTC (rev 4)
@@ -1,171 +1,180 @@
-<?
- include("../header.php");
-?>
-<a href="index.php">Admin Home</a><br><br>
-<?
- if ($action == "") {
- do_step1();
- } elseif ($action == "edit") {
- do_edit();
- } elseif ($action == "add") {
- do_add();
- } elseif ($action == "insert") {
- do_insert();
- do_step1();
- } elseif ($action == "update") {
- do_update();
- do_step1();
- } elseif ($action == "delete") {
- do_delete();
- do_step1();
- }
-
- include("../footer.php");
-?>
-
-<?
-function do_step1 () {
- global $conn;
- $result = pg_Exec($conn, "SELECT * from access_levels order by access_level");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
- <a href="accessgroupadmin.php?action=add">New Acess Level</a><br>
-
-<?
- $x = 0;
- while ($row = @pg_fetch_object ($result, $x)) {
-?>
-<table border=1 cellpadding=3>
-<tr>
- <td>
- Level Name:
- </td>
- <td>
- <?echo $row->description;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Access Level:
- </td>
- <td>
- <?echo $row->access_level;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Functions:
- </td>
- <td>
- <a href="accessgroupadmin.php?action=edit&formaccess_level=<?echo $row->access_level;?>">Edit this access level</a><br>
- <a href="accessgroupadmin.php?action=delete&formaccess_level=<?echo $row->access_level;?>">Delete this access level</a>
- </td>
-</tr>
-</table>
-<?
- $x++;
- }
-?>
-
-<?
-
-}
-
-function do_edit () {
- global $conn, $formaccess_level;
- $result = pg_Exec($conn, "SELECT * from access_levels where access_level = $formaccess_level");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
- $row = pg_fetch_object ($result, 0);
-?>
-
-<form action="accessgroupadmin.php" method="post">
-<input type="hidden" name="action" value="update">
-<input type="hidden" name="agentid" value="<?echo $row->access_level;?>">
-<table border=0>
-<tr>
- <td>
- Name:
- </td>
- <td>
- <input type=text name="description" size=50 maxlength=100 value="<?echo $row->description;?>">
- </td>
-</tr>
-<tr>
- <td>
- Access Level:
- </td>
- <td>
- <input type=text name="newaccess_level" size=3 maxlength=3 value="<?echo $row->access_level;?>">
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-function do_add () {
-?>
-
-<form action="accessgroupadmin.php" method="post">
-<input type="hidden" name="action" value="insert">
-<table border=0>
-<tr>
- <td>
- Name:
- </td>
- <td>
- <input type=text name="description" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- Access Level:
- </td>
- <td>
- <input type=text name="formaccess_level" size=3 maxlength=3>
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-function do_update() {
- global $conn, $formaccess_level, $description, $newaccess_level;
- $result = pg_Exec($conn, "UPDATE access_levels SET description = '$description', access_level = '$newaccess_level' where access_level = $formaccess_level;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_insert() {
- global $conn, $formaccess_level, $description;
-
- $result = pg_Exec($conn, "INSERT INTO access_levels (access_level, description) VALUES ('$formaccess_level', '$description');");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_delete() {
- global $conn, $formaccess_level;
- $result = pg_Exec($conn, "DELETE FROM access_levels WHERE access_level = $formaccess_level;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-?>
+<?
+ include("../header.php");
+?>
+<a href="index.php">Admin Home</a><br><br>
+<?
+ $action = $_REQUEST["action"];
+ $formaccess_level = $_REQUEST["formaccess_level"];
+ $description = $_REQUEST["description"];
+ $newaccess_level = $_REQUEST["newaccess_level"];
+ $access_level = $_REQUEST["access_level"];
+ if ($action == "") {
+ do_step1();
+ } elseif ($action == "edit") {
+ do_edit();
+ } elseif ($action == "add") {
+ do_add();
+ } elseif ($action == "insert") {
+ do_insert();
+ do_step1();
+ } elseif ($action == "update") {
+ do_update();
+ do_step1();
+ } elseif ($action == "delete") {
+ do_delete();
+ do_step1();
+ }
+
+ include("../footer.php");
+?>
+
+<?
+function do_step1 () {
+ global $conn;
+ $result = mysql_query("SELECT * from access_levels order by access_level");
+ #$result = pg_Exec($conn, "SELECT * from access_levels order by access_level");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+?>
+ <a href="accessgroupadmin.php?action=add">New Acess Level</a><br>
+
+<?
+ $x = 0;
+ while ($row = mysql_fetch_array ($result)) {
+?>
+<table border=1 cellpadding=3>
+<tr>
+ <td>
+ Level Name:
+ </td>
+ <td>
+ <?echo $row["description"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Access Level:
+ </td>
+ <td>
+ <?echo $row["access_level"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Functions:
+ </td>
+ <td>
+ <a href="accessgroupadmin.php?action=edit&formaccess_level=<?echo $row["access_level"];?>">Edit this access level</a><br>
+ <a href="accessgroupadmin.php?action=delete&formaccess_level=<?echo $row["access_level"];?>">Delete this access level</a>
+ </td>
+</tr>
+</table>
+<?
+ }
+?>
+
+<?
+
+}
+
+function do_edit () {
+ global $conn, $formaccess_level;
+ $result = mysql_query("SELECT * from access_levels where access_level = $formaccess_level");
+ #$result = pg_Exec($conn, "SELECT * from access_levels where access_level = $formaccess_level");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+ $row = mysql_fetch_array ($result);
+?>
+
+<form action="accessgroupadmin.php" method="post">
+<input type="hidden" name="action" value="update">
+<input type="hidden" name="access_level" value="<?echo $row["access_level"];?>">
+<table border=0>
+<tr>
+ <td>
+ Name:
+ </td>
+ <td>
+ <input type=text name="description" size=50 maxlength=100 value="<?echo $row["description"];?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Access Level:
+ </td>
+ <td>
+ <input type=text name="newaccess_level" size=3 maxlength=3 value="<?echo $row["access_level"];?>">
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+function do_add () {
+?>
+
+<form action="accessgroupadmin.php" method="post">
+<input type="hidden" name="action" value="insert">
+<table border=0>
+<tr>
+ <td>
+ Name:
+ </td>
+ <td>
+ <input type=text name="description" size=50 maxlength=100>
+ </td>
+</tr>
+<tr>
+ <td>
+ Access Level:
+ </td>
+ <td>
+ <input type=text name="formaccess_level" size=3 maxlength=3>
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+function do_update() {
+ global $conn, $access_level, $description, $newaccess_level;
+ $result = mysql_query("UPDATE access_levels SET description = '$description', access_level = '$newaccess_level' where access_level = $access_level;");
+ #$result = pg_Exec($conn, "UPDATE access_levels SET description = '$description', access_level = '$newaccess_level' where access_level = $formaccess_level;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_insert() {
+ global $conn, $formaccess_level, $description;
+
+ $result = mysql_query("INSERT INTO access_levels (access_level, description) VALUES ('$formaccess_level', '$description');");
+ #$result = pg_Exec($conn, "INSERT INTO access_levels (access_level, description) VALUES ('$formaccess_level', '$description');");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_delete() {
+ global $conn, $formaccess_level;
+ $result = mysql_query("DELETE FROM access_levels WHERE access_level = $formaccess_level;");
+ #$result = pg_Exec($conn, "DELETE FROM access_levels WHERE access_level = $formaccess_level;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+?>
Modified: trunk/admin/accessgroupfileadmin.php
===================================================================
--- trunk/admin/accessgroupfileadmin.php 2007-07-20 12:48:26 UTC (rev 3)
+++ trunk/admin/accessgroupfileadmin.php 2007-07-21 11:28:35 UTC (rev 4)
@@ -1,180 +1,187 @@
-<?
- include("../header.php");
-?>
-<a href="index.php">Admin Home</a><br><br>
-<?
- if ($action == "") {
- if ($formaccess_level == "") {
- do_choose_level();
- } else {
- do_step1();
- }
- } elseif ($action == "edit") {
- do_edit();
- } elseif ($action == "add") {
- do_add();
- } elseif ($action == "update") {
- do_update();
- do_step1();
- } elseif ($action == "insert") {
- do_insert();
- do_step1();
- } elseif ($action == "delete") {
- do_delete();
- do_step1();
- }
-
- include("../footer.php");
-?>
-
-<?
-function do_choose_level () {
- global $conn, $access_level;
- $result = pg_Exec($conn, "SELECT * FROM access_levels WHERE access_level >= $access_level order by access_level");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
-<form action="accessgroupfileadmin.php" method=post>
-Choose the access level to manage files under:<br><br>
-<select name="formaccess_level">
-<?
- $x = 0;
- while ($row = @pg_fetch_object ($result, $x)) {
-?>
- <option value="<?=$row->access_level?>"> <?echo $row->description;?>
-<?
- $x++;
- }
-?>
-</select>
-<br><input type=submit value="View Projects">
-</form>
-<?
-
-}
-
-function do_step1 () {
- global $conn, $formaccess_level;
- $result = pg_Exec($conn, "SELECT * from security WHERE access_level = $formaccess_level order by scriptname");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
- <a href="accessgroupfileadmin.php">Change Access Level</a><br>
- <a href="accessgroupfileadmin.php?action=add&formaccess_level=<?=$formaccess_level?>">New File</a><br>
-
-<?
- $x = 0;
- while ($row = @pg_fetch_object ($result, $x)) {
-?>
-<table border=1 cellpadding=3>
-<tr>
- <td>
- Script Name:
- </td>
- <td>
- <?echo $row->scriptname;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Functions:
- </td>
- <td>
- <a href="accessgroupfileadmin.php?action=edit&formaccess_level=<?echo $formaccess_level;?>&secureid=<?echo $row->secureid;?>">Edit this file name</a><br>
- <a href="accessgroupfileadmin.php?action=delete&formaccess_level=<?echo $formaccess_level;?>&secureid=<?echo $row->secureid;?>">Delete this file name</a>
- </td>
-</tr>
-</table>
-<?
- $x++;
- }
-?>
-
-<?
-
-}
-
-function do_edit () {
- global $conn, $formaccess_level, $secureid;
- $result = pg_Exec($conn, "SELECT * from security where secureid = $secureid");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
- $row = pg_fetch_object ($result, 0);
-?>
-
-<form action="accessgroupfileadmin.php" method="post">
-<input type="hidden" name="action" value="update">
-<input type="hidden" name="formaccess_level" value="<?echo $formaccess_level;?>">
-<input type="hidden" name="secureid" value="<?echo $row->secureid;?>">
-<table border=0>
-<tr>
- <td>
- Script Name:
- </td>
- <td>
- <input type=text name="script_name" size=50 maxlength=100 value="<?echo $row->scriptname;?>">
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-function do_add () {
-global $formaccess_level;
-?>
-
-<form action="accessgroupfileadmin.php" method="post">
-<input type="hidden" name="action" value="insert">
-<input type="hidden" name="formaccess_level" value="<?echo $formaccess_level;?>">
-<table border=0>
-<tr>
- <td>
- Script Name:
- </td>
- <td>
- <input type=text name="scriptname" size=50 maxlength=100>
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-function do_update() {
- global $conn, $formaccess_level, $scriptname, $secureid;
- $result = pg_Exec($conn, "UPDATE security SET scriptname = '$scriptname' where secureid = $secureid;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_insert() {
- global $conn, $formaccess_level, $scriptname;
- $result = pg_Exec($conn, "INSERT INTO security (access_level, scriptname) VALUES ($formaccess_level, '$scriptname');");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_delete() {
- global $conn, $secureid;
- $result = pg_Exec($conn, "DELETE FROM security WHERE secureid = $secureid;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-?>
+<?
+ include("../header.php");
+?>
+<a href="index.php">Admin Home</a><br><br>
+<?
+ $action = $_REQUEST["action"];
+ $formaccess_level = $_REQUEST["formaccess_level"];
+ $secureid = $_REQUEST["secureid"];
+ $access_level = $_SESSION["access_level"];
+ $scriptname = $_REQUEST["scriptname"];
+ if ($action == "") {
+ if ($formaccess_level == "") {
+ do_choose_level();
+ } else {
+ do_step1();
+ }
+ } elseif ($action == "edit") {
+ do_edit();
+ } elseif ($action == "add") {
+ do_add();
+ } elseif ($action == "update") {
+ do_update();
+ do_step1();
+ } elseif ($action == "insert") {
+ do_insert();
+ do_step1();
+ } elseif ($action == "delete") {
+ do_delete();
+ do_step1();
+ }
+
+ include("../footer.php");
+?>
+
+<?
+function do_choose_level () {
+ global $conn, $access_level;
+ $result = mysql_query("SELECT * FROM access_levels WHERE access_level >= $access_level order by access_level");
+ #$result = pg_Exec($conn, "SELECT * FROM access_levels WHERE access_level >= $access_level order by access_level");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+?>
+<form action="accessgroupfileadmin.php" method=post>
+Choose the access level to manage files under:<br><br>
+<select name="formaccess_level">
+<?
+ while ($row = mysql_fetch_array ($result)) {
+?>
+ <option value="<?=$row["access_level"]?>"> <?echo $row["description"];?>
+<?
+ }
+?>
+</select>
+<br><input type=submit value="View Projects">
+</form>
+<?
+
+}
+
+function do_step1 () {
+ global $conn, $formaccess_level;
+ $result = mysql_query("SELECT * from security WHERE access_level = $formaccess_level order by scriptname");
+ #$result = pg_Exec($conn, "SELECT * from security WHERE access_level = $formaccess_level order by scriptname");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+?>
+ <a href="accessgroupfileadmin.php">Change Access Level</a><br>
+ <a href="accessgroupfileadmin.php?action=add&formaccess_level=<?=$formaccess_level?>">New File</a><br>
+
+<?
+ while ($row = mysql_fetch_array ($result)) {
+?>
+<table border=1 cellpadding=3>
+<tr>
+ <td>
+ Script Name:
+ </td>
+ <td>
+ <?echo $row["scriptname"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Functions:
+ </td>
+ <td>
+ <a href="accessgroupfileadmin.php?action=edit&formaccess_level=<?echo $formaccess_level;?>&secureid=<?echo $row["secureid"];?>">Edit this file name</a><br>
+ <a href="accessgroupfileadmin.php?action=delete&formaccess_level=<?echo $formaccess_level;?>&secureid=<?echo $row["secureid"];?>">Delete this file name</a>
+ </td>
+</tr>
+</table>
+<?
+ }
+?>
+
+<?
+
+}
+
+function do_edit () {
+ global $conn, $formaccess_level, $secureid;
+ $result = mysql_query("SELECT * from security where secureid = $secureid");
+ #$result = pg_Exec($conn, "SELECT * from security where secureid = $secureid");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+ $row = mysql_fetch_array ($result);
+?>
+
+<form action="accessgroupfileadmin.php" method="post">
+<input type="hidden" name="action" value="update">
+<input type="hidden" name="formaccess_level" value="<?echo $formaccess_level;?>">
+<input type="hidden" name="secureid" value="<?echo $row["secureid"];?>">
+<table border=0>
+<tr>
+ <td>
+ Script Name:
+ </td>
+ <td>
+ <input type=text name="scriptname" size=50 maxlength=100 value="<?echo $row["scriptname"];?>">
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+function do_add () {
+global $formaccess_level;
+?>
+
+<form action="accessgroupfileadmin.php" method="post">
+<input type="hidden" name="action" value="insert">
+<input type="hidden" name="formaccess_level" value="<?echo $formaccess_level;?>">
+<table border=0>
+<tr>
+ <td>
+ Script Name:
+ </td>
+ <td>
+ <input type=text name="scriptname" size=50 maxlength=100>
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+function do_update() {
+ global $conn, $formaccess_level, $scriptname, $secureid;
+ $result = mysql_query("UPDATE security SET scriptname = '$scriptname' where secureid = $secureid;");
+ #$result = pg_Exec($conn, "UPDATE security SET scriptname = '$scriptname' where secureid = $secureid;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_insert() {
+ global $conn, $formaccess_level, $scriptname;
+ $result = mysql_query("INSERT INTO security (access_level, scriptname) VALUES ($formaccess_level, '$scriptname');");
+ #$result = pg_Exec($conn, "INSERT INTO security (access_level, scriptname) VALUES ($formaccess_level, '$scriptname');");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_delete() {
+ global $conn, $secureid;
+ $result = mysql_query("DELETE FROM security WHERE secureid = $secureid;");
+ #$result = pg_Exec($conn, "DELETE FROM security WHERE secureid = $secureid;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+?>
Modified: trunk/admin/agentadmin.php
===================================================================
--- trunk/admin/agentadmin.php 2007-07-20 12:48:26 UTC (rev 3)
+++ trunk/admin/agentadmin.php 2007-07-21 11:28:35 UTC (rev 4)
@@ -1,323 +1,329 @@
-<?
- include("../header.php");
-?>
-<a href="index.php">Admin Home</a><br><br>
-<?
- if ($action == "") {
- do_step1();
- } elseif ($action == "edit") {
- do_edit();
- } elseif ($action == "add") {
- do_add(" ");
- } elseif ($action == "chpass") {
- do_chpass(" ");
- } elseif ($action == "insert") {
- if ($pass1 == $pass2) {
- do_insert();
- do_step1();
- } else {
- do_add("Passwords did not match");
- }
- } elseif ($action == "chpass_commit") {
- if ($pass1 == $pass2) {
- do_chpass_commit();
- do_step1();
- } else {
- do_chpass("Passwords did not match");
- }
- } elseif ($action == "update") {
- do_update();
- do_step1();
- } elseif ($action == "disable") {
- do_able("N");
- do_step1();
- } elseif ($action == "enable") {
- do_able("Y");
- do_step1();
- }
-
- include("../footer.php");
-?>
-
-<?
-function do_step1 () {
- global $conn;
- $result = pg_Exec($conn, "SELECT * from agents order by visible desc, name");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
- <a href="agentadmin.php?action=add">New Agent</a><br>
-
-<?
- $x = 0;
- while ($row = @pg_fetch_object ($result, $x)) {
-?>
-<table border=1 cellpadding=3>
-<?
-if ($row->visible == "N") {
-?>
-<tr>
- <td>
- Status:
- </td>
- <td>
- <font color="red">This agent is disabled</font>
- </td>
-</tr>
-<?
-}
-?>
-<tr>
- <td>
- Name:
- </td>
- <td>
- <?echo $row->name;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Email:
- </td>
- <td>
- <?echo $row->email;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Login:
- </td>
- <td>
- <?echo $row->login;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Functions:
- </td>
- <td>
- <a href="agentadmin.php?action=edit&agentid=<?echo $row->agentid;?>">Edit this agent</a><br>
- <a href="agentadmin.php?action=chpass&agentid=<?echo $row->agentid;?>">Change this agent's password</a><br>
- <?
- if ($row->visible == "Y") {
- ?>
- <a href="agentadmin.php?action=disable&agentid=<?echo $row->agentid;?>">Disable this agent</a>
- <?
- } else {
- ?>
- <a href="agentadmin.php?action=enable&agentid=<?echo $row->agentid;?>">Enable this agent</a>
- <?
- }
- ?>
-
- </td>
-</tr>
-</table>
-<?
- $x++;
- }
-?>
-
-<?
-
-}
-
-function do_edit () {
- global $conn, $agentid;
- $result = pg_Exec($conn, "SELECT * from agents where agentid = $agentid");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
- $row = pg_fetch_object ($result, 0);
-?>
-
-<form action="agentadmin.php" method="post">
-<input type="hidden" name="action" value="update">
-<input type="hidden" name="agentid" value="<?echo $row->agentid;?>">
-<table border=0>
-<tr>
- <td>
- Name:
- </td>
- <td>
- <input type=text name="name" size=50 maxlength=100 value="<?echo $row->name;?>">
- </td>
-</tr>
-<tr>
- <td>
- Email:
- </td>
- <td>
- <input type=text name="email" size=50 maxlength=100 value="<?echo $row->email;?>">
- </td>
-</tr>
-<tr>
- <td>
- Login:
- </td>
- <td>
- <input type=text name="login" size=50 maxlength=100 value="<?echo $row->login;?>">
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-function do_chpass($error) {
- global $conn, $agentid;
- if (strlen($error) > 3) {
- echo "$error<br><br>";
- }
-?>
-
-<form action="agentadmin.php" method="post">
-<input type="hidden" name="action" value="chpass_commit">
-<input type="hidden" name="agentid" value="<?echo $agentid;?>">
-<input type="hidden" name="oldlogin" value="<?echo $oldlogin;?>">
-<table border=0>
-<tr>
- <td>
- New Password:
- </td>
- <td>
- <input type=password name="pass1" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- Password (again):
- </td>
- <td>
- <input type=password name="pass2" size=50 maxlength=100>
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-
-function do_add ($error) {
-global $name, $email, $login;
- if (strlen($error) > 3) {
- echo "$error<br><br>";
- }
-?>
-
-<form action="agentadmin.php" method="post">
-<input type="hidden" name="action" value="insert">
-<table border=0>
-<tr>
- <td>
- Name:
- </td>
- <td>
- <input type=text name="name" size=50 maxlength=100 value="<?=$name?>">
- </td>
-</tr>
-<tr>
- <td>
- Email:
- </td>
- <td>
- <input type=text name="email" size=50 maxlength=100 value="<?=$email?>">
- </td>
-</tr>
-<tr>
- <td>
- Login:
- </td>
- <td>
- <input type=text name="login" size=50 maxlength=100 value="<?=$login?>">
- </td>
-</tr>
-<tr>
- <td>
- Password:
- </td>
- <td>
- <input type=password name="pass1" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- Password (again):
- </td>
- <td>
- <input type=password name="pass2" size=50 maxlength=100>
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-
-function do_update() {
- global $conn, $agentid, $name, $email, $login;
-
- if ($_REQUEST['login'] != $_REQUEST['oldlogin']) {
- $result = pg_Exec($conn, "SELECT agentid from agents where login = '".$_POST['login']."';");
- if (pg_num_rows($result) != 0) {
- do_edit("Duplicate Userid, retry.");
- exit;
- }
- }
- $result = pg_Exec($conn, "UPDATE agents SET name = '$name', email = '$email', login = '$login' where agentid = $agentid;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_insert() {
- global $conn, $name, $login, $email, $pass1;
-
- $saltgen = substr(crypt($_POST['pass1']), -2);
- $encpass = crypt($_POST['pass1'], $saltgen);
-
- $result = pg_Exec($conn, "SELECT agentid from agents where login = '".$_POST['login']."';");
- if (pg_num_rows($result) != 0) {
- do_add("Duplicate Userid");
- exit;
- } else {
- $result = pg_Exec($conn, "INSERT INTO agents (name, email, login, password) VALUES ('$name', '$email', '$login', '$encpass');");
- }
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_chpass_commit() {
- global $conn, $agentid, $pass1;
-
- $saltgen = substr(crypt($_POST['pass1']), -2);
- $encpass = crypt($_POST['pass1'], $saltgen);
-
- $result = pg_Exec($conn, "UPDATE agents SET password = '$encpass' WHERE agentid = $agentid;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-function do_able($able) {
- global $conn, $agentid;
- $result = pg_Exec($conn, "UPDATE agents SET visible = '$able' WHERE agentid = $agentid;");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-}
-
-?>
+<?
+ include("../header.php");
+?>
+<a href="index.php">Admin Home</a><br><br>
+<?
+ $action = $_REQUEST["action"];
+ $agentid = $_REQUEST["agentid"];
+ if ($action == "") {
+ do_step1();
+ } elseif ($action == "edit") {
+ do_edit();
+ } elseif ($action == "add") {
+ do_add(" ");
+ } elseif ($action == "chpass") {
+ do_chpass(" ");
+ } elseif ($action == "insert") {
+ if ($pass1 == $pass2) {
+ do_insert();
+ do_step1();
+ } else {
+ do_add("Passwords did not match");
+ }
+ } elseif ($action == "chpass_commit") {
+ if ($_REQUEST["pass1"] == $_REQUEST["pass2"]) {
+ do_chpass_commit();
+ do_step1();
+ } else {
+ do_chpass("Passwords did not match");
+ }
+ } elseif ($action == "update") {
+ do_update();
+ do_step1();
+ } elseif ($action == "disable") {
+ do_able("N");
+ do_step1();
+ } elseif ($action == "enable") {
+ do_able("Y");
+ do_step1();
+ }
+
+ include("../footer.php");
+?>
+
+<?
+function do_step1 () {
+ global $conn;
+ $result = mysql_query( "SELECT * from agents order by visible desc, name");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+?>
+ <a href="agentadmin.php?action=add">New Agent</a><br>
+
+<?
+ while ($row = mysql_fetch_array ($result)) {
+?>
+<table border=1 cellpadding=3>
+<?
+if ($row["visible"] == "N") {
+?>
+<tr>
+ <td>
+ Status:
+ </td>
+ <td>
+ <font color="red">This agent is disabled</font>
+ </td>
+</tr>
+<?
+}
+?>
+<tr>
+ <td>
+ Name:
+ </td>
+ <td>
+ <?echo $row["name"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Email:
+ </td>
+ <td>
+ <?echo $row["email"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Login:
+ </td>
+ <td>
+ <?echo $row["login"];?>
+ </td>
+</tr>
+<tr>
+ <td valign=top>
+ Functions:
+ </td>
+ <td>
+ <a href="agentadmin.php?action=edit&agentid=<?echo $row["agentid"];?>">Edit this agent</a><br>
+ <a href="agentadmin.php?action=chpass&agentid=<?echo $row["agentid"];?>">Change this agent's password</a><br>
+ <?
+ if ($row["visible"] == "Y") {
+ ?>
+ <a href="agentadmin.php?action=disable&agentid=<?echo $row["agentid"];?>">Disable this agent</a>
+ <?
+ } else {
+ ?>
+ <a href="agentadmin.php?action=enable&agentid=<?echo $row["agentid"];?>">Enable this agent</a>
+ <?
+ }
+ ?>
+
+ </td>
+</tr>
+</table>
+<?
+ }
+?>
+
+<?
+
+}
+
+function do_edit ($error) {
+ global $conn, $agentid;
+
+ if (strlen($error) > 3) {
+ echo "$error<br><br>";
+ }
+
+ $result = mysql_query( "SELECT * from agents where agentid = $agentid");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+ $row = mysql_fetch_array ($result);
+?>
+
+<form action="agentadmin.php" method="post">
+<input type="hidden" name="action" value="update">
+<input type="hidden" name="agentid" value="<?echo $row["agentid"];?>">
+<input type="hidden" name="oldlogin" value="<?php echo $row["login"]; ?>">
+<table border=0>
+<tr>
+ <td>
+ Name:
+ </td>
+ <td>
+ <input type=text name="name" size=50 maxlength=100 value="<?echo $row["name"];?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Email:
+ </td>
+ <td>
+ <input type=text name="email" size=50 maxlength=100 value="<?echo $row["email"];?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Login:
+ </td>
+ <td>
+ <input type=text name="login" size=50 maxlength=100 value="<?echo $row["login"];?>">
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+function do_chpass($error) {
+ global $conn, $agentid;
+ if (strlen($error) > 3) {
+ echo "$error<br><br>";
+ }
+?>
+
+<form action="agentadmin.php" method="post">
+<input type="hidden" name="action" value="chpass_commit">
+<input type="hidden" name="agentid" value="<?echo $agentid;?>">
+<input type="hidden" name="oldlogin" value="<?echo $oldlogin;?>">
+<table border=0>
+<tr>
+ <td>
+ New Password:
+ </td>
+ <td>
+ <input type=password name="pass1" size=50 maxlength=100>
+ </td>
+</tr>
+<tr>
+ <td>
+ Password (again):
+ </td>
+ <td>
+ <input type=password name="pass2" size=50 maxlength=100>
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+
+function do_add ($error) {
+global $name, $email, $login;
+ if (strlen($error) > 3) {
+ echo "$error<br><br>";
+ }
+?>
+
+<form action="agentadmin.php" method="post">
+<input type="hidden" name="action" value="insert">
+<table border=0>
+<tr>
+ <td>
+ Name:
+ </td>
+ <td>
+ <input type=text name="name" size=50 maxlength=100 value="<?php print($_REQUEST["name"]);?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Email:
+ </td>
+ <td>
+ <input type=text name="email" size=50 maxlength=100 value="<?php print($_REQUEST["email"]);?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Login:
+ </td>
+ <td>
+ <input type=text name="login" size=50 maxlength=100 value="<?php print($_REQUEST["login"]);?>">
+ </td>
+</tr>
+<tr>
+ <td>
+ Password:
+ </td>
+ <td>
+ <input type=password name="pass1" size=50 maxlength=100>
+ </td>
+</tr>
+<tr>
+ <td>
+ Password (again):
+ </td>
+ <td>
+ <input type=password name="pass2" size=50 maxlength=100>
+ </td>
+</tr>
+</table>
+<input type="submit" value="Save Changes">
+</form>
+
+<?
+}
+
+function do_update() {
+ global $conn, $agentid, $name, $email, $login;
+
+ if ($_REQUEST['login'] != $_REQUEST['oldlogin']) {
+ $result = mysql_query( "SELECT agentid from agents where login = '".$_POST['login']."';");
+ if (mysql_num_rows($result) != 0) {
+ do_edit("Duplicate Userid, retry.");
+ exit;
+ }
+ }
+ $result = mysql_query( "UPDATE agents SET name = '".$_REQUEST["name"]."', email = '".$_REQUEST["email"]."', login = '".$_REQUEST["login"]."' where agentid = $agentid;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_insert() {
+ global $conn, $name, $login, $email, $pass1;
+
+ $saltgen = substr(crypt($_POST['pass1']), -2);
+ $encpass = crypt($_POST['pass1'], $saltgen);
+
+ $result = mysql_query( "SELECT agentid from agents where login = '".$_POST['login']."';");
+ if (mysql_num_rows($result) != 0) {
+ do_add("Duplicate Userid");
+ exit;
+ } else {
+ $result = mysql_query( "INSERT INTO agents (name, email, login, password) VALUES ('".$_REQUEST["name"]."', '".$_REQUEST["email"]."', '".$_REQUEST["login"]."', '$encpass');");
+ }
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_chpass_commit() {
+ global $conn, $agentid, $pass1;
+
+ $saltgen = substr(crypt($_POST['pass1']), -2);
+ $encpass = crypt($_POST['pass1'], $saltgen);
+
+ $result = mysql_query( "UPDATE agents SET password = '$encpass' WHERE agentid = $agentid;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+function do_able($able) {
+ global $conn, $agentid;
+ $result = mysql_query( "UPDATE agents SET visible = '$able' WHERE agentid = $agentid;");
+ if (!$result) {
+ echo "An Error Occurred.";
+ exit;
+ }
+}
+
+?>
Modified: trunk/admin/customeradmin.php
===================================================================
--- trunk/admin/customeradmin.php 2007-07-20 12:48:26 UTC (rev 3)
+++ trunk/admin/customeradmin.php 2007-07-21 11:28:35 UTC (rev 4)
@@ -1,479 +1,479 @@
-<?
- include("../header.php");
-?>
-<a href="index.php">Admin Home</a><br><br>
-<?
- if ($action == "") {
- do_step1();
- } elseif ($action == "edit") {
- do_edit();
- } elseif ($action == "add") {
- do_add();
- } elseif ($action == "update") {
- do_update();
- do_step1();
- } elseif ($action == "insert") {
- do_insert();
- do_step1();
- } elseif ($action == "disable") {
- do_able("N");
- do_step1();
- } elseif ($action == "enable") {
- do_able("Y");
- do_step1();
- }
-
- include("../footer.php");
-?>
-
-<?
-function do_step1 () {
- global $conn;
- $result = pg_Exec($conn, "SELECT * from customer order by visible desc, company_name");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
-?>
- <a href="customeradmin.php?action=add">New Customer</a><br>
-
-<?
- $x = 0;
- while ($row = @pg_fetch_object ($result, $x)) {
-?>
-<table border=1 cellpadding=3>
-<?
-if ($row->visible == "N") {
-?>
-<tr>
- <td>
- Status:
- </td>
- <td>
- <font color="red">This customer is disabled</font>
- </td>
-</tr>
-<?
-}
-?>
-<tr>
- <td>
- Company Name:
- </td>
- <td>
- <?echo $row->company_name;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Address 1:
- </td>
- <td>
- <?echo $row->address1;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Address 2:
- </td>
- <td>
- <?echo $row->address2;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- City:
- </td>
- <td>
- <?echo $row->city;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- State:
- </td>
- <td>
- <?echo $row->state;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Zip:
- </td>
- <td>
- <?echo $row->zip;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Phone:
- </td>
- <td>
- <?echo $row->phone;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Fax:
- </td>
- <td>
- <?echo $row->fax;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Email:
- </td>
- <td>
- <?echo $row->email;?>
- </td>
-</tr>
-<tr>
- <td valign=top>
- Functions:
- </td>
- <td>
- <a href="customeradmin.php?action=edit&customerid=<?echo $row->customerid;?>">Edit this customer</a><br>
- <?
- if ($row->visible == "Y") {
- ?>
- <a href="customeradmin.php?action=disable&customerid=<?echo $row->customerid;?>">Disable this customer</a>
- <?
- } else {
- ?>
- <a href="customeradmin.php?action=enable&customerid=<?echo $row->customerid;?>">Enable this customer</a>
- <?
- }
- ?>
- </td>
-</tr>
-</table>
-<?
- $x++;
- }
-?>
-
-<?
-
-}
-
-function do_edit () {
- global $conn, $customerid;
- $result = pg_Exec($conn, "SELECT * from customer where customerid = $customerid");
- if (!$result) {
- echo "An Error Occurred.";
- exit;
- }
- $row = pg_fetch_object ($result, 0);
-?>
-
-<form action="customeradmin.php" method="post">
-<input type="hidden" name="action" value="update">
-<input type="hidden" name="customerid" value="<?echo $row->customerid;?>">
-<table border=0>
-<tr>
- <td>
- Company Name:
- </td>
- <td>
- <input type=text name="company_name" size=50 maxlength=100 value="<?echo $row->company_name;?>">
- </td>
-</tr>
-<tr>
- <td>
- Address 1:
- </td>
- <td>
- <input type=text name="address1" size=50 maxlength=100 value="<?echo $row->address1;?>">
- </td>
-</tr>
-<tr>
- <td>
- Address 2:
- </td>
- <td>
- <input type=text name="address2" size=50 maxlength=100 value="<?echo $row->address2;?>">
- </td>
-</tr>
-<tr>
- <td>
- City:
- </td>
- <td>
- <input type=text name="city" size=50 maxlength=100 value="<?echo $row->city;?>">
- </td>
-</tr>
-<tr>
- <td>
- State:
- </td>
- <td>
- <select name="state">
- <option value="<?echo $row->state;?>" selected><?echo $row->state;?></option>
- <option value="AL">Alabama</option>
- <option value="AK">Alaska</option>
- <option value="AZ">Arizona</option>
- <option value="AR">Arkansas</option>
- <option value="CA">California</option>
- <option value="CO">Colorado</option>
- <option value="CT">Connecticut</option>
- <option value="DE">Delaware</option>
- <option value="DC">District of Columbia</option>
- <option value="FL">Florida</option>
- <option value="GA">Georgia</option>
- <option value="HI">Hawaii</option>
- <option value="ID">Idaho</option>
- <option value="IL">Illinois</option>
- <option value="IN">Indiana</option>
- <option value="IA">Iowa</option>
- <option value="KS">Kansas</option>
- <option value="KY">Kentucky</option>
- <option value="LA">Louisana</option>
- <option value="ME">Maine</option>
- <option value="MD">Maryland</option>
- <option value="MA">Massachusetts</option>
- <option value="MI">Michigan</option>
- <option value="MN">Minnesota</option>
- <option value="MS">Mississippi</option>
- <option value="MO">Missouri</option>
- <option value="MT">Montana</option>
- <option value="NE">Nebraska</option>
- <option value="NV">Nevada</option>
- <option value="NH">New Hampshire</option>
- <option value="NJ">New Jersey</option>
- <option value="NM">New Mexico</option>
- <option value="NY">New York</option>
- <option value="NC">North Carolina</option>
- <option value="ND">North Dakota</option>
- <option value="OH">Ohio</option>
- <option value="OK">Oklahoma</option>
- <option value="OR">Oregon</option>
- <option value="PA">Pennsylvania</option>
- <option value="RI">Rhode Island</option>
- <option value="SC">South Carolina</option>
- <option value="SD">South Dakota</option>
- <option value="TN">Tennessee</option>
- <option value="TX">Texas</option>
- <option value="UT">Utah</option>
- <option value="VT">Vermont</option>
- <option value="VA">Virginia</option>
- <option value="WA">Washington</option>
- <option value="WV">West Virginia</option>
- <option value="WI">Wisconsin</option>
- <option value="WY">Wyoming</option>
- </select>
- </td>
-</tr>
-<tr>
- <td>
- Zip:
- </td>
- <td>
- <input type=text name="zip" size=10 maxlength=10 value="<?echo $row->zip;?>">
- </td>
-</tr>
-<tr>
- <td>
- Phone:
- </td>
- <td>
- <input type=text name="phone" size=12 maxlength=50 value="<?echo $row->phone;?>">
- </td>
-</tr>
-<tr>
- <td>
- Fax:
- </td>
- <td>
- <input type=text name="fax" size=12 maxlength=50 value="<?echo $row->fax;?>">
- </td>
-</tr>
-<tr>
- <td>
- Email:
- </td>
- <td>
- <input type=text name="email" size=20 maxlength=50 value="<?echo $row->email;?>">
- </td>
-</tr>
-</table>
-<input type="submit" value="Save Changes">
-</form>
-
-<?
-}
-function do_add () {
-?>
-
-<form action="customeradmin.php" method="post">
-<input type="hidden" name="action" value="insert">
-<table border=0>
-<tr>
- <td>
- Company Name:
- </td>
- <td>
- <input type=text name="company_name" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- Address 1:
- </td>
- <td>
- <input type=text name="address1" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- Address 2:
- </td>
- <td>
- <input type=text name="address2" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- City:
- </td>
- <td>
- <input type=text name="city" size=50 maxlength=100>
- </td>
-</tr>
-<tr>
- <td>
- State:
- </td>
- <td>
- <select name="state">
- <option value="">Choose a state</option>
- <option value="AL">Alabama</option>
- <option value="AK">Alaska</option>
- <option value="AZ">Arizona</option>
- <option value="AR">Arkansas</option>
- <option value="CA">California</option>
- <option value="CO">Colorado</option>
- <option value="CT">Connecticut</option>
- <option value="DE">Delaware</option>
- <option value="DC">District of Columbia</option>
- <option value="FL">Florida</option>
- <option value="GA">Georgia</option>
- <option value="HI">Hawaii</option>
- <option value="ID">Idaho</option>
- <option value="IL">Illinois</option>
- <option value="IN">Indiana</option>
- <option value="IA">Iowa</option>
- <option value="KS">Kansas</option>
- <option value="KY">Kentucky</option>
- <option value="LA">Louisana</option>
- <option value="ME">Maine</option>
- <option value="MD">Maryland</option>
- <option value="MA">Massachusetts</option>
- <option value="MI">Michigan</option>
- <option value="MN">Minnesota</option>
- <option value="MS">Mississippi</option>
- <option value="MO">Missouri</option>
- <option value="MT">Montana</option>
- <option value="NE">Nebraska</option>
- <option value="NV">Nevada</option>
- <option value="NH">New Hampshire</option>
- <option value="NJ">New Jersey</option>
- <option value="NM">New Mexico</option>
- <option value="NY">New York</option>
- <option value="NC">North Carolina</option>
- <option value="ND">North Dakota</option>
- <option value="OH">Ohio</option>
- <option value="OK">Oklahoma</option>
- <option value="OR">Oregon</option>
- <option value="PA">Pennsylvania</option>
- <option value="RI">Rhode Island</option>
- <option value="SC">South Carolina</option>
- <option value="SD">South Dakota</option>
- <option value="TN">Tennessee</option>
- <option value="TX">Texas</option>
- <option value="UT">Utah</option>
- <option value="VT">Vermont</option>
- <option value="VA">Virginia</option>
- <option value="WA">Washington</option>
- <option value="WV">West Virginia</option>
- <option value="WI">Wisconsin</option>
- <option value="WY">Wyoming</option>
- </select>
- <...
[truncated message content] |