diff --git a/sacferals/authenticate.php b/sacferals/authenticate.php index 04620f2..144686e 100755 --- a/sacferals/authenticate.php +++ b/sacferals/authenticate.php @@ -10,28 +10,37 @@ function connectdb($host, $user, $pass, $db) return $link; } - function authenticateUser() { global $link; $username = $_POST['username']; - //$email = $_POST['email']; $pass = $_POST['pass']; - $query = "select * from SacFeralsUsers where (BINARY username = BINARY '$username' or email='$username') and BINARY password = BINARY '$pass'"; - $result = mysqli_query($link, $query); - $row = mysqli_fetch_row($result); + $query = $link->prepare("select * from SacFeralsUsers where (BINARY username = BINARY ? or email=?) and BINARY password = BINARY ?"); + $query->bind_param("sss", $username, $username, $pass); + $query->execute(); + $query->bind_result($userid, $usern, $email, $password, $level); + $query->store_result(); + + if(!$query->fetch()){ + $result = 0; + }else{ + $result = $query->num_rows; + } + $query->close(); - if(mysqli_num_rows($result) == 0 || ($row[4]!=1 && $row[4]!=2)) //not valid if not activated + if($result == 0 || ($level!=1 && $level!=2)) //not valid if not activated { - $_SESSION['authenticate234252432341'] = "Not Valid!!!"; + $_SESSION['authenticate234252432341'] = "Not Valid!!!"; + if(($username != "") || ($pass != "")){ + return "Invalid credentials "; + } } else { - list($userid, $username, $email, $password, $level) = $row; $_SESSION['authenticate234252432341'] = "validuser09821"; $_SESSION['Ausername'] = $username; - //$_SESSION['Aemail'] = $email; + $_SESSION['Aemail'] = $email; $_SESSION['level'] = $level; } } diff --git a/sacferals/exportExcelScript.js b/sacferals/exportExcelScript.js deleted file mode 100644 index 4c01db6..0000000 --- a/sacferals/exportExcelScript.js +++ /dev/null @@ -1,38 +0,0 @@ -//Code for exporting html table as an Excel file - -var tableToExcel = (function() { - //General formatting for Excel sheet - var uri = 'data:application/vnd.ms-excel;base64,' - , template = '{table}
' - , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } - , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } - - //Create Excel - return function(table, name) { - //Get/format today's date - var monthName = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"]; - var today = new Date(); - var dd = today.getDate(); - if(dd<10){ - dd = '0'+dd; - } - var mm = today.getMonth(); - var yyyy = today.getFullYear(); - - //Title for top of Excel - var excelTitle = "

Sacramento Feral Resources: Reports Table - "+monthName[mm]+" "+dd+", "+yyyy+"

"; - - //Insert html table in Excel format - if (!table.nodeType) table = document.getElementById(table) - var ctx = {worksheet: name || 'Worksheet', table: excelTitle+table.innerHTML} - - //Name Excel file - today = monthName[mm] + '_' + dd + '_' + yyyy; - var link = document.createElement("a"); - link.download = "Reports_"+today+".xls"; - link.href = uri + base64(format(template, ctx)); - link.click(); - } -})() - - diff --git a/sacferals/search.php b/sacferals/search.php index c503b33..790791c 100755 --- a/sacferals/search.php +++ b/sacferals/search.php @@ -51,7 +51,7 @@ - + diff --git a/sacferals/userprofile.php b/sacferals/userprofile.php index 9b3f398..4c4403b 100755 --- a/sacferals/userprofile.php +++ b/sacferals/userprofile.php @@ -2,10 +2,9 @@ session_start(); include('authenticate.php'); $link = connectdb($host, $user, $pass, $db); - if($_SESSION['authenticate234252432341'] != 'validuser09821') { - authenticateUser(); + $loginmsg = authenticateUser(); } ?> @@ -42,6 +41,7 @@

Log in

+