Seite 1 von 1

user passwort überprüfen

Verfasst: 12.07.2006 16:36
von oern
Hi,

ich möchte in meinen Script überprüfen ob ein user ein user ist d.h. ich habe meinen usernamen und passwort und übergebe die nun an mein script wenn ich ein angemeldeter user mit richtige passwort eingebe soll das script true aus geben, wenn nicht false. Nur wie mache ich das.

Hier mein ansatz (absolute sicher gibt immer false aus :D )

Code: Alles auswählen

<?php

  include("config.php");// phpbb_root_path etc
  include("user.php");

  include($phpbb_root_path . 'extension.inc');
  include($phpbb_root_path . 'common.'.$phpEx);
  
  if ($_GET['mode']=="check_user") {
    $error=false;
    if ($_GET['user']=="") {$error=true;} else {$user=$_GET['user'];}
    if ($_GET['pw']=="") {$error=true;} else {$pw=$_GET['pw'];}
  
    if ($error==false) {
      $userclass= new Tphpbbex_user();
      if  ($userclass->isuser($user, $pw)) { echo("true"); } else { echo("false"); }
    }
  }

?>
Die klasse Tphpbbex_user:

Code: Alles auswählen

<?php
  
  include($phpbb_root_path . "includes/functions_validate.$phpEx");

  class Tphpbbex_user{

    function isuser($username, $password){

      $pass_result = validate_complex_password ($this->username, $this->password);
      if ($pass_result['error']== false) {
              return true;
      } else {return false;}
      
    }
    
  }

?>
Wie gesagt das script gibt immer false aus. Was mache ich falsch ?

thx, Björn

Verfasst: 12.07.2006 17:42
von oern
Hab geschafft

Code: Alles auswählen

function isuser($username, $password){

      $array = get_userdata($username);

      if ( (md5($password)==$array['user_password']) && ($array['user_active']) )
      {
              return true;
      } else {
              return false;
      }