-
Notifications
You must be signed in to change notification settings - Fork 7
/
cell.php
executable file
·101 lines (79 loc) · 3.05 KB
/
cell.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/*************************************************************
* THE ADDRESS BOOK : version 1.04
*
* cell.php
* Displays other phone numbers. Can generate a useful list
* of cell phone numbers. A hastily-coded feature for personal
* use; may not be included in future versions, or will be
* integrated in a more streamlined manner.
*
*************************************************************/
// ** GET CONFIGURATION DATA **
require_once('constants.inc');
require_once(FILE_FUNCTIONS);
// ** OPEN CONNECTION TO THE DATABASE **
$db_link = openDatabase($db_hostname, $db_username, $db_password, $db_name);
// ** CHECK FOR LOGIN **
checkForLogin("admin","user");
// ** RETRIEVE INFORMATION **
$sql = "SELECT DISTINCT contact.id, otherphone.id, CONCAT(lastname,', ',firstname) AS fullname
FROM ".TABLE_CONTACT." as contact, ".TABLE_OTHERPHONE." as otherphone
WHERE contact.id=otherphone.id
ORDER BY fullname";
$r_contact = mysql_query($sql, $db_link)
or exit(ReportSQLError());
?>
<HTML>
<HEAD>
<TITLE>Address Book - Other Phone Numbers</TITLE>
<LINK REL="stylesheet" HREF="styles.css" TYPE="text/css">
</HEAD>
<BODY>
<P>
<CENTER>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=570>
<TR><TD CLASS="headTitle"><B>Secondary Phone Information</B></TD></TR>
<TR>
<TD CLASS="infoBox">
<BR>
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=560>
<?php
while ($tbl_contact = mysql_fetch_array($r_contact)) {
$contact_fullname = $tbl_contact['fullname'];
$contact_id = $tbl_contact['id'];
echo(" <TR VALIGN=\"top\">\n");
// Name -- Display links either as regular link or popup window
if ($displayAsPopup == 1) {
$popupLink = " onClick=\"window.open('" . FILE_ADDRESS . "?id=$id','addressWindow','width=600,height=450,scrollbars,resizable,location,menubar,status'); return false;\"";
}
echo(" <TD WIDTH=150 CLASS=\"listEntry\"><B><A HREF=\"" . FILE_ADDRESS . "?id=$contact_id\"$popupLink>$contact_fullname</A></B></TD>\n");
echo(" <TD WIDTH=150 CLASS=\"listEntry\">");
$r_otherPhone = mysql_query("SELECT * FROM ".TABLE_OTHERPHONE." AS otherphone WHERE id=$contact_id", $db_link);
$tbl_otherPhone = mysql_fetch_array($r_otherPhone);
$phone_number = $tbl_otherPhone['phone'];
$phone_type = $tbl_otherPhone['type'];
echo("$phone_number ($phone_type)");
while ($tbl_otherPhone = mysql_fetch_array($r_otherPhone)) {
$phone_number = $tbl_otherPhone['phone'];
$phone_type = $tbl_otherPhone['type'];
echo("<BR>$phone_number ($phone_type)");
}
echo(" </TD>\n");
echo(" </TR>\n");
// end while
}
?>
</TABLE>
</CENTER>
<BR>
</TD>
</TR>
<?php
printFooter();
?>
</TABLE>
</CENTER>
</BODY>
</HTML>