$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("List of resources (newest comes first)","yes"); // print "
$may_edit"; if ($may_edit == "Y") { print "

"; print "Add

"; } $i = 0; $color = $yellow; $result = mysql_query("select * from resources order by date desc"); if (!$result) { print "Error extracting information about resources"; exit; } if (mysql_num_rows($result) > 0) { // der er rækker $heading = "Y"; while ($resources = 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 resources in the database at this time"; } print "
Area Heading Description Date  
// xxxxx-type----
".$resources["subject"]." ".$resources["heading"]." ".$resources["description"]." ".$resources["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 resources (heading) values (\"New\")"); if (!$result) { errormsg("Error creating new resource"); } $result = mysql_query("select * from resources where heading = \"New\""); if ($resources = mysql_fetch_array($result)) { $id = $resources["id"]; $result = mysql_query("update resources set heading = \"\" where id = \"$id\""); } else { print "
Error removing new label from new resource
"; } $function = "edit"; } if ($function == "remove") { $result = mysql_query("delete from resources 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("./resources.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 resources where id = \"$id\""); $resources = mysql_fetch_array($result); print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print "
Heading:
Url:
Subject:
Description:
Important resource (Y/N):
Y => Will show up on all visit/wg homepages!
"; print ""; print "
"; } if ($function == "save") { $date_s = date("Y-m-d"); print html_start("Resource database: Save information","logo"); $result = mysql_query("update resources set heading = \"$heading\", subject = \"$subject\", url = \"$url\", description = \"$description\", important = \"$important\", date = \"$date_s\" where id=\"$id\""); print "

Saving information, please wait...

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