Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Auth perziura

Parašė Marius L T· 2010 Vas. 4 19:02:06
#17

Nu va ziurekit: Cia taip turetu but.



cia java kodo pavizdys

    private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesButtonActionPerformed
                    {
                String auth = "true";

                try{
                    URL url = new URL ("www.rsbot.hostzi.com/perz.php?user_name="+usernameForm+"&user_password="+passwordForm+"");
                    BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream( )) );
                    String line;

                    while ( (line  = reader.readLine( )) != null ) {
                        if ( line.contains(auth) ) {
                            startScript = true;
                        }
                    }
                }
                catch ( Exception e ){
                }
                    startScript = false;
            }




ir cia gavau dar viena koda and php fusion bet jis man neveikia:
<?php

 
/*

| In case you have input fields on the previous page where

| you can give the user name and password.

*/

 

//Select database entry with the given username
require_once "setuser.php";

$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$_POST['user_name']."'");


//Check if the given username exists

$rows = dbrows($result);

if ($rows) {

$cgroup = dbarray($result);

if (md5(md5($_POST['user_password'])) == $cgroup['user_password']) {

//use the explode function to check

$usergroup = explode(".",$cgroup['user_groups']);

//assuming your group ID is 2 (p.s: don't tell me you don't know how to get the group ID)

if (in_array("1", $usergroup)) {

echo "You are in the group";

} else {

echo "You are not in the group";

} else {

echo "wrong password!";

}

} else { echo "No user name such as ".$_POST['username']; }



?>



Redagavo Marius L T· 2010 Vas. 4 23:02:27