<HTML>
<HEAD>
<TITLE></TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="000000" >
<?                                                                                              //The following code will not be seen
function Secure() { 
    /* 
        Make the connection to the database. The syntax is 
        odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' ); 
        $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' , '', '' ); 
    if (!$cnx) 
		{ 
        Error_handler( "Error in odbc_connect" , $cnx ); 
    	} 
		$formNameVar = $_POST["userName"];
		$userNameVar = $_POST["userName"];
		$password = $_POST["password"];
		$passwordB =$_POST["password2"];
		$Computer =$_POST["compName"];

    // send a simple odbc query . returns an odbc cursor 
	 //	$cur= odbc_exec( $cnx, "SELECT ID,FirstName, LastName,PCatagory,describe,Resolution FROM data WHERE ID =$dataVar" ); 
 	$cur= odbc_exec( $cnx, "SELECT ID,User,Pass,ComputerName,HelpDeskAddress FROM accounts WHERE User ='$userNameVar'" );  

        // fetch the succesive result rows 
    while( odbc_fetch_row( $cur ) ) 
		{ 
     //   $nbrow++; 
		$ID= odbc_result( $cur, 1 ); // get the field "UserName" 
        $UserNameVarPlus= odbc_result( $cur, 2 ); // get the field "UserName" 
        $PasswordVarPlus= odbc_result( $cur, 3 ); // get the field "Password" 
		$webpage= odbc_result( $cur, 5 );
		}
		odbc_close( $cnx); 

	if (!$cur) 
		{ 
        Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); 
		odbc_close( $cnx); 
    	} 
	//	$userNameVar = $_POST["userName"];
	//	$password = $_POST["password"];
		
	if ($password == "")
			{
			$password = "Wrong No Way ERROR eRoR OPS DID IT AGAIN Hopefully not one more time one two";
			}
			
			if ($Computer !== "")
			{
			$userNameVar = $_POST["userName"];
			$Computer = $_POST["compName"];
			$cur= odbc_exec( $cnx, "UPDATE accounts SET ComputerName = '$Computer' WHERE User ='$userNameVar'" );
			}  
			
  	if (( $password == $PasswordVarPlus ) && ( $formNameVar == $UserNameVarPlus))                                    //Set the Password and Username here -
	   		{
			$userNameVar = $_POST["userName"];
			$cur= odbc_exec( $cnx, "UPDATE accounts SET Pass = '$passwordB' WHERE User ='$userNameVar'" );
			$fp = fopen( $webpage, "r" ) or die ("Couldn't open $webpage") ;   //Open the page
           while ( ! feof( $fp ) )                                                             //
          	{  
			print fgets( $fp, 1024 ) ; 
		    }//Display page in browser
  			print "Password has been updated!<br>";
			}
			else                                                                                            //If password or Username incorrect
   			{
   			echo "<br><br>";                                                                        //Display and error message and
   			echo "<p align=center>" ;                                                            //instructions
   			echo "<b>Authentication Failed<br><br>Please hit your 'Back' button and try again.</b>" ; 
   			echo "</p>" ;
   			}
			odbc_close( $cnx); 
			odbc_close_all();
		
                           //Chosen web page
		     


			}

Secure();
?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center"><a href="http://www.quickintranet.com"><img src="http://www.quickintranet.com/infosec/quickintranet-com.jpg" border="0"></a><br>
  CopyRight 2004<br>
  QuickIntranet.com<br>
  <a href="http://www.quickintranet.com">http://www.QuickIntranet.com </a></p>
</BODY>
</HTML>