Jump to content

[SNIPPET] FULL DYNAMIC SIGNATURE [/SNIPPET]


Wizard

Recommended Posts

OK THIS IS NOT A TUTORIAL, THERE WILL BE NO EXPLINATION..!

 

Ok start by creating a SQL table using this through myPHPAdmin:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;


CREATE TABLE `scriptdata` (
  `username` text NOT NULL,
  `xp` int(11) NOT NULL,
  `runtime` bigint(255) NOT NULL,
  `id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


ALTER TABLE `scriptdata`
  ADD PRIMARY KEY (`id`);


ALTER TABLE `scriptdata`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

then make a php file call it what ever you want, I called mine validate.php. This file is responsible on validating the data, inserting and updating the database, it can only be accessed through custom useragent which is specified by the user (to prevent others from submitting fake details through browser)!

<?php

$useragent = "scriptX";//Change this to whatever you want, just make sure it matches w.e you put in javaside!

$ua= $_SERVER["HTTP_USER_AGENT"];
if(!preg_match('/'.$useragent.'/', $ua)) {
	echo"GTFO out of here!";
} else {
	$database_name = "";
	$servername = "localhost";//database host
	$username = "root";//database username
	$password = "";//database password

	$runtime=$gainedXp=$rsn="";

	// Create connection
	$conn = new mysqli($servername, $username, $password, $database_name;

	// Check connection
	if ($conn->connect_error) {
	    die("Connection failed: " . $conn->connect_error);
	} 

	if ($_SERVER["REQUEST_METHOD"] == "GET") {
		$rsn = mysqli_real_escape_string($conn, $_GET["rsn"]);
		$gainedXp = mysqli_real_escape_string($conn, $_GET["gainedxp"]);
		$runtime = mysqli_real_escape_string($conn,$_GET["runtime"]);

	}

	$sql = "SELECT * FROM scriptdata WHERE `username`='".$rsn."'";
	$result = $conn->query($sql);
	if($result->num_rows > 0) {

		while($row = $result->fetch_assoc()) {
			$prevXp= $row["xp"];
			$prevTime = $row["runtime"];

			$prevXp+= $gainedXp;
			$prevTime+= $runtime;

			$sql = "UPDATE scriptdata SET xp=".$prevXp.", runtime=".$prevTime." WHERE `username`='".$rsn."'";
			if($conn->query($sql) === TRUE){
				echo "DATA WAS UPDATED";
			} else {
				echo "ERROR UPDATING DATA! ". mysqli_error($conn);
			}
		}
	} else {
		$sql = "INSERT INTO scriptdata(`username`,`xp`,`runtime`) VALUES('".$rsn."',".$gainedXp.",".$runtime.")";
		if($conn->query($sql) === TRUE){
			echo "DATA INSERTED";
		} else {
			echo "ERROR INSERTING DATA!<br>". mysqli_error($conn);
		}
	}
}
?>

After that, make another php file call it w.e you want, mine is called sig.php. This is the actual file which gonna retrieve the information from the database and display them on a picture!

<?php

function ftime($time)
{
	$text = "";
	$secs = (intval(intval($time) / 1000));
	$hrs = $secs / 3600;
	$m = $secs / 60 % 60;
	$secs = $secs % 60;

	if($hrs < 10) {
		$text.="0".$hrs;
	} else {
		$text.=$hrs;
	}
	$text.=":";
	if($m < 10) {
		$text.="0".$m;
	} else {
		$text.=$m;
	}
	$text.=":";
	if($sec < 10) {
		$text.="0".$secs;
	} else {
		$text.=$secs;
	}
	return $text;
}
$database_name = "";
$servername = "localhost";//database host
$username = "root";//database username
$password = "";//database password

$sig_file = "sig.png";//signature picture path
$font_path = 'bboron.ttf';//font file path


$rsn = "";
$conn = new mysqli($servername, $username, $password, $database_name);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

if ($_SERVER["REQUEST_METHOD"] == "GET") {
	$rsn = mysqli_real_escape_string($conn, $_GET["rsn"]);
}

$sql = "SELECT * FROM scriptdata WHERE username='".$rsn."'";
$result = $conn->query($sql);
if($result->num_rows > 0) {
	while($row = $result->fetch_assoc()) {

		//Set the Content Type
		header('Content-type: image/jpeg');
		
		$xp = $row["xp"];
		$runtime = $row["runtime"];
		$formated = ftime($runtime);
		// Create Image From Existing File
		$pngimage = imagecreatefrompng($sig_file);

		// Allocate A Color For The Text
		$black = imagecolorallocate($pngimage, 0, 0, 0);

		// Print Text On Image
                //imagettftext(imagefile, text size, ange, x, y, text color, font_file, text);
		imagettftext($pngimage, 16, 0, 115, 45, $black, $font_path, $rsn);

		imagettftext($pngimage, 16, 0, 115, 85, $black, $font_path, $xp);

		imagettftext($pngimage, 16, 0, 115, 124, $black, $font_path, $formated);

		// Send Image to Browser
		imagepng($pngimage);

		// Clear Memory
		imagedestroy($pngimage);
	}
} else {
	echo "user does not exist!";
}

?>

JUST MAKE SURE TO CHANGE THE INFO OF THE DB, FONT AND IMAGE TO MATCH YOURS!

 

 

Now to send data from your script use this first declare two variables

//Your url
private static final String URL = "http://yourwebsite.com/validate.php?";
//put it the same as the one in PHP!
private static final String USER_AGENT = "scriptX";

and use this function to send data

public static void sendData(String rsn, int xp, long runtime) {
		String vars = URL + "rsn=" + rsn + "&gainedxp=" + xp + "&runtime=" + runtime;
		StringBuilder result = new StringBuilder();
		URL url;
		try {
			url = new URL(vars);
			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
			conn.setRequestMethod("GET");
			conn.addRequestProperty("User-Agent", USER_AGENT);
			BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
			String line;
			while ((line = rd.readLine()) != null) {
				result.append(line);
			}
			System.out.println(result.toString());
			rd.close();
		} catch (Exception e) {
		}

	}

And thats all!

 

Few notes, 

1) The data only being sent are the username, xp gained and runtime.. you can add more but you have to edit all the files to match your changes.

2) dont judge my php i dont even know that language i just put some code i googled together!

3)Thanks for Xylate for helping me with php.

 

you can see live example : http://scriptme.ga/sig.php?rsn=zezima (Remove if this is against the rules)

Have fun!

post-513-0-39867000-1472693328_thumb.png

Edited by Wizard
  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...