Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- check.php:
- <?php
- if(isset($_POST['randomString']) && isset($_POST['md5_string'])) {
- $randomString = $_POST['randomString'];
- $md5_string = $_POST['md5_string'];
- if(md5($randomString) == $md5_string) {
- echo "Strings Match";
- } else {
- echo "Something fucked up<br>";
- echo "Received md5: " . md5($randomString) . "<br>";
- echo "POST md5: " . $md5_string;
- }
- } else {
- echo "POST was improperly set.";
- }
- ?>
- index.php:
- <?php
- $chars = '123456789abcdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPRSTUVWXYZ';
- $randomString = '';
- $linemin = 6;
- $linemax = 8;
- $lines = 4000;
- for ($x = 0; $x < $lines; $x++) {
- $randline = rand($linemin, $linemax);
- for ($i = 0; $i < $randline; $i++)
- {
- $randomString .= $chars[rand(0, strlen($chars)-1)];
- }
- $randomString .= "\n";
- }
- $md5_string = md5($randomString);
- $size = mb_strlen($randomString, 'latin1');
- if($size >= 1024) {
- $size = round($size / 1024, 2).' KB';
- } else {
- $size = $size.' bytes';
- }
- echo "Size of randomString: " . $size;
- ?>
- <form action='check.php' method='POST'>
- <textarea name='randomString' cols=20 rows=20><?php echo $randomString; ?></textarea><br>
- <input type='text' size='40' name='md5_string' value='<?php echo $md5_string; ?>'><br>
- <input type='submit' name='submit' value='submit'>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement