1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
<?php
require_once('inc/header.inc.php');
require_once('functions/font_generator_detail.function.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="colorPicker/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="colorPicker/js/jquery.simple-color.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.fontColor').simpleColor({
cellWidth: 9,
cellHeight: 9,
border: '1px solid #333333',
buttonClass: 'button',
displayColorCode: false
});
$('.fontBg').simpleColor({
cellWidth: 9,
cellHeight: 9,
border: '1px solid #333333',
buttonClass: 'button',
displayColorCode: false
});
});
</script>
</head>
<body>
<?php
$error = 'Page introuvable!';
if (isset($_POST['submit']))
{
$font_selected = $DB->query('SELECT * FROM fonts WHERE id =:id', array('id' => $_POST['id']));
$count_id = $DB->queryCount('SELECT id FROM fonts WHERE id =:id', array('id' => $_POST['id']));
//Création de l'image 1 avec $_GET
$sampleText = htmlentities($_POST['sampleText']);
$fontSize = htmlentities($_POST['fontSize']);
$fontColor = htmlentities($_POST['fontColor']);
$fontBg = htmlentities($_POST['fontBg']);
$size_list = array('20','25','30','40');
$font_file= 'fonts/'.$font_selected[0]->file;
$nom_image= 'fonts_img/txt_sample.png';
//Création de l'image 2 avec paramètres prédéfinis
$fontBg_details = '#ffffff';
$fontColor_details = '#323232';
$fontSize_details = 40;
$sampleText_details =
'abcdefghijklm
nopqrstuvwxyz
ABCDEFGHIJKLM
NOPQRSTUVWXYZ
1234567890
.,;:\'"[!?]+-*/=()';
$font_file_details= 'fonts/'.$font_selected[0]->file;
$nom_image_details= 'fonts_img/type_sample.png';
if(in_array($fontSize, $size_list) AND is_numeric($_POST['id']) AND $count_id == 1 AND preg_match("#^\#[a-zA-Z0-9]{6}$#i", $fontColor) AND preg_match("#^\#[a-zA-Z0-9]{6}$#i", $fontBg))
{
?>
<form action="font_detail.php" method="post" name="form" title="Pick a color" lang="fr">
<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>"/>
<label for="sampleText">Votre texte :</label>
<input name="sampleText" type="text" size="20" maxlength="40" value="<?php echo $sampleText; ?>"/>
<label for="fontSize">Taille :</label>
<select name="fontSize" id="fontSize">
<option value="<?php echo $fontSize; ?>" selected="selected"><?php echo $fontSize; ?></option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
<label for="fontColor">Couleur texte : <?php echo $_POST['fontColor']; ?></label>
<input name="fontColor" class="fontColor" value="<?php echo $_POST['fontColor']; ?>"/>
<label for="fontBg">couleur fond : <?php echo $_POST['fontBg']; ?></label>
<input name="fontBg" class="fontBg" value="<?php echo $_POST['fontBg']; ?>"/>
<input name="submit" type="submit" value="Valider" />
</form>
<?php
//Affichage image 1
CreateImage($fontBg,$fontColor,$fontSize,$sampleText,$font_file,$nom_image);
echo '<p><img src="'.$nom_image.'"></p><br/>';
//Affichage image 2
CreateImageDetail($fontBg_details,$fontColor_details,$fontSize_details,$sampleText_details,$font_file_details,$nom_image_details);
echo '<p><img src="'.$nom_image_details.'"></p><br/>';
}//End if
else
{
echo '<p>'.$error.'</p><p><a href="index.php">retour index</a></p>';
}
}//End if isset
else
{
$font_selected = $DB->query('SELECT * FROM fonts WHERE id =:id', array('id' => $_GET['id']));
$count_id = $DB->queryCount('SELECT id FROM fonts WHERE id =:id', array('id' => $_GET['id']));
$count_name = $DB->queryCount('SELECT name FROM fonts WHERE name =:name', array('name' => $_GET['font']));
$count_file = $DB->queryCount('SELECT file FROM fonts WHERE file =:file', array('file' => $_GET['file']));
//Création de l'image 1 avec $_GET
$sampleText = htmlentities($_GET['sampleText']);
$fontSize = htmlentities($_GET['fontSize']);
$fontColor = htmlentities($_GET['fontColor']);
$fontBg = htmlentities($_GET['fontBg']);
$size_list = array('20','25','30','40');
$font_file= 'fonts/'.$font_selected[0]->file;
$nom_image= 'fonts_img/txt_sample.png';
//Création de l'image 2 avec paramètres prédéfinis
$fontBg_details = '#ffffff';
$fontColor_details = '#323232';
$fontSize_details = 40;
$sampleText_details =
'abcdefghijklm
nopqrstuvwxyz
ABCDEFGHIJKLM
NOPQRSTUVWXYZ
1234567890
.,;:\'"[!?]+-*/=()';
$font_file_details= 'fonts/'.$font_selected[0]->file;
$nom_image_details= 'fonts_img/type_sample.png';
if(in_array($fontSize, $size_list) AND is_numeric($_GET['id']) AND $count_id == 1 AND preg_match("#^\#[a-zA-Z0-9]{6}$#i", $fontColor) AND preg_match("#^\#[a-zA-Z0-9]{6}$#i", $fontBg) AND $count_name == 1 AND $count_file == 1)
{
?>
<form action="font_detail.php" method="post" name="form" title="Pick a color" lang="fr">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>"/>
<label for="sampleText">Votre texte :</label>
<input name="sampleText" type="text" size="20" maxlength="40" value="<?php echo $sampleText; ?>"/>
<label for="fontSize">Taille :</label>
<select name="fontSize" id="fontSize">
<option value="<?php echo $fontSize; ?>" selected="selected"><?php echo $fontSize; ?></option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
<label for="fontColor">Couleur texte : <?php echo $_GET['fontColor']; ?></label>
<input name="fontColor" class="fontColor" value="<?php echo $_GET['fontColor']; ?>"/>
<label for="fontBg">couleur fond : <?php echo $_GET['fontBg']; ?></label>
<input name="fontBg" class="fontBg" value="<?php echo $_GET['fontBg']; ?>"/>
<input name="submit" type="submit" value="Valider" />
</form>
<?php
//Affichage image 1
CreateImage($fontBg,$fontColor,$fontSize,$sampleText,$font_file,$nom_image);
echo '<p><img src="'.$nom_image.'"></p><br/>';
//Affichage image 2
CreateImageDetail($fontBg_details,$fontColor_details,$fontSize_details,$sampleText_details,$font_file_details,$nom_image_details);
echo '<p><img src="'.$nom_image_details.'"></p><br/>';
}//End if
else
{
echo '<p>'.$error.'</p><p><a href="index.php">retour index</a></p>';
}
}//End else
?>
</body>
</html> |
Partager