Example #1
0
session_start();
$code = generateRandomString();
$_SESSION["code"] = $code;
$im = imagecreatetruecolor(90, 20);
imagesavealpha($im, true);
$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $trans_colour);
//We need now a Text-Color corresponding to our chosen style:
//Idea: get the theme-id, then the theme-style-file, open it and extract the corresponding hex color
//Dies passiert, indem das Theme-file mit einem text-leser geöffnet wird, die richtige zeile gesucht wird
//danach wird die farbe (ein hex-wert) in rgb umgewandelt
$theme = 0;
if (isset($_SESSION['user_id'])) {
    //Das vom Benutzer gewählte Theme abfragen
    $db = new DB();
    $theme = $db->getTheme($_SESSION['user_id'])[0]['theme'];
    $db->closeConnection();
}
$theme_name = getThemeName($theme);
$style_file = fopen("../styles/" . $theme_name . ".css", "r");
if ($style_file) {
    while (($line = fgets($style_file)) !== false) {
        if (strstr($line, '--button-text-color')) {
            //DIe richttige Farbe auslesen
            $text_color = strstr($line, '#');
            $col_array = hex2rgb($text_color);
            $fg = imagecolorallocate($im, $col_array[0], $col_array[1], $col_array[2]);
            //imagestring($im, 5, 7, 0,  $code, $fg);
            imagettftext($im, 15, 0, 2, 20, $fg, "font/captcha.ttf", $code);
            header("Cache-Control: no-cache, must-revalidate");
            header('Content-type: image/png');
Example #2
0
echo ucfirst($theme);
?>
</b></p>
    </div>
    <div class="double-content-right">
        <h2>Darstellung wählen</h2>
        <?php 
//Den Spinner für das Theme printen
$themes = getThemeName("", true);
echo "<form method='post' name='form' action='content/changeTheme.php'>";
echo "<select name='theme'>";
$counter = 0;
foreach ($themes as $th) {
    echo "<option value=" . $counter;
    $db = new DB();
    if ($db->getTheme($id)[0]['theme'] == $counter) {
        echo " selected";
    }
    $db->closeConnection();
    //Erster Buchstabe des Theme-Namens gross
    echo ">" . ucfirst($th) . "</option>";
    $counter++;
}
echo "</select>";
echo "<input type='submit' value='Ändern'>";
echo "</form>";
?>
    </div>
</div>
<!--Neues Passwort-Form-->	
<div class="double-content-row">