3dsmax
Member
سلام من یک کد دارlم که یک کد امنیتی میسازه حالا داخلش مشکل دارم
عکس که روی اون کد امنیتس می افته می خوام کد و کوله باشه و یک اشکال هم داره که بعد از کد امنیتی که تغیر می کنه x130000 تایپ می شود که نمی دنم چطور برش دارم و اگه زحمتی نیست می خوام یک صفه بسازم به نام chek.php که این کد را چک کنه حالا اگه می شود یه کمکی به من کنید ممنون می شوم
اینم کدهام
encode.php
image.php
test.php
عکس که روی اون کد امنیتس می افته می خوام کد و کوله باشه و یک اشکال هم داره که بعد از کد امنیتی که تغیر می کنه x130000 تایپ می شود که نمی دنم چطور برش دارم و اگه زحمتی نیست می خوام یک صفه بسازم به نام chek.php که این کد را چک کنه حالا اگه می شود یه کمکی به من کنید ممنون می شوم
اینم کدهام
encode.php
PHP:
<?php
function get_rnd_iv($iv_len){
$iv = '';
while ($iv_len-- > 0) {
$iv .= chr(mt_rand() & 0xff);
}
return $iv;
}
function md5_encrypt($plain_text, $password, $iv_len = 16){
$plain_text .= "x13";
$n = strlen($plain_text);
if ($n % 16) $plain_text .= str_repeat("0", 16 - ($n % 16));
$i = 0;
$enc_text = get_rnd_iv($iv_len);
$iv = substr($password ^ $enc_text, 0, 512);
while ($i < $n) {
$block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv));
$enc_text .= $block;
$iv = substr($block . $iv, 0, 512) ^ $password;
$i += 16;
}
return base64_encode($enc_text);
}
function md5_decrypt($enc_text, $password, $iv_len = 16){
$enc_text = base64_decode($enc_text);
$n = strlen($enc_text);
$i = $iv_len;
$plain_text = '';
$iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
while ($i < $n) {
$block = substr($enc_text, $i, 16);
$plain_text .= $block ^ pack('H*', md5($iv));
$iv = substr($block . $iv, 0, 512) ^ $password;
$i += 16;
}
return preg_replace('/\\x13\\x00*$/', '',$plain_text);
}
?>
image.php
PHP:
<?php
require_once "encode.php";
$decid = urldecode(md5_decrypt($_REQUEST['id'], $_REQUEST['key']));
header("Content-type: image/png");
$img = imageCreate(120, 50);
$color_matn = imageColorAllocate($img, 255, 255, 255);
$color_khatha = imageColorAllocate($img, 81, 102, 125);
$color_back = imageColorAllocate($img, 131, 145, 184);
imagefill($img, 0, 0, $color_back);
imageline($img,10,0,15,9,$color_khatha);
imageline($img,20,6,40,10,$color_khatha);
imageline($img,50,6,20,10,$color_khatha);
imageline($img,5,20,8,10,$color_khatha);
imageline($img,30,40,25,47,$color_khatha);
imageline($img,80,20,85,27,$color_khatha);
imageline($img,80,30,85,20,$color_khatha);
imageline($img,100,40,90,43,$color_khatha);
imageline($img,110,15,120,27,$color_khatha);
imageline($img,70,30,85,38,$color_khatha);
imageline($img,60,40,75,50,$color_khatha);
imageline($img,30,20,40,27,$color_khatha);
imageline($img,0,40,4,44,$color_khatha);
imageline($img,34,40,38,44,$color_khatha);
imageline($img,80,8,84,10,$color_khatha);
imageline($img,83,15,84,16,$color_khatha);
imageline($img,31,30,34,33,$color_khatha);
imageline($img,25,28,21,31,$color_khatha);
imageline($img,15,24,18,28,$color_khatha);
imageline($img,15,40,20,44,$color_khatha);
imageline($img,80,17,81,20,$color_khatha);
imageline($img,60,20,62,17,$color_khatha);
imageline($img,57,22,62,25,$color_khatha);
imageline($img,50,30,55,32,$color_khatha);
imageline($img,60,0,62,5,$color_khatha);
imageline($img,100,30,105,35,$color_khatha);
imageline($img,98,26,101,20,$color_khatha);
imagestring($img, 5, 20, 15, $decid, $color_matn);
imagepng($img, '', 75);
imagedestroy($img);
?>
test.php
PHP:
<form method="POST" action="chek.php">
<p><input type="text" name="kod" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<?php
require_once "encode.php";
$string = md5(rand(0, microtime()*1000000));
$verify_string = substr($string, 3, 7);
$key = md5(rand(0,999));
$encid = urlencode(md5_encrypt($verify_string, $key));
echo "<img src='image.php?id=$encid&key=$key'><br>";
echo "to verify the user would hve to type in $verify_string";
?>