-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhsu_conn.php
43 lines (33 loc) · 1.21 KB
/
hsu_conn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/*-----
File courtesy of Sharon Tuttle.
function: hsu_conn: string string -> connection
purpose: expects an Oracle username and password,
and has the side-effect of trying to connect to
HSU's Oracle student database with the given
username and password;
returns the resulting connection object if
successful, and... CAN this end document and exit calling
PHP if NOT successful?!
-----*/
function hsu_conn($usr, $pwd)
{
// set up db connection string
$db_conn_str =
"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)
(HOST = cedar.humboldt.edu)
(PORT = 1521))
(CONNECT_DATA = (SID = STUDENT)))";
// let's try to log on using this string!
$connctn = oci_connect($usr, $pwd, $db_conn_str);
// CAN I complain and exit from HERE if fails?
if (! $connctn)
{
?>
<p> Could not log into Oracle, sorry. </p>
<?php
exit;
}
return $connctn;
}
?>