Kod:
<?php
* *validateAuth();
* *exit();
* *function validateAuth() {
* * * *$Registered = array(array("username" => "USER", "password" => "PASS"),
* * * *);
* * * *$outputString = '';
* * * *$username = addslashes(htmlspecialchars(urldecode(strtolower($_GET['username']))));
* * * *$password = sha1(addslashes(htmlspecialchars(urldecode(strtolower($_GET['password' ])))));
* * * *for($i = 0; $i < count($Registered); $i++) {
* * * * * *if($Registered[$i]['username'] == $username && sha1($Registered[$i]['password']) == $password) {
* * * * * * * *echo("Valid");
* * * * * * * *exit();
* * * * * * * *break;
* * * * * * }
* * * *}
* * * *echo("Invalid");
* * * *exit();
* *}
?>
Här har vi PHP koden. ^
Kod:
public void Authentication(){
try {
String auth = Config.AUTH;
String pass = Config.PASS;
String s1 = "";
URL url = new URL("http://www.vortexbot.com/authorization.php?username="+
* *java.net.URLEncoder.encode(auth, "UTF-8") +"&password="+ java.net.URLEncoder.encode(pass, "UTF-8"));
URLConnection urlconnection = url.openConnection();
BufferedReader bufferedreader = null;
bufferedreader = new BufferedReader(new InputStreamReader(urlconnection.getInputStream()));
s1 = bufferedreader.readLine();
if(auth.equals(""))
{
System.out.println("You must enter an auth and pass in your Settings.ini");
System.exit(0);
}
if(pass.equals(""))
{
System.out.println("You must enter an auth and pass in your Settings.ini");
System.exit(0);
}
if(!s1.equals("Valid"))
{
System.out.println("Incorrent Auth and/or Pass");
System.exit(0);
}
bufferedreader.close();
} catch (Exception e) {
System.out.println("Connection failed..");
System.out.println("You may be behind a firewall..");
System.out.println(e.getMessage());
System.exit(0);
*}
}
Och här har vi Java koden ^