Ik ben in het bezit van een acces database die ik wil benaderen van mijn sit alleen komt ie telkens met onderstaand script. er gaat dus iets niet goed.
odbc koppeling heb ik wel gemaakt met verwijzing naar de database.
als ik een helpdesk melding heb gemaakt dan moet die in deze database komen.
Als ik dan op apply klik komt er een nieuwe pagina met onderstaand:
<?php
//Created by Leon Kappert
//22-07-2010
//Requires M.S. Access 2000 with DNS configured to helpdesk pass=''
//Revision 1
//Apollo Vredestein Help Desk
$sysDate= date("h:i M d Y", mktime());
function HTML_Head() {
echo "
<HTML><HEAD>
<TITLE>Verwerkings Formulier</TITLE>
</HEAD>
<BODY BGCOLOR=\"#D5D5AB\">";
}
function HTML_Foot() {
echo "</body></html>";
}
function Database_Entries($msg) {
}
if ( ! empty( $PCatagory ) ) {
// print "<ul>\n\n";
foreach ( $PCatagory as $value ) {
// print "<li>$value<br>\n";
}
//print "</ul>";
function Output_Entries() {
/*
Make the connection to the database. The syntax is
odbc_connect( 'Helpdesk' , 'kappert_l', 'Leon_19_83' );
$cnx will hold the
pconnect is used to establish a persistent database
connection to the Database until the procedure is completed.
*/
$cnx = odbc_connect( 'HelpDesk' ,kappert_l, Leon_19_83);
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
// send a simple odbc query . returns an odbc cursor
$cur= odbc_exec( $cnx, "select ID,FirstName,LastName,PCatagory,describe,mainDate from data" );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
$nbrow=0; //Local variable to count number of rows
while( odbc_fetch_row( $cur ) )
{
$ID= odbc_result( $cur, 1 ); // get the field "Index"
$FirstName= odbc_result( $cur, 2 ); // get the field "FirstName"
$LastName= odbc_result( $cur, 3 ); // get the field "LastName"
$PCatagory= odbc_result( $cur, 4 ); // get the field "PCatagory"
$value= odbc_result( $cur, 5 ); // get the field "describe"
$dateA= odbc_result( $cur, 6 ); // get the field "date"
$nbrow++;
}
// close the connection. important if persistent connection are "On"
odbc_close( $cnx);
print "ID$ID";
}
function Error_Handler( $msg, $cnx ) {
echo "$msg \n";
odbc_close( $cnx);
exit();
}
function Enter_New_Entry($FirstName,$LastName,$PCatagory,$sysDate) {
print "<br>";
print " Thank you $FirstName.";
print "<br>";
print "Please print this page as a reciept.";
print "<br>";
print " Your order number is : ";
/*
First, we create a connection to our ODBC source. This is done by creating
a connection. Once this is done, we are returned an ODBC connection number.
We use this number to use the ODBC functions within PHP.
*/
/*
Here i'm going to try and read in the values for the menu
*/
}
print "</ul>";
/*
End Test Code
*/
$status = 'open';
$cnx = odbc_connect( 'HelpDesk' , '', '' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
//$describe1 = stripslashes($describe);//trying to eliminate the Apostrophe problem
$describe1 = ereg_replace("\'","`",$describe);
$SQL_Exec_String = "Insert Into data (FirstName, LastName, PCatagory,describe,Status,mainDate)
Values ('$FirstName', '$LastName', '$value', '$describe1', '$status','$sysDate')";
$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
odbc_close( $cnx);
}
$strOldEntries = "Previous Entries in database";
$strNewEntries = "Updated version of databse (after entries)";
//provide notification to X Computers that new help desk call has been logged.
// send a simple odbc query . returns an odbc cursor
// $cur= odbc_exec( $cnx, "select ID,User,Pass,FirstName,LastName,ComputerName from accounts" );
// if (!$cur) {
// Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
// }
// $nbrow=0; //Local variable to count number of rows
// while( odbc_fetch_row( $cur ) )
// {
// $ID= odbc_result( $cur, 1 ); // get the field "Index"
// $user= odbc_result( $cur, 2 ); // get the field "FirstName"
// $pass= odbc_result( $cur, 3 ); // get the field "LastName"
// $firstName1= odbc_result( $cur, 4 ); // get the field "PCatagory"
// $lastName1 =odbc_result( $cur, 5 ); // get the field "PCatagory"
// $compName= odbc_result( $cur, 6 ); // get the field "describe"
// $nbrow++;
// $host = "$compName";
// $result = exec("ping $host");
// $findme = 'TTL=128';
// $pos = strpos($result, $findme);
// if ($pos == false)
// {
// echo "<br> Help Desk Call Logged, One or more IP routs was Down <br> ";
// echo " ";
// }
// else
// {
// echo "<br>Help Desk Staff Notified<br>.";
// $msg = "New Help Desk Call Logged by $FirstName $LastName as $value! ";
// $path = 'c:winnt\\system32\net send ';
// $ip = $compName;
// $fullmsg = $path . $ip . ' ' . $msg;
// $go = shell_exec( $fullmsg );
//}
// }
// close the connection. important if persistent connection are "On"
HTML_Head();
Database_Entries($strOldEntries);
//Output_Entries();
//Enter_New_Entry($FirstName,$LastName,$PCatagory,$value);
//Database_Entries($strNewEntries);
//Output_Entries();
HTML_Foot();
print "<br>";
?>
<div align="center">
<p> </p>
<p><strong>Klik hier om terug te gaan naar <a href="default.htm">Help Desk
Page.</a> </strong></p>
<p> </p>
<p> </p>
<p><a href="http://www.apollovredestein.com">
Leon Kappert<br>
CopyRight 2010<br>
</div>
1.663 views