-
Notifications
You must be signed in to change notification settings - Fork 10
/
email-image-verify.php
46 lines (32 loc) · 1.08 KB
/
email-image-verify.php
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
<?php
### Start Session
@session_start();
### Captial Letters And Numbers
$alphanum = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
### Generate The Verfication Code
$rand = substr(str_shuffle($alphanum), 0, 5);
### MD5 The Code And Assign It To Session
$_SESSION['email_verify'] = md5($rand);
### Create The Image (60x22)
$image = imagecreate(55, 15);
### Use White As The Background Color
$bgColor = imagecolorallocate($image, 255, 255, 255);
### Use Black As The Text Color
$textColor = imagecolorallocate($image, 0, 0, 0);
### Output The Code To The Image
imagestring($image, 5, 5, 1, $rand, $textColor);
### Date In The Past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
### Always Modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
### HTTP 1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
### HTTP 1.0
header("Pragma: no-cache");
### Set The Header To Be JPG
header('Content-type: image/jpeg');
### Send The Image To The Browser
imagejpeg($image);
### Destroy The Image
imagedestroy($image);