Exemplo n.º 1
0
 public static function generateToken($type, $user)
 {
     if (strlen($user) != 8) {
         return null;
     }
     return new Token($type, $user, random_hex(14), random_hex(8));
 }
Exemplo n.º 2
0
		
		<p>You can choose background color, text color and link color. Click on input with color which you want to change and choose new color on color wheel or just click <strong><a href="<?php 
echo basename(__FILE__);
?>
" rel="nofollow">random colors</a></strong>.</p>


<?php 
if (isset($_GET['bgcolor']) && isset($_GET['textcolor']) && isset($_GET['linkcolor'])) {
    $bgcolor = $_GET['bgcolor'];
    $textcolor = $_GET['textcolor'];
    $linkcolor = $_GET['linkcolor'];
} else {
    $bgcolor = random_hex();
    $textcolor = random_hex();
    $linkcolor = random_hex();
}
?>
	
		<table>
			<tr>
				<td>Background color:</td>
				<td><input type="text" style="background:<?php 
echo $bgcolor;
?>
" class="js-bg-color text medium_width" value="<?php 
echo $bgcolor;
?>
" />
				</td>
				<td rowspan="3">
<?php

function random_hex()
{
    $characters = "ABCDEF0123456789";
    $hexadecimal = "#";
    for ($i = 1; $i <= 6; $i++) {
        $position = rand(0, strlen($characters) - 1);
        $hexadecimal .= $characters[$position];
    }
    return $hexadecimal;
}
$text_color = random_hex();
$bg_color = random_hex();
if ($text_color == $bg_color) {
    $text_color = random_hex();
}
$font_size = 100 + rand(0, 20) * 5;
$aligns = array("center", "left", "right", "justify");
$text_align = $aligns[rand(0, 3)];
$styles = array("bold", "italic", "underline", "uppercase");
$style = $styles[rand(0, 3)];
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>You Are Aweosme!</title>
                    <div class="img-responsive center-block color-block" style="background-color:<?php 
$color = random_hex();
echo $color;
?>
">
                        <strong><p class="text-center center"><?php 
echo $color;
?>
</p></strong>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-md-4 col-xs-6">
                <div class="thumbnail">
                    <div class="img-responsive center-block color-block" style="background-color:<?php 
$color = random_hex();
echo $color;
?>
">
                        <strong><p class="text-center center"><?php 
echo $color;
?>
</p></strong>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>