1<?php
2error_reporting(E_ALL);
3ini_set('mssql.datetimeconvert',0);
4
5function tmssql()
6{
7	print "<h3>mssql</h3>";
8	$db = mssql_connect('JAGUAR\vsdotnet','adodb','natsoft') or die('No Connection');
9	mssql_select_db('northwind',$db);
10
11	$rs = mssql_query('select getdate() as date',$db);
12	$o = mssql_fetch_row($rs);
13	print_r($o);
14	mssql_free_result($rs);
15
16	print "<p>Delete</p>"; flush();
17	$rs2 = mssql_query('delete from adoxyz',$db);
18	$p = mssql_num_rows($rs2);
19	mssql_free_result($rs2);
20
21}
22
23function tpear()
24{
25include_once('DB.php');
26
27	print "<h3>PEAR</h3>";
28	$username = 'adodb';
29	$password = 'natsoft';
30	$hostname = 'JAGUAR\vsdotnet';
31	$databasename = 'northwind';
32
33	$dsn = "mssql://$username:$password@$hostname/$databasename";
34	$conn = DB::connect($dsn);
35	print "date=".$conn->GetOne('select getdate()')."<br>";
36	@$conn->query('create table tester (id integer)');
37	print "<p>Delete</p>"; flush();
38	$rs = $conn->query('delete from tester');
39	print "date=".$conn->GetOne('select getdate()')."<br>";
40}
41
42function tadodb()
43{
44include_once('../adodb.inc.php');
45
46	print "<h3>ADOdb</h3>";
47	$conn = NewADOConnection('mssql');
48	$conn->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind');
49//	$conn->debug=1;
50	print "date=".$conn->GetOne('select getdate()')."<br>";
51	$conn->Execute('create table tester (id integer)');
52	print "<p>Delete</p>"; flush();
53	$rs = $conn->Execute('delete from tester');
54	print "date=".$conn->GetOne('select getdate()')."<br>";
55}
56
57
58$ACCEPTIP = '127.0.0.1';
59
60$remote = $_SERVER["REMOTE_ADDR"];
61
62if (!empty($ACCEPTIP))
63 if ($remote != '127.0.0.1' && $remote != $ACCEPTIP)
64 	die("Unauthorised client: '$remote'");
65
66?>
67<a href=tmssql.php?do=tmssql>mssql</a>
68<a href=tmssql.php?do=tpear>pear</a>
69<a href=tmssql.php?do=tadodb>adodb</a>
70<?php
71if (!empty($_GET['do'])) {
72	$do = $_GET['do'];
73	switch($do) {
74	case 'tpear':
75	case 'tadodb':
76	case 'tmssql':
77		$do();
78	}
79}
80?>