-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
54 lines (43 loc) · 1.43 KB
/
index.php
File metadata and controls
54 lines (43 loc) · 1.43 KB
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
<?php
include_once('config.php');
$db = @mysql_connect($database['host'], $database['username'], $database['password']) or die('Can\'t connect do database');
@mysql_select_db($database['name']) or die('The database selected does not exists');
$query = 'SELECT * FROM contacts ORDER BY lastname';
$rs = mysql_query($query);
if (!$rs)
{
die_with_error(mysql_error(), $query);
}
$num = mysql_num_rows($rs);
?>
<?php include_once('header.php') ?>
<div class="actions">
<a href="new.php">New contact</a>
</div>
<?php if ($num) : ?>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Phone</th>
<th>Mobile</th>
<th> </th>
</tr>
<?php while($row = mysql_fetch_assoc($rs)) :?>
<tr>
<td><a href="edit.php?id=<?php echo $row['id']?>" title="Modifica"><?php echo $row['lastname']?></a></td>
<td><?php echo $row['firstname']?></a></td>
<td><a href="callto://<?php echo $row['phone']?>"><?php echo $row['phone']?></a></td>
<td><a href="callto://<?php echo $row['mobile']?>"><?php echo $row['mobile']?></a></td>
<td>[<a href="remove.php?id=<?php echo $row['id']?>" title="Elimina" onclick="if (confirm('Are you sure?')) {return true;} return false;">X</a>]</td>
</tr>
<?php endwhile;?>
</table>
<?php else: ?>
Database is empty
<?php endif ?>
<?php include_once('footer.php') ?>
<?php
mysql_free_result($rs);
mysql_close($db);
?>