Documentation TYPO3 par Ameos |
00001 <?php 00002 error_reporting(E_ALL); 00003 ini_set('mssql.datetimeconvert',0); 00004 00005 function tmssql() 00006 { 00007 print "<h3>mssql</h3>"; 00008 $db = mssql_connect('JAGUAR\vsdotnet','adodb','natsoft') or die('No Connection'); 00009 mssql_select_db('northwind',$db); 00010 00011 $rs = mssql_query('select getdate() as date',$db); 00012 $o = mssql_fetch_row($rs); 00013 print_r($o); 00014 mssql_free_result($rs); 00015 00016 print "<p>Delete</p>"; flush(); 00017 $rs2 = mssql_query('delete from adoxyz',$db); 00018 $p = mssql_num_rows($rs2); 00019 mssql_free_result($rs2); 00020 00021 } 00022 00023 function tpear() 00024 { 00025 include_once('DB.php'); 00026 00027 print "<h3>PEAR</h3>"; 00028 $username = 'adodb'; 00029 $password = 'natsoft'; 00030 $hostname = 'JAGUAR\vsdotnet'; 00031 $databasename = 'northwind'; 00032 00033 $dsn = "mssql://$username:$password@$hostname/$databasename"; 00034 $conn = &DB::connect($dsn); 00035 print "date=".$conn->GetOne('select getdate()')."<br>"; 00036 @$conn->query('create table tester (id integer)'); 00037 print "<p>Delete</p>"; flush(); 00038 $rs = $conn->query('delete from tester'); 00039 print "date=".$conn->GetOne('select getdate()')."<br>"; 00040 } 00041 00042 function tadodb() 00043 { 00044 include_once('../adodb.inc.php'); 00045 00046 print "<h3>ADOdb</h3>"; 00047 $conn = NewADOConnection('mssql'); 00048 $conn->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind'); 00049 // $conn->debug=1; 00050 print "date=".$conn->GetOne('select getdate()')."<br>"; 00051 $conn->Execute('create table tester (id integer)'); 00052 print "<p>Delete</p>"; flush(); 00053 $rs = $conn->Execute('delete from tester'); 00054 print "date=".$conn->GetOne('select getdate()')."<br>"; 00055 } 00056 00057 00058 $ACCEPTIP = '127.0.0.1'; 00059 00060 $remote = $_SERVER["REMOTE_ADDR"]; 00061 00062 if (!empty($ACCEPTIP)) 00063 if ($remote != '127.0.0.1' && $remote != $ACCEPTIP) 00064 die("Unauthorised client: '$remote'"); 00065 00066 ?> 00067 <a href=tmssql.php?do=tmssql>mssql</a> 00068 <a href=tmssql.php?do=tpear>pear</a> 00069 <a href=tmssql.php?do=tadodb>adodb</a> 00070 <?php 00071 if (!empty($_GET['do'])) { 00072 $do = $_GET['do']; 00073 switch($do) { 00074 case 'tpear': 00075 case 'tadodb': 00076 case 'tmssql': 00077 $do(); 00078 } 00079 } 00080 ?>