so im messing around with some php and for some reason in_array() won't pickup if something is within the array, correctly?
index.php:
<form action="login.php" method="get">
<input name="username" type="text" />
<input name="password" type="password" />
<input id="submit" type="submit" />
</form>
login.php:
<?php
$username = $_GET["username"];
$password = $_GET["password"];
include('data/user_data.php');
if(in_array($username, $users)):
echo "in array";
else: echo "not in array";
endif;
?>
user_data.php:
<?php $users = array(
dextermb => array("dextermb", "password"),
tonymb => array("tonymb", "password2")
)
?>
When inputting "dextermb" or "tonymb" into username and submitting I get the result "not in array" even though it is in the array?
Thoughts on what might be the issue?
$users = array('dextermb' => 'password1', 'tonymb' => 'password2');