modulo de autenticacion
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// Generar código aleatorio
|
||||
$codigo = substr(str_shuffle("ABCDEFGHJKLMNPQRSTUVWXYZ23456789"), 0, 5);
|
||||
$_SESSION['captcha'] = $codigo;
|
||||
|
||||
// Crear imagen
|
||||
$imagen = imagecreatetruecolor(120, 40);
|
||||
|
||||
// Colores
|
||||
$fondo = imagecolorallocate($imagen, 255, 255, 255);
|
||||
$texto = imagecolorallocate($imagen, 0, 0, 0);
|
||||
|
||||
// Fondo blanco
|
||||
imagefilledrectangle($imagen, 0, 0, 120, 40, $fondo);
|
||||
|
||||
// Escribir texto
|
||||
imagestring($imagen, 5, 30, 10, $codigo, $texto);
|
||||
|
||||
// Tipo de imagen
|
||||
header("Content-type: image/png");
|
||||
|
||||
// Mostrar imagen
|
||||
imagepng($imagen);
|
||||
imagedestroy($imagen);
|
||||
?>
|
||||
Reference in New Issue
Block a user