HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/promic.komma-mediadesign.nl/wwwroot/inlogValidation.php
<?php

session_start();
 
// maak een connectie:
$conn=mysql_connect('YDAWBH119', 'promic_kms_user', '49Iodd&3kd)3sWq!p') or die("<h1>Promic website is not available</h1><p>It's not possible to connect to the website<br />
Please try again later.<br/><br/>Our apologies for the inconvenience</p>" .
mysql_error() ) ;
//open de database:
mysql_select_db('promic_kms') or die("<hr/>Het spijt me, database niet gevonden: <br/>" .
mysql_error());

include("functions.php");
 
if(isset($_POST['email']) && isset($_POST['password'])) {
	$username = $_POST['email'];
	$password = $_POST['password'];
	
	$username = checkData($username);
	$password = checkData($password);
	$password = sha1($password);
	
	$query = sprintf("SELECT accounts.account_id, accounts.emailadres, accounts.wachtwoord, accounts.aanhef, accounts.achternaam, accounts.status, accounts.geactiveerd, accounts.akkoord_voorwaarden FROM accounts WHERE emailadres = '%s' AND wachtwoord = '%s' LIMIT 0,1", $username, $password);
	$result = mysql_query($query);
	$record = mysql_fetch_assoc($result);
	$datum = date("d.m.y");
	$tijd = date("H:i:s");  
	$id = $record['account_id'];
	$emailadres = $record['emailadres'];
	$wachtwoord = $record['wachtwoord'];
	$aanhef = $record['aanhef'];
	$achternaam = $record['achternaam'];
	$geactiveerd = $record['geactiveerd'];
	$status = $record['status'];
	$av_akkoord = $record['akkoord_voorwaarden'];
			
	if($result){
		if ($emailadres == $username && $wachtwoord == $password){
			
			$taal_input =  $_SESSION['taal_table']['language'];
						
			if($geactiveerd == "nee" && $status == "closed"){
				echo json_encode(array("query_ok"=>"nietGeactiveerd"));
			}else if($geactiveerd == "ja" && $status == "closed"){
				echo json_encode(array("query_ok"=>"promicNietGeactiveerd"));
			}else if ($geactiveerd == "ja" && $status == "open"){
						
				$q = "INSERT INTO inloggen(account_id, taal, datum, tijd) VALUES ('$id', '$taal_input', '$datum', '$tijd')";
				$r = mysql_query($q);
				
				if($aanhef == "sir") { $aanhef = "Mr"; }
				if($aanhef == "madam") { $aanhef = "Mrs"; }
				
				$_SESSION['login']['aanhef'] = $aanhef;
				$_SESSION['login']['achternaam'] = $achternaam;
				$_SESSION['login']['id'] = $id;
				$_SESSION['valid_login'] = true;
				$_SESSION['loginPopUp'] = true;
							
				if($av_akkoord == 'ja'){ 
					$_SESSION['av_akkoord'] = true; 
					echo json_encode(array("query_ok"=>"goed","url"=>$_SESSION['taal_table']['url']['taal']."/".$_SESSION['taal_table']['url']['producten']."/"));	
				}else if($av_akkoord == 'nee'){
					echo json_encode(array("query_ok"=>"goed","url"=>$_SESSION['taal_table']['url']['taal']."/".$_SESSION['taal_table']['url']['voorwaarden_accepteren']."/"));
				}	
			}
			
		} else{
			echo json_encode(array("query_ok"=>"fout"));
		}
	}else{
		echo json_encode(array("query_ok"=>"error"));
	}
}else{
	echo json_encode(array("query_ok"=>"error"));
}
?>