Drezard Posted March 15, 2007 Share Posted March 15, 2007 Hello, my script should be displaying a form when loaded only prob is it doesnt display anything... <?php class class_session { function user_check($username, $password) { $query = "SELECT * FROM user_ids WHERE username='$username' AND password='$password'"; $result = mysql_query($query); $count = mysql_num_rows($result); if ($count == 0) { $this->validate = FALSE; } if ($count == 1) { $this->validate = TRUE; } } function user_loginform() { if (!isset($_POST['submit'])) { echo "<form action='' method='post'> Username: <input name='username' type='text'> <hr> Password: <input name='password' type='password'> <hr> <input type = 'submit' name = 'submit'> </form>"; } if (isset($_POST['submit'])) { if (!isset($_POST['username']) || trim($_POST['username']) == '') { die("Please enter your username"); } if (!isset($_POST['password']) || trim($_POST['password']) == '') { die("Please enter your password"); } $username = $_POST['username']; $password = $_POST['password']; $this->user_check($username, $password); if ($this->validate == FALSE) { die("Username or password incorrect"); } if ($this->validate == TRUE) { $timestamp = date('YmdGi'); $ip = $_SERVER['REMOTE_ADDR']; $query = "UPDATE user_ids SET timestamp='$timestamp', ip='$ip' WHERE username='$username'"; echo "Sucessfully logged in"; } } } } ?> Its running here... www.wintersword.com/users.php - Cheers, Daniel Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted March 15, 2007 Share Posted March 15, 2007 The code you have showed us only defines the class, it doesn't call it anywhere, so thats why it doesn't output anything. you need to do something like: $session = new class_session; $session->user_loginform(); Quote Link to comment Share on other sites More sharing options...
Drezard Posted March 16, 2007 Author Share Posted March 16, 2007 Yea i have a page like that... thats what users.php is... Quote Link to comment Share on other sites More sharing options...
btherl Posted March 16, 2007 Share Posted March 16, 2007 And what is in users.php? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.