The first one is the index page, every page gets loaded within it.
Expand|Select|Wrap|Line Numbers
- <?
- session_start();
- include('includes/db.inc.php');
- if (isset($_SESSION['mycontent']))
- {
- $username = $_SESSION['mycontent'];
- $query = "SELECT * FROM users WHERE username = \"$username\"";
- $result = mysql_query($query) or die('Sorry, could not get cookie at this time ');
- $row = mysql_fetch_array($result, MYSQL_ASSOC);
- $username = $row['username'];
- $fname = $row['fname'];
- $lname = $row['lname'];
- $admin = $row['admin'];
- $userid = $row['userid'];
- $userID = $userid;
- $fullName = "$fname $lname";
- } else { die ( "<h2>You must be logged in to view this content. </h2><br>
- <form action=\"validate.php\" method=\"post\" >
- User Name:
- <input name=\"username\" type=\"text\" class=\"search_box\" size=\"20\" id=\"username\">
- Password:<input name=\"password\" type=\"password\" class=\"search_box\" size=\"20\">
- <input type=\"submit\" class=\"search_box\" value=\"Login\">
- </form>
- \n");
- }
- ?>
- <!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></title>
- <link href="cc.css" rel="stylesheet" type="text/css" />
- <script language = "javascript" type = "text/javascript">
- <!-- Start hiding JavaScript statements
- var Request = false;
- if (window.XMLHttpRequest) {
- Request = new XMLHttpRequest();
- } else if (window.ActiveXObject) {
- Request = new ActiveXObject("Microsoft.XMLHTTP");
- }
- function checkingAlerts() {
- checkAlerts()
- setInterval("checkAlerts()",15000);
- }
- function checkAlerts() {
- var url = "alertsCheck.php?userid=" + <? echo $userID; ?>;
- if(Request) {
- var target2 = document.getElementById('alerts');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- }
- }
- Request.send(null);
- }
- }
- function startup(){
- checkingAlerts();
- checkingStatus()
- }
- </script>
- </head>
- <body onLoad="startup()">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="right" class="usermenu" bgcolor="#2E3E57"><? include('userMenu.php'); ?></td>
- </tr>
- <tr>
- <td align="left" class="menu_content"><h1>myCommand Center v0.0.5</h1></td>
- </tr>
- <tr>
- <td><ol>
- <li><a href="index.php?content=contacts/view-all.php">Contacts</a>
- </li>
- <li><a href="index.php?content=clients/view-all.php">Clients</a></li>
- <li><a href="#">Schedule</a></li>
- <li><a href="#">Resources</a></li>
- <li><a href="#">Reports</a></li>
- <li><a href="#">Compensation & Incentives</a></li>
- </ol> </td>
- </tr>
- <tr>
- <td><?
- $contactID = $_GET['contactID'];
- ?><script language = "javascript" type = "text/javascript">
- <!-- Start hiding JavaScript statements
- var Request = false;
- if (window.XMLHttpRequest) {
- Request = new XMLHttpRequest();
- } else if (window.ActiveXObject) {
- Request = new ActiveXObject("Microsoft.XMLHTTP");
- }
- function checkStatus(target) {
- var userid = "<? echo $userid; ?>";
- var url = "status.php?contactID=" + <? echo $contactID; ?> + "&userid=" + userid;
- if(Request) {
- var target2 = document.getElementById(target);
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- }
- }
- Request.send(null);
- }
- }
- function checkingStatus() {
- checkStatus('status')
- setInterval("checkStatus('status')",15000);
- }
- function newNote(belongsTo) {
- var note = document.getElementById('note').value;
- var rep = "<? echo $fullName; ?>"
- var repID = "<? echo $userID; ?>"
- var belongsTo = belongsTo
- var url = "addNote.php?contactID=" + <? echo $contactID; ?>+ "&rep=" + rep + "&repID=" + repID + "&belongsTo=" + belongsTo + "¬e=" + note;
- if(Request) {
- var target2 = document.getElementById('notesBox');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- }
- }
- Request.send(null);
- }
- }
- function claimContact() {
- var rep = "<? echo $userid; ?>"
- var url = "claimContact.php?contactID=" + <? echo $contactID; ?>+ "&rep=" + rep;
- if(Request) {
- var target2 = document.getElementById('status');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- checkStatus('status');
- }
- }
- Request.send(null);
- }
- }
- function makeClient() {
- var url = "makeClient.php?contactID=" + <? echo $contactID; ?>;
- if(Request) {
- var target2 = document.getElementById('status');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- checkStatus('status');
- }
- }
- Request.send(null);
- }
- }
- function makeContact() {
- var url = "makeContact.php?contactID=" + <? echo $contactID; ?>;
- if(Request) {
- var target2 = document.getElementById('status');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- checkStatus('status');
- }
- }
- Request.send(null);
- }
- }
- function unclaimContact() {
- var rep = "<? echo $userid; ?>"
- var url = "unclaimContact.php?contactID=" + <? echo $contactID; ?>+ "&rep=" + rep;
- if(Request) {
- var target2 = document.getElementById('status');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- checkStatus('status');
- }
- }
- Request.send(null);
- }
- }
- function deleteNote(noteID, belongsTo) {
- var belongsTo = belongsTo
- var url = "deleteNote.php?contactID=" + <? echo $contactID; ?> + "&belongsTo=" + belongsTo + "¬eID=" + noteID;
- if(Request) {
- var target2 = document.getElementById('notesBox');
- Request.open("GET", url, true);
- Request.onreadystatechange = function() {
- if (Request.readyState == 4 && Request.status == 200) {
- target2.innerHTML = Request.responseText;
- }
- }
- Request.send(null);
- }
- }
- // End hiding JavaScript statements -->
- </script>
- <link href="../cc.css" rel="stylesheet" type="text/css">
- <?
- $query = "SELECT * from contacts WHERE contactID = $contactID";
- $result = mysql_query($query) or die('Sorry, could not get entires at this time ');
- echo "<div class=\"subMenu\" align=\"left\">";
- echo "<a href=\"index.php?content=contacts/view-all.php\">all contacts</a> | <a href=\"index.php?content=contacts/view-mine.php\">my contacts</a> | <a href=\"index.php?content=contacts/view-claimed.php\">all claimed</a> | <a href=\"index.php?content=contacts/view-unclaimed.php\">unclaimed</a> | <a href=\"index.php?content=contacts/view-blacklisted.php\">blacklisted</a>";
- echo "</div>";
- echo "<div id=\"borderPad\" align=\"left\">";
- $row=mysql_fetch_array($result, MYSQL_ASSOC);
- $contactID = $row['contactID'];
- $repID = $row['repID'];
- $phone= $row['phone'];
- $busName = $row['busName'];
- $fname = $row['fname'];
- $lname = $row['lname'];
- $status = $row['status'];
- $email = $row['email'];
- $address = $row['address'];
- $city = $row['city'];
- $state = $row['state'];
- $title = $row['title'];
- $zip = $row['zip'];
- $website = $row['website'];
- $industry = $row['industry'];
- $belongsTo = $repID;
- // Contact Status
- if ($status == 0){
- $statusMsg = "Has not been contacted (<span onClick=\"claimContact()\" style=\"cursor:pointer;\">claim</span>)";
- } elseif ($status == 1){
- $statusMsg = "Contact is not interested. <u>DO NOT CONTACT</u>";
- } elseif ($status == 2){
- $statusMsg = "Contact has been assigned to another rep";
- } else {
- $statusMsg = "Contact is a client";
- }
- if ($title){
- $ifTitle = $title;
- } else {
- $ifTitle = '';
- }
- $fullAddress = 0;
- if (!$address){
- $fullAddress = 1;
- }
- if (!$city){
- $fullAddress = 1;
- }
- if (!$state){
- $fullAddress = 1;
- }
- if (!$zip){
- $fullAddress = 1;
- }
- $proAddress = str_replace (' ', '+', $address);
- $proCity = str_replace (' ', '+', $city);
- echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
- echo "<tr>";
- echo "<td>";
- // Left column
- echo "<h2>$busName</h2>";
- echo "Industry: $industry<br><br><strong>Contact Info</strong><br>Contact: $fname $lname $ifTitle<br>Phone: $phone <br> Email: $email (compose email)<br>Website: $website<br><br>";
- echo "<strong>Address</strong><br>$address <br>$city, $state $zip";
- if ($fullAddress == 0) {
- echo "(<a href=\"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=$proAddress+$proCity+$state+$zip\" target=\"blank\">get directions</a>)";
- }
- echo "</td>";
- // Right Column
- echo "<td valign=\"top\" align=\"right\">";
- ?><div id="status"></div>
- <?
- echo "</td>";
- echo "</tr>";
- echo "</table>";
- echo "</div>";
- ?>
- <div id="notesBox">
- <?
- $query2 = "SELECT noteID, contactID, salesRep, DATE_FORMAT( noteDate, '%c/%e/%Y @ %l:%i %p'), note FROM notes WHERE contactID = $contactID ORDER BY noteDate ASC";
- $result2 = mysql_query($query2) or die('Sorry, could not get entires at this time ');
- while($row2=mysql_fetch_array($result2, MYSQL_ASSOC))
- {
- $noteID = $row2['noteID'];
- $contactID = $row2['contactID'];
- $salesRep = $row2['salesRep'];
- $noteDate = $row2["DATE_FORMAT( noteDate, '%c/%e/%Y @ %l:%i %p')"];
- $note = $row2['note'];
- echo "<div class=\"notes\" align=\"left\">";
- echo "$noteDate - $salesRep <span onClick=\"deleteNote('$noteID','$belongsTo')\" style=\"cursor:pointer;\">[delete comment]</span><br>$note";
- echo "</div>";
- }
- echo "<span class=\"cursor\" onClick=\"document.getElementById('noteForm').style.display=''\">add note</span>";
- echo "<div id=\"noteForm\" style=\"display:none;\">
- <label>
- <textarea name=\"note\" cols=\"65\" rows=\"8\" class=\"notes\" id=\"note\"></textarea>
- </label>
- <label><br>
- </label>
- <label>
- <input type=\"button\" name=\"button2\" id=\"button2\" value=\"Nevermind\" onClick=\"document.getElementById('noteForm').style.display='none'\">
- </label>
- <input type=\"button\" name=\"button\" id=\"button\" value=\"Submit\" onClick=\"newNote('$belongsTo')\">";
- ?>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <td><? include('../includes/footer.inc.php'); ?></td>
- </tr>
- </table>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- <?
- $con = // server connection info ;
- $contactID = $_GET['contactID'];
- $newNote = $_GET['note'];
- $salesRep = $_GET['rep'];
- $repID = $_GET['repID'];
- $belongsTo = $_GET['belongsTo'];
- // Add new comment
- $query = "INSERT INTO notes (`noteID`,`contactID`,`salesRep`,`noteDate`,`note`, `salesRepID`)VALUES (NULL , '$contactID', '$salesRep', NOW( ) , '$newNote', '$repID')";
- $result = mysql_query($query) or die('Our note system appears to be having issues. One of the Matts probably broke it. Error 1');
- $query1 = "INSERT INTO alertsNote (`alertID` ,`contactID` ,`toto` ,`from`) VALUES (NULL , '$contactID', '$belongsTo', '$salesRep')";
- $result1 = mysql_query($query1) or die('Our note system appears to be having issues. One of the Matts probably broke it.');
- // All passed, show the new comments.
- $query2 = "SELECT noteID, contactID, salesRep, DATE_FORMAT( noteDate, '%c/%e/%Y @ %l:%i %p'), note FROM notes WHERE contactID = $contactID ORDER BY noteDate ASC";
- $result2 = mysql_query($query2) or die('Sorry, could not get entires at this time ');
- while($row2=mysql_fetch_array($result2, MYSQL_ASSOC))
- {
- $noteID = $row2['noteID'];
- $contactID = $row2['contactID'];
- $salesRep = $row2['salesRep'];
- $noteDate = $row2["DATE_FORMAT( noteDate, '%c/%e/%Y @ %l:%i %p')"];
- $note = $row2['note'];
- ?>
- <?
- echo "<div class=\"notes\" align=\"left\">";
- echo "$noteDate - $salesRep <span onClick=\"deleteNote($noteID, $belongsTo)\" style=\"cursor:pointer;\">[delete comment]</span><br>$note";
- echo "</div>";
- }
- echo "<span class=\"cursor\" onClick=\"document.getElementById('noteForm').style.display=''\">add note</span>";
- echo "<div id=\"noteForm\" style=\"display:none;\">
- <label>
- <textarea name=\"note\" cols=\"45\" rows=\"5\" class=\"notes\" id=\"note\"></textarea>
- </label>
- <label><br>
- </label>
- <label>
- <input type=\"button\" name=\"button2\" id=\"button2\" value=\"Nevermind\" onClick=\"document.getElementById('noteForm').style.display='none'\">
- </label>
- <input type=\"button\" name=\"button\" id=\"button\" value=\"Submit\" onClick=\"newNote('$belongsTo')\">";
- $query2 = "SELECT DISTINCT salesRepID FROM notes WHERE contactID = $contactID";
- $result2 = mysql_query($query2) or die('Sorry, could not get entires at this time ');
- while($row2=mysql_fetch_array($result2, MYSQL_ASSOC))
- {
- $salesRepID = $row2['salesRepID'];
- echo $userID;
- echo "<br>";
- echo $salesRepID;
- if($salesRepID == $belongsTo){} else {
- $query1 = "INSERT INTO alertsNote (`alertID` ,`contactID` ,`toto` ,`from`) VALUES (NULL , '$contactID', '$salesRepID', '$salesRep')";
- $result1 = mysql_query($query1) or die('Our note system appears to be having issues. One of the Matts probably broke it.');
- }
- }
- ?>
Thanks!