<?php - PowerPoint PPT Presentation

About This Presentation
Title:

<?php

Description:

on the web where we all expect to find information. available to the entire world ... Contact us by. e-mail: upetd_at_up.ac.za. telephone: 012 420 3791 (Mrs Alet Grobler) ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 2
Provided by: monica86
Category:
Tags: contact | us

less

Transcript and Presenter's Notes

Title: <?php


1
lt?php //yum install php-pgsql.x86_64 use \PDO cl
ass Connection protected dbh function __const
ruct() global dbh try dbh new PDO("
pgsqlhostlocalhostport5432dbnamedspace","dsp
ace","dspace") catch(PDOException e)
//die("Error connecting to the database. Error is
").e-gterrorInfo echo e-gtgetMessage()
protected function error(e,sql) die("Databa
se Error.ltbrgtSQL was 'sql'ltbrgtError was
".e-gtgetMessage()) global dbh dbcon ne
w Connection() uri _SERVER'REQUEST_URI' ec
ho "Initial request uri is ".uri."ltbrgt"
sql "select text_value from metadatavalue
where metadata_field_id 25 and resource_id
(select resource_id from metadatavalue where
metadata_field_id 72 and text_value ?)"
uri "http//upetd.up.ac.za".uri
if(substr(uri,-1) ! "/") uri . "/" echo "
Rebuilt uri used for query is ".uri."ltbrgt"
data array(uri) sth dbh-gtprepare(sql) t
ry sth-gtexecute(data) row sth-gtfetch()
sth-gtcloseCursor() catch (PDOException e)
die(e-gtgetMessage()) newuri row0 ech
o "newuri newuri" if(newuri "") newuri
"https//repository.up.ac.za"
else newuri substr(newuri, 21) newuri
"https//repository.up.ac.za/handle".newuri
dbcon null echo "Redirecting to ".newuri h
eader("location".newuri) ?gt
Write a Comment
User Comments (0)
About PowerShow.com