$title

"; return $tmp; } function dread($table,$field,$where) { // print $where; $result = mysql_query("select $field from $table where $where"); // print "select $field from $table where $where"; if (mysql_num_rows($result) == 0) { // print "Ikke fundet"; return NULL; } else { // print mysql_num_rows($result); $data = mysql_fetch_array($result); $felt = $data["$field"]; // print "Fundet $felt"; } // print $felt; return $felt; } function dwrite($table,$field,$data,$where) { $result = mysql_query("update $table set $field=\"$data\" where $where"); if (!$result) { errormsg("Error updating last login"); } return; } function back($page) { return ""; } /* ---------------------------------------- */ /* End of functions */ /* ---------------------------------------- */ if (!$function) { $function = "list"; } if ($cookie_id) { $result = mysql_query("select * from visitors where visitor_id = \"$cookie_id\""); if (mysql_num_rows($result)) { $visitor = mysql_fetch_array($result); if ($visitor["responsibility"] = "administrator") { $may_edit = "Y"; } else { $may_edit = "N"; } } else { // errormsg("Error in cookie information - visitor-id".$cookie_id); exit; } } else { $may_edit = "N"; } //-----------Liste over dokumenter ------------- if ($function == "list") { print html_start("Links","yes"); // print "
$may_edit"; if ($may_edit == "Y") { print "

"; print "Add

"; } $i = 0; $color = $yellow; $result = mysql_query("select * from links order by subject"); if (!$result) { print "Error extracting information about links"; exit; } if (mysql_num_rows($result) > 0) { // der er rækker $heading = "Y"; while ($links = mysql_fetch_array($result)) { if ($i == 0) { print ""; // if ($may_edit == "Y") { print ""; } print ""; } // mangler indsættelse af overskrifter if ($heading == "Y") { // tjek på type for skift af overskrift } else { // evt : print ""; } $i = $i + 1; if ($color == $yellow) { $color = $white; } else { $color = $yellow; } print ""; print ""; print ""; print ""; // print ""; if ($may_edit == "Y") { print ""; } print ""; } } else { print "There are no links in the database at this time"; } print "
Type Heading Description  Date
// xxxxx-type----
".$links["subject"]." ".$links["heading"]." ".$links["description"]." ".$links["date"]." Edit"; print "
Remove
"; } if ($function == "new") { // tilføj ny record find den igen og sæt log_id og kald til edit // oprette ny record og sætte visit_id til denne $result = mysql_query("insert into links (heading) values (\"New\")"); if (!$result) { errormsg("Error creating new resource"); } $result = mysql_query("select * from links where heading = \"New\""); if ($links = mysql_fetch_array($result)) { $id = $links["id"]; $result = mysql_query("update links set heading = \"\" where id = \"$id\""); } else { print "
Error removing new label from new resource
"; } $function = "edit"; } if ($function == "remove") { $result = mysql_query("delete from links where id = \"$id\""); if (!$result) { errormsg("Error removing resource from database"); } print html_start("Resource database : List","logo"); print "

Removing resource, please wait....

"; print back("./links.php3?may_edit=Y"); } if ($function == "edit") { // opbyg formular og kald function=save med id print html_start("Resources : Edit information","logo"); $result = mysql_query("select * from links where id = \"$id\""); $links = mysql_fetch_array($result); print "
"; print ""; print ""; print ""; print ""; print ""; print "
Heading:
Url:
Subject:
Description:
"; print ""; print "
"; } if ($function == "save") { $date_s = date("Y-m-d"); print html_start("Resource database: Save information","logo"); $result = mysql_query("update links set heading = \"$heading\", subject = \"$subject\", url = \"$url\", description = \"$description\", date = \"$date_s\" where id=\"$id\""); print "

Saving information, please wait...

"; if ($may_edit) { print back("./links.php3?may_edit=Y"); } else { print back("./links.php3"); } } ?>