projekt_1 /imapMailChecker/3_webnode_de.php

Language PHP Lines 64
MD5 Hash 12be8c54804b1d9ecdbdb03fb933ee15
Repository https://github.com/dimon36/projekt_1.git View Raw File
 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
<?
$db = new edb($db_data);

$curl_start = new Curl;


/* try to connect */
$inbox = imap_open($IMAPhostname,$IMAPusername,$IMAPpassword) or die('Cannot connect to Imap: ' . imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

/* if emails are returned, cycle through each... */
if($emails) {
	
	/* begin output var */
	$output = '';
	
	/* put the newest emails on top */
	rsort($emails);
	
	/* for every email... */
	foreach($emails as $email_number) {
		
		/* get information specific to this email */
		$overview = imap_fetch_overview($inbox,$email_number,0);
		$message = imap_fetchbody($inbox,$email_number,1);
		if (preg_match("/Qml0dGUgYmVzdMOkdGlnZSBkZWluZSBCZWVwd29ybGQ/i", $overview[0]->subject)) {
		    //echo $overview[0]->subject;
		    $Message[] = $message;
		}
		
		$i++;
		If ($i > 3) continue;
	}
} 
/* close the connection */



//TODO test
//$email_received = file_get_contents("email.txt", "r");
echo $email_received = str_get_html($Message[0]);
//echo $email_received;
//RegExp email and to the $ok goes a confirmation link
preg_match_all("!http:\/\/www.beepworld.de\/verify\/?'?([^ \"'>]+)\"?'?.*?!is",$email_received,$ok); 


//Goes to the link from email and click confirm
$url_to_confirm = $ok[0][0];
$curl_confirm = new Curl;

$response = $curl_confirm->get($url_to_confirm);
$response->body;
$confirm_page = $response->body;
$confirm_page = str_get_html($confirm_page);
$to_reg['name'] = @$confirm_page->find("#box_login_name", 0) -> value;
$to_reg['email'] = $to_reg['name'].$to_reg['domain_email'];
$to_reg['url'] = "http://".$to_reg['name'].".beepworld.de/";
if ($to_reg['name'] != '')
	$db->s("INSERT INTO `saved_accounts_beepworld_de` (`id`, `email`, `name`, `pass`, `url`) VALUES (NULL, '".$to_reg['email']."', '".$to_reg['name']."', '".$to_reg['pass']."', '".$to_reg['url']."');");
Back to Top