So for a project I’m working on, it is necessary to login by simply filling out an option on a dropdown menu and then clicking submit (no password field).
Any search I do on the topic returns info about making those neat dropdown menus akin to that of twitter. And when I attempted this myself a great abomination of a server error occurred.
<?php
mysql_connect("localhost", "root", "mypassword")or die("cannot connect");
mysql_select_db("lunch_punch")or die("cannot select DB");
$myname=$_POST['myname'];
session_register("myname");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
<?php
session_start();
if(!session_is_registered(myname)){
header("location:home.html");
}
?>
<html>
<body>
Login Successful
</body>
</html>
Here ive put together this example/tut as I suspect your looking at a really old tutorial;
Its very simple to follow and covers alot of aspects including safely connecting to a database using PDO and querying it, session control, and the use of a simple class and accessing its methods. Hope it helps.