الفصل الثالث
58
النص 1-3 البرمجي dbx_urls.php (تابع)
36.
$url = urldecode ($url);
37.
$sql = "delete from URLS where URL =
'$url'";
38.
}
39.
40.
$result = @dbx_query($dbconn, $sql); if( $result == 0) {
41.
echo "<P>ERROR ADDING URL:
dbx_error($dbconn);
42.
} else {
43.
print("<p>$action: $url succeeded! <p>");
44.
}
45.
}
46.
47.
48.
?>
49.
50.
51.
52,
/*** MAIN ***/
$dbconn = dbx_connect ($MODULE, $server, $database, $user, $password) or die("CANNOT CONNECT TO DATABASE");
<h1>PHP DBX URL Organizer</h1>
<form action=dbx_urls.php method=post>
<p><b>Add a URL:</b>
<br>Url: <input type="text" name="url" maxlength="128" value="http://"> Description: <input type="text"
name="description"> <input type="submit" name="addurl"
value="Add URL!">
</form>
if(isset($addurl)) {
url("add", $dbconn, $url, $description);
if(isset($delete)) {
url("delete", $dbconn, $delete, "");
53.
54.
<?
55.
56.
57.
}
58.
59.
60.
}
61.
62.
63.
64.
?>
65,
66.
<?
67.
} else {
68. ?>
69.
<p>
$sql = "select * from URLS";
$result = get_urls ($dbconn, $sql);
if(sizeof($result->data) == 0) {
<h3>Sorry, there are no URLS in the database. You should add some.
ص٥٨