/rs-data.php
PHP | 449 lines | 420 code | 2 blank | 27 comment | 94 complexity | 60eb50328e2045e74107e6586bff2ddc MD5 | raw file
- <?php
- include 'XmlDomConstruct.php';
- function getPage($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
- curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
- curl_setopt($ch, CURLOPT_URL, $url);
- $html= curl_exec($ch);
- if (!$html) {
- echo "cURL error number:" .curl_errno($ch);
- echo "cURL error:" . curl_error($ch);
- exit;
- }
- curl_close($ch);
- return $html;
- }
- //Deal with the query parameters
- $id = $_GET['id'];
- $format = $_GET['f'];
- //Check the id to see what type of item this is
- if ($id){
- if (preg_match('/^[0-9]+$/', $id) == 1) {
- $type="item";
- } else if (preg_match('/^CP[\s\+]{1}\d+$/i', $id) == 1) {
- $type = "person";
- } else if (preg_match('/^CA[\s\+]{1}\d+$/i', $id) == 1) {
- $type = "agency";
- } else if (preg_match('/^[A-Za-z0-9\/]+$/', $id) == 1) {
- $type = "series";
- } else {
- unset($id);
- }
- }
- if ($id) {
- //Get item details
- if ($type == 'item') {
- $url = "http://www.naa.gov.au/cgi-bin/Search?O=I&Number=$id";
- $result = getPage($url);
- if ($result) {
- preg_match('/<B>Title<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $title = htmlspecialchars($matches[1]);
- preg_match('/<B>Control symbol<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $control = $matches[1];
- preg_match('/HREF="SeriesDetail.asp\?M=0\&B=(.+?)"\>/', $result, $matches);
- $series = $matches[1];
- preg_match('/<B>Contents date range<\/B><BR>\r\n\t(.+?)<\/TD>/', $result, $matches);
- $cdates = preg_split('/ - /', $matches[1]);
- $contentsDates[] = array("start"=>$cdates[0], "end"=>$cdates[1]);
- preg_match('/<B>Location<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $location = $matches[1];
- preg_match('/<B>Access status<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $access = strtolower($matches[1]);
- preg_match('/<B>Extent<\/B><BR>(.*?)<\/TD>/', $result, $matches);
- $extent = $matches[1];
- //If it's been digitised find out how many pages are in the file
- if (strpos($result, "View digital copy")) {
- $digitised = "yes";
- $imgUrl = "http://naa12.naa.gov.au/scripts/imagine.asp?B=$id&I=1&SE=1";
- $imgResult = getPage($imgUrl, $ch);
- preg_match('/NAME="C" VALUE="(\d+)" ID="Hidden3"/', $imgResult, $matches);
- $pages = $matches[1];
- } else {
- $digitised = "no";
- $pages = "unknown";
- }
- $itemDetails = array("item"=>array(
- "title"=>$title,
- "series"=>$series,
- "controlSymbol"=>$control,
- "contentsDates"=>$contentsDates,
- "location"=>$location,
- "accessStatus"=>$access,
- "extent"=>$extent,
- "isDigitised"=>$digitised,
- "numberOfPages"=>$pages));
- } else {
- $error = 'Could not contact server';
- }
- } else if ($type == 'series') {
- $url = "http://www.naa.gov.au/cgi-bin/Search?Number=$id";
- $result = getPage($url);
- if ($result) {
- preg_match('/<B>Title<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $title = htmlspecialchars($matches[1]);
- preg_match('/<B>Accumulation dates<\/B><BR>\r\n\t(.+?)<\/TD>/', $result, $matches);
- $adates = preg_split('/ - /', $matches[1]);
- $accumulationDates[] = array("start"=>$adates[0], "end"=>$adates[1]);
- preg_match('/<B>Contents dates<\/B><BR>\r\n\t(.+?)<\/TD>/', $result, $matches);
- $cdates = preg_split('/ - /', $matches[1]);
- $contentsDates[] = array("start"=>$cdates[0], "end"=>$cdates[1]);
- preg_match('/<B>Predominant form<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $form = strtolower($matches[1]);
- preg_match('/<B>Quantity and location<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $quantities = preg_split('/<br>/', $matches[1]);
- foreach ($quantities as $q) {
- preg_match('/(.+?) held in (.+)/', $q, $matches);
- $quantity = $matches[1];
- $location = $matches[2];
- $holdings[] = array("location"=>$location, "quantity"=>$quantity);
- }
- //Get details of recording agencies
- preg_match('/<B>Agency \/ person recording<\/B><BR><TABLE width=100\% >(.*?)<\/TABLE>/', $result, $matches);
- preg_match_all('/<td width=30\% VALIGN=TOP >(.+?)<\/td><td width=70\% ><A HREF="AgencyDetail.asp\?M=1\&B=CA\+(\d+)">CA \d+<\/a>, (.+?)<\/td>/', $matches[1], $agencies, PREG_SET_ORDER);
- foreach ($agencies as $agency) {
- preg_match('/(.+?) - (.+)/', $agency[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- $agId = "CA $agency[2]";
- $recAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>"CA $agency[2]", "agencyTitle"=>$agency[3]);
- }
- //Get details of controlling agencies
- preg_match('/<B>Agency \/ person controlling<\/B><BR><TABLE width=100\% >(.*?)<\/TABLE>/', $result, $matches);
- preg_match_all('/<td width=30\% VALIGN=TOP >(.+?)<\/td><td width=70\% ><A HREF="AgencyDetail.asp\?M=1\&B=CA\+(\d+)">CA \d+<\/a>, (.+?)<\/td>/', $matches[1], $agencies, PREG_SET_ORDER);
- foreach ($agencies as $agency) {
- preg_match('/(.+?) - (.+)/', $agency[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- $agId = "CA $agency[2]";
- $conAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>"CA $agency[2]", "agencyTitle"=>$agency[3]);
- }
- //Follow the 'Find items in this series' link
- $itemsUrl = "http://recordsearch.naa.gov.au/scripts/SearchOF.asp?DP=2&Q=SER_SERIES_NO=QT" . $id . "QT";
- $items = getPage($itemsUrl);
- if ($items) {
- //Get the number of items in this series described on RS
- preg_match('/<TD>Items\r\n\t<\/td><td>(.*?)<\/td>/', $items, $matches);
- $numItems = $matches[1];
- //Trim the asterix of the 'More than 20.000' message
- $numItems = str_replace('*', '', $numItems);
- }
- //open the series links page and harvest the details
- $linksUrl = "http://recordsearch.naa.gov.au/scripts/SeriesDetail.asp?M=2&B=" . $id;
- $links = getPage($linksUrl);
- if ($links) {
- //Get rid of line breaks and tabs
- $links = preg_replace('/\r/', '', $links);
- $links = preg_replace('/\n/', '', $links);
- $links = preg_replace('/\t/', '', $links);
- //Previous series
- preg_match('/<B>Previous series<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/', $links, $matches);
- preg_match_all('/<TR><td width=15% VALIGN=TOP >(.*?)<\/td><td width=85% ><A HREF="SeriesDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/', $matches[1], $pseries, PREG_SET_ORDER);
- foreach ($pseries as $ps) {
- if (strpos($ps[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $s[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $ps[1];
- $end = "";
- }
- $prevSeries[] = array("start"=>$start, "end"=>$end, "seriesId"=>$ps[2], "seriesTitle"=>$ps[3]);
- }
- //Subsequent series
- preg_match('/<B>Subsequent series<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=15% VALIGN=TOP >(.*?)<\/td><td width=85% ><A HREF="SeriesDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $sseries, PREG_SET_ORDER);
- foreach ($sseries as $ss) {
- if (strpos($ss[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $s[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $ss[1];
- $end = "";
- }
- $subSeries[] = array("start"=>$start, "end"=>$end, "seriesId"=>$ss[2], "seriesTitle"=>$ss[3]);
- }
- //Controlling series
- preg_match('/<B>Controlling series<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="SeriesDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $cseries, PREG_SET_ORDER);
- foreach ($cseries as $cs) {
- if (strpos($cs[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $cs[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $cs[1];
- $end = "";
- }
- $conSeries[] = array("start"=>$start, "end"=>$end, "seriesId"=>$cs[2], "seriesTitle"=>$cs[3]);
- }
- //Controlled series
- preg_match('/<B>Controlled series<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="SeriesDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $conseries, PREG_SET_ORDER);
- foreach ($conseries as $cons) {
- if (strpos($cons[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $cons[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $cons[1];
- $end = "";
- }
- $contSeries[] = array("start"=>$start, "end"=>$end, "seriesId"=>$cons[2], "seriesTitle"=>$cons[3]);
- }
- //Related series
- preg_match('/<B>Related series<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="SeriesDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $rseries, PREG_SET_ORDER);
- foreach ($rseries as $rs) {
- if (strpos($rs[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $rs[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $rs[1];
- $end = "";
- }
- $relSeries[] = array("start"=>$start, "end"=>$end, "seriesId"=>$rs[2], "seriesTitle"=>$rs[3]);
- }
- }
- $itemDetails = array("series"=>array(
- "title"=>$title,
- "accumulationDates"=>$accumulationDates,
- "contentsDates"=>$contentsDates,
- "form"=>$form,
- "holdings"=>array("holding"=>$holdings),
- "numberOfItems"=>$numItems,
- "recordingAgencies"=>array("agency"=>$recAgencies),
- "controllingAgencies"=>array("agency"=>$conAgencies)));
- if (count($prevSeries) != 0) {
- $itemDetails["series"]["previousSeries"] = array("series"=>$prevSeries);
- }
- if (count($subSeries) != 0) {
- $itemDetails["series"]["subsequentSeries"] = array("series"=>$subSeries);
- }
- if (count($conSeries) != 0) {
- $itemDetails["series"]["controllingSeries"] = array("series"=>$conSeries);
- }
- if (count($contSeries) != 0) {
- $itemDetails["series"]["controlledSeries"] = array("series"=>$contSeries);
- }
- if (count($relSeries) != 0) {
- $itemDetails["series"]["relatedSeries"] = array("series"=>$relSeries);
- }
- } else {
- $error = 'Could not contact server';
- }
- } else if ($type == "agency") {
- $url = "http://www.naa.gov.au/cgi-bin/Search?Number=" . urlencode($id);
- $result = getPage($url);
- if ($result) {
- preg_match('/<B>Title<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $title = $matches[1];
- preg_match('/<B>Date range<\/B><BR>\r\n\t(.+?)<\/TD>/', $result, $matches);
- $dateRange = preg_split('/ - /',$matches[1]);
- $startDate = $dateRange[0];
- $endDate = $dateRange[1];
- preg_match('/<B>Status code<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $statusCodes = preg_split('/; /', $matches[1]);
- preg_match('/<B>Location<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $location = $matches[1];
- preg_match('/<B>Function<\/B><BR>(.+?)<\/TD>/', $result, $matches);
- $funcs = preg_split('/<br>/',$matches[1]);
- foreach ($funcs as $func) {
- $funcParts = preg_split('/: /', $func);
- $funcDates = preg_split('/ - /', $funcParts[0]);
- $funcName = strtolower(strip_tags($funcParts[1]));
- $functions[] = array("functionStart"=>$funcDates[0], "functionEnd"=>$funcDates[1], "functionName"=>$funcName);
- }
- //Follow the 'Find series recorded by this agency' link
- $itemsUrl = "http://recordsearch.naa.gov.au/scripts/searchOF.asp?DP=3&Q=SERIES%5FNO+IN+%28SELECT+SER%5FSERIES%5FNO+FROM+NAAS%2EDBO%2ELINKAGES+WHERE+LINK%5FTYPE%3DQTPRSQT+AND+PRV%5FREG%5FNO%3DQT" . urlencode($id) . "QT%29";
- $items = getPage($itemsUrl);
- if ($items) {
- //Get the number of items in this series described on RS
- preg_match('/<TD>Series\r\n\t<\/td><td>(.*?)<\/td>/', $items, $matches);
- $numItems = $matches[1];
- //Trim the asterix of the 'More than 20.000' message
- $numItems = str_replace('*', '', $numItems);
- }
- $linksUrl = "http://recordsearch.naa.gov.au/scripts/AgencyDetail.asp?M=2&B=" . urlencode($id);
- $links = getPage($linksUrl);
- if ($links) {
- //Get rid of line breaks and tabs
- $links = preg_replace('/\r/', '', $links);
- $links = preg_replace('/\n/', '', $links);
- $links = preg_replace('/\t/', '', $links);
- //Organisation controlling
- preg_match('/<B>Organisation controlling<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="OrganisationDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $orgs, PREG_SET_ORDER);
- foreach ($orgs as $org) {
- if (strpos($org[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $org[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $org[1];
- $end = "";
- }
- $conOrgs[] = array("start"=>$start, "end"=>$end, "orgId"=>$org[2], "orgTitle"=>$org[3]);
- }
- //Superior agency
- preg_match('/<B>Superior agency<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="AgencyDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $sagencies, PREG_SET_ORDER);
- foreach ($sagencies as $sa) {
- if (strpos($sa[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $sa[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $sa[1];
- $end = "";
- }
- $supAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>$sa[2], "agencyTitle"=>$sa[3]);
- }
- //Controlled agency
- preg_match('/<B>Controlled agency<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="AgencyDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $cagencies, PREG_SET_ORDER);
- foreach ($cagencies as $ca) {
- if (strpos($ca[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $ca[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $ca[1];
- $end = "";
- }
- $conAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>$ca[2], "agencyTitle"=>$ca[3]);
- }
- //Previous agency
- preg_match('/<B>Previous agency<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=15% VALIGN=TOP >(.*?)<\/td><td width=85% ><A HREF="AgencyDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $pagencies, PREG_SET_ORDER);
- foreach ($pagencies as $pa) {
- if (strpos($pa[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $pa[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $pa[1];
- $end = "";
- }
- $prevAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>$pa[2], "agencyTitle"=>$pa[3]);
- }
- //Subsequent agency
- preg_match('/<B>Subsequent agency<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=15% VALIGN=TOP >(.*?)<\/td><td width=85% ><A HREF="AgencyDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $nagencies, PREG_SET_ORDER);
- foreach ($nagencies as $na) {
- if (strpos($na[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $na[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $na[1];
- $end = "";
- }
- $nextAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>$na[2], "agencyTitle"=>$na[3]);
- }
- //Person associated
- preg_match('/<B>Persons associated with agency<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="PersonDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $persons, PREG_SET_ORDER);
- foreach ($persons as $person) {
- if (strpos($person[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $person[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $person[1];
- $end = "";
- }
- $assocPersons[] = array("start"=>$start, "end"=>$end, "personId"=>$person[2], "personName"=>$person[3]);
- }
- }
- $itemDetails = array("agency"=>array(
- "title"=>$title,
- "startDate"=>$startDate,
- "endDate"=>$endDate,
- "statusCodes"=>array("statusCode"=>$statusCodes),
- "location"=>$location,
- "functions"=>array("function"=>$functions),
- "numberOfSeries"=>$numItems));
- if (count($conOrgs) != 0) {
- $itemDetails["agency"]["controllingOrganisations"] = array("organisation"=>$conOrgs);
- }
- if (count($supAgencies) != 0) {
- $itemDetails["agency"]["superiorAgencies"] = array("agency"=>$supAgencies);
- }
- if (count($conAgencies) != 0) {
- $itemDetails["agency"]["controlledAgencies"] = array("agency"=>$conAgencies);
- }
- if (count($prevAgencies) != 0) {
- $itemDetails["agency"]["previousAgencies"] = array("agency"=>$prevAgencies);
- }
- if (count($nextAgencies) != 0) {
- $itemDetails["agency"]["subsequentAgencies"] = array("agency"=>$nextAgencies);
- }
- if (count($assocPersons) != 0) {
- $itemDetails["agency"]["associatedPersons"] = array("person"=>$assocPersons);
- }
- } else {
- $error = 'Could not contact server';
- }
- } else if ($type == "person") {
- $url = "http://www.naa.gov.au/cgi-bin/Search?Number=" . urlencode($id);
- $result = getPage($url);
- if ($result) {
- preg_match('/<B>Name<\/B><BR>(.+?)<\/TD>/i', $result, $matches);
- $name = $matches[1];
- preg_match('/<B>Date range<\/B><BR>\r\n\t(.+?)<\/TD>/', $result, $matches);
- $dateRange = preg_split('/ - /',$matches[1]);
- $birth = $dateRange[0];
- $death = $dateRange[1];
- $linksUrl = "http://recordsearch.naa.gov.au/scripts/PersonDetail.asp?M=2&B=" . urlencode($id);
- $links = getPage($linksUrl);
- if ($links) {
- //Get rid of line breaks and tabs
- $links = preg_replace('/\r/', '', $links);
- $links = preg_replace('/\n/', '', $links);
- $links = preg_replace('/\t/', '', $links);
- preg_match('/<B>Agencies associated with person<\/B><BR><TABLE width=100% >(.+?)<\/TABLE>/i', $links, $matches);
- preg_match_all('/<TR><td width=30% VALIGN=TOP >(.*?)<\/td><td width=70% ><A HREF="AgencyDetail.asp\?M=1\&B=.+?">(.+?)<\/a>, (.+?)<\/td><\/TR>/i', $matches[1], $agencies, PREG_SET_ORDER);
- foreach ($agencies as $a) {
- if (strpos($a[1], "-") !== false) {
- preg_match('/(.+?) - (.*)/', $a[1], $matches);
- $start = $matches[1];
- $end = $matches [2];
- } else {
- $start = $a[1];
- $end = "";
- }
- $assocAgencies[] = array("start"=>$start, "end"=>$end, "agencyId"=>$a[2], "agencyTitle"=>$a[3]);
- }
- }
- $itemDetails = array("person"=>array(
- "name"=>$name,
- "birthDate"=>$birth,
- "deathDate"=>$death));
- if (count($assocAgencies) != 0) {
- $itemDetails["person"]["associatedAgencies"] = array("agency"=>$assocAgencies);
- }
- }
- }
- } else {
- $error = 'Invalid id';
- }
- if (!$error) {
- if ($format == "json") {
- echo json_encode($itemDetails);
- } else {
- header ("content-type: text/xml");
- $dom = new XmlDomConstruct('1.0', 'utf-8');
- $dom->fromMixed($itemDetails);
- echo $dom->saveXML();
- }
- } else {
- echo $error;
- }
- ?>