我有多個MS Access數據庫放在Linux Web服務器上,它由GoDaddy託管。但是當我嘗試通過我的登錄門戶登錄時,它給了我錯誤:致命錯誤:未在第11行上的/home/buerer/public_html/flames/events/checklogin.php中找到類'COM'致命錯誤:在PHP 5.6中找不到類'COM'
這裏是對於checklogin.php文件代碼:
<?php
session_start();
ini_set('display_errors', 1); error_reporting(E_ALL);
global $rs;
// parse username and password sent from signup form post to php variables
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$access = realpath("db/users.mdb");
$_SESSION['accessLevel'] = "READ DATA FROM TABLE";
//create connection as COM object
$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
//create recordset as new COM object
$rs = new COM('ADODB.Recordset') or exit('Cannot create recordset.');
//dim connection with driver and password
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$access;Jet OLEDB:Database Password='softball1234';");
//$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$access;Jet OLEDB:Database Password=$mypassword;");
$sql = "SELECT * FROM tblUsers WHERE VendorCode='$myusername' and Password='$mypassword'";
//execute sql in connection to database to store are recordset
$rs = $conn->Execute($sql);
if ($rs->EOF) {
echo "Wrong Username or Password";
print "<br>Click <a href=main_login.php>here</a> to try again.";
//print $rs->ErrorMsg(); // Displays the error message if no results could be returned
}else{
$_SESSION['AccessLevel'] = $rs->fields["AccessLevel"]->value;
$_SESSION['MailingListID'] = $rs->fields["MailingListID"]->value;
$count = 0;
while (!$rs->EOF) {
$count++;
$rs->MoveNext();
} //while !$rs->eof
if($count>0){
// Register $myusername, $mypassword and AccessLevel and redirect to file "selection.php"
$_SESSION['username'] = $myusername;
$_SESSION['password'] = $mypassword;
//$_SESSION['AccessLevel'] = $rs->fields["AccessLevel"]->value;
header("location:selection.php");
}else {
echo "Wrong Username or Password";
print "<br>Click <a href=main_login.php>here</a> to try again.";
session_destroy();
}
}
?>
我不能在我的GoDaddy的文件管理器,找到php.ini文件中,沒有人知道如何解決這個問題?
COM類是僅限Windows的擴展。你對nix服務器有什麼期望? –
是的,我可以@ webDev – Bowen
檢查此鏈接訪問php.ini文件https://stackoverflow.com/questions/16140917/how-to-access-the-php-ini-file-in-godaddy-shared-hosting -linux –