Jump to content

Scripto Problemos


Drezard

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/42825-scripto-problemos/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.