zelf ook mail ontvangen bij inschrijving nieuw lid
Nu heb ik wat php files bekeken, maar ik heb geen idee waar ik dat neer moet zetten. Ik heb wel het PHP script gevonden waar de verificatie mail staat, maar het is me net wat te ingewikkeld.
Is er iemand die mij daar bij kan helpen, dus een extra scriptje plaatsen zodat ik ook een mail ontvang
Alvast bedankt,
Linda Hagenaars
Als je even het PHP-stukje plaatst waarin de verificatiemail wordt verstuurd zou je ons best helpen...
hier is het script
Code (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
47
48
49
50
51
52
53
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
<?php
/* (C) ABK-Soft Ltd., 2004-2006
IMPORTANT: This is a commercial software product
and any kind of using it must agree to the ABK-Soft
Ltd. license agreement.
It can be found at http://abk-soft.com/license.doc
This notice may not be removed from the source code. */
include("./_include/core/main_start.php");
class CRegisterConfirmEmail extends CHtmlBlock
{
function action()
{
$hash = get_param("hash", "");
if($hash)
{
$user_id = DB::result("SELECT user_id FROM user WHERE active_code = " . to_sql($hash, "Text") .";");
if($user_id)
{
DB::execute("UPDATE user SET active_code = '' WHERE user_id=" . $user_id . "");
set_session("user_id", $user_id);
set_session("user_id_verify", $user_id);
DB::execute("UPDATE user SET last_ip='" . $_SERVER['REMOTE_ADDR'] . "' WHERE user_id=" . $user_id . "");
redirect("profile.php?cmd=confirmed");
}
else
{
redirect('index.php');
}
}
else
{
redirect('index.php');
}
}
function parseBlock(&$html)
{
parent::parseBlock($html);
}
}
$page = new CRegisterConfirmEmail("", $g['tmpl']['dir_tmpl_main'] . "index.html");
$header = new CHeader("header", $g['tmpl']['dir_tmpl_main'] . "_header.html");
$page->add($header);
$footer = new CFooter("footer", $g['tmpl']['dir_tmpl_main'] . "_footer.html");
$page->add($footer);
include("./_include/core/main_close.php");
?>
/* (C) ABK-Soft Ltd., 2004-2006
IMPORTANT: This is a commercial software product
and any kind of using it must agree to the ABK-Soft
Ltd. license agreement.
It can be found at http://abk-soft.com/license.doc
This notice may not be removed from the source code. */
include("./_include/core/main_start.php");
class CRegisterConfirmEmail extends CHtmlBlock
{
function action()
{
$hash = get_param("hash", "");
if($hash)
{
$user_id = DB::result("SELECT user_id FROM user WHERE active_code = " . to_sql($hash, "Text") .";");
if($user_id)
{
DB::execute("UPDATE user SET active_code = '' WHERE user_id=" . $user_id . "");
set_session("user_id", $user_id);
set_session("user_id_verify", $user_id);
DB::execute("UPDATE user SET last_ip='" . $_SERVER['REMOTE_ADDR'] . "' WHERE user_id=" . $user_id . "");
redirect("profile.php?cmd=confirmed");
}
else
{
redirect('index.php');
}
}
else
{
redirect('index.php');
}
}
function parseBlock(&$html)
{
parent::parseBlock($html);
}
}
$page = new CRegisterConfirmEmail("", $g['tmpl']['dir_tmpl_main'] . "index.html");
$header = new CHeader("header", $g['tmpl']['dir_tmpl_main'] . "_header.html");
$page->add($header);
$footer = new CFooter("footer", $g['tmpl']['dir_tmpl_main'] . "_footer.html");
$page->add($footer);
include("./_include/core/main_close.php");
?>
Euh... nee
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
$eigen_email = "[email protected]";
$onderwerp = "nieuwe registratie";
$message = "Iemand heeft zich geregistreerd";
mail($eigen_email, $onderwerp, $message, "From: [email protected]");
?>
$eigen_email = "[email protected]";
$onderwerp = "nieuwe registratie";
$message = "Iemand heeft zich geregistreerd";
mail($eigen_email, $onderwerp, $message, "From: [email protected]");
?>
[email protected] = je email-adress waar je de mail van een nieuwe registratie wilt ontvangen.
[email protected] = het adress waar het vandaan komt, of dit kan ligt eraan of je een mailbox hebt bij je hosting pakket.
Code (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
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
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
<?php
function user_has_role_admin_view()
{
global $g_user;
return $g_user['user_id'] && ($g_user['role'] == 'admin' || $g_user['role'] == 'demo_admin');
}
function user_has_role_admin_edit()
{
global $g_user;
return $g_user['user_id'] && ($g_user['role'] == 'admin');
}
function hash_generate($hash_length = 64)
{
$chars = "1234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$i = 0;
$hash = "";
while ($i < $hash_length)
{
$hash .= $chars{mt_rand(0, strlen($chars)-1)};
$i++;
}
return $hash;
}
function user_change_email($user_id, $email)
{
global $g;
do {
$hash = hash_generate(40);
} while(DB::result("SELECT user_id FROM user WHERE active_code = " . to_sql($hash, "Text") .";") != "");
DB::execute("UPDATE user SET active_code = " . to_sql($hash, "Text") . ", mail = " . to_sql($email, "Text") . " WHERE user_id=" . $user_id . "");
$subject = DB::result("SELECT subject FROM email_auto WHERE note='confirm_email'");
$text = DB::result("SELECT text FROM email_auto WHERE note='confirm_email'");
$subject = str_replace("{title}", $g['main']['title'], $subject);
$text = str_replace("{title}", $g['main']['title'], $text);
$url = $link = "http://".$_SERVER['HTTP_HOST'] . str_replace("_include/lib/","",str_replace("\\", "", dirname($_SERVER['PHP_SELF'])));
$text = str_replace("{confirm_link}", $url.'/confirm_email.php?hash='.$hash, $text);
send_mail(
$email,
$g['main']['info_mail'],
$subject,
$text
);
}
function friend_delete($user_id, $friend_id)
{
DB::execute("DELETE FROM friends WHERE user_id=" . to_sql($user_id, 'Number') . " AND fr_user_id = " . to_sql($friend_id, 'Number'));
DB::execute("DELETE FROM friends WHERE user_id=" . to_sql($friend_id, 'Number') . " AND fr_user_id = " . to_sql($user_id, 'Number'));
}
function friend_add($user_id, $friend_id)
{
friend_delete($user_id, $friend_id);
DB::execute("INSERT INTO friends SET user_id=" . to_sql($user_id, 'Number') . ", fr_user_id = " . to_sql($friend_id, 'Number') . ", DATA='".date('Y-m-d H:i:s')."'");
DB::execute("INSERT INTO friends SET user_id=" . to_sql($friend_id, 'Number') . ", fr_user_id = " . to_sql($user_id, 'Number') . ", DATA='".date('Y-m-d H:i:s')."'");
}
function user_blocked($user_id, $this_user_id = null)
{
global $g_user;
$this_user_id = $this_user_id ? $this_user_id : $g_user['user_id'];
$check_mail = DB::result("select user_to from users_block where user_from=".to_sql($this_user_id)." and user_to=".to_sql($user_id));
if($check_mail)
return true;
$check_block = DB::result("select user_to from user_block_list where user_from=".to_sql($this_user_id)." and user_to=".to_sql($user_id). " AND (im > 0 OR audio > 0 OR video > 0 OR game > 0)");
if($check_block)
return true;
return false;
}
function user_mail_blocked_by($user_id)
{
global $g_user;
$check_mail = DB::result("select user_to from users_block where user_from=".to_sql($user_id)." and user_to=".to_sql($g_user['user_id']));
if($check_mail)
return true;
return false;
}
function user_service_blocked_by($user_id, $service)
{
global $g_user;
$check_block = DB::result("select user_to from user_block_list where user_from=".to_sql($user_id)." and user_to=".to_sql($g_user['user_id']). " and " . $service . " > 0");
if($check_block)
return true;
return false;
}
function user_select_by_id($user_id)
{
DB::query("SELECT * FROM `user` WHERE `user_id` = " . to_sql($user_id) . " LIMIT 1;");
if($row = DB::fetch_row())
{
return $row;
}
return null;
}
function user_has_role_admin_view()
{
global $g_user;
return $g_user['user_id'] && ($g_user['role'] == 'admin' || $g_user['role'] == 'demo_admin');
}
function user_has_role_admin_edit()
{
global $g_user;
return $g_user['user_id'] && ($g_user['role'] == 'admin');
}
function hash_generate($hash_length = 64)
{
$chars = "1234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$i = 0;
$hash = "";
while ($i < $hash_length)
{
$hash .= $chars{mt_rand(0, strlen($chars)-1)};
$i++;
}
return $hash;
}
function user_change_email($user_id, $email)
{
global $g;
do {
$hash = hash_generate(40);
} while(DB::result("SELECT user_id FROM user WHERE active_code = " . to_sql($hash, "Text") .";") != "");
DB::execute("UPDATE user SET active_code = " . to_sql($hash, "Text") . ", mail = " . to_sql($email, "Text") . " WHERE user_id=" . $user_id . "");
$subject = DB::result("SELECT subject FROM email_auto WHERE note='confirm_email'");
$text = DB::result("SELECT text FROM email_auto WHERE note='confirm_email'");
$subject = str_replace("{title}", $g['main']['title'], $subject);
$text = str_replace("{title}", $g['main']['title'], $text);
$url = $link = "http://".$_SERVER['HTTP_HOST'] . str_replace("_include/lib/","",str_replace("\\", "", dirname($_SERVER['PHP_SELF'])));
$text = str_replace("{confirm_link}", $url.'/confirm_email.php?hash='.$hash, $text);
send_mail(
$email,
$g['main']['info_mail'],
$subject,
$text
);
}
function friend_delete($user_id, $friend_id)
{
DB::execute("DELETE FROM friends WHERE user_id=" . to_sql($user_id, 'Number') . " AND fr_user_id = " . to_sql($friend_id, 'Number'));
DB::execute("DELETE FROM friends WHERE user_id=" . to_sql($friend_id, 'Number') . " AND fr_user_id = " . to_sql($user_id, 'Number'));
}
function friend_add($user_id, $friend_id)
{
friend_delete($user_id, $friend_id);
DB::execute("INSERT INTO friends SET user_id=" . to_sql($user_id, 'Number') . ", fr_user_id = " . to_sql($friend_id, 'Number') . ", DATA='".date('Y-m-d H:i:s')."'");
DB::execute("INSERT INTO friends SET user_id=" . to_sql($friend_id, 'Number') . ", fr_user_id = " . to_sql($user_id, 'Number') . ", DATA='".date('Y-m-d H:i:s')."'");
}
function user_blocked($user_id, $this_user_id = null)
{
global $g_user;
$this_user_id = $this_user_id ? $this_user_id : $g_user['user_id'];
$check_mail = DB::result("select user_to from users_block where user_from=".to_sql($this_user_id)." and user_to=".to_sql($user_id));
if($check_mail)
return true;
$check_block = DB::result("select user_to from user_block_list where user_from=".to_sql($this_user_id)." and user_to=".to_sql($user_id). " AND (im > 0 OR audio > 0 OR video > 0 OR game > 0)");
if($check_block)
return true;
return false;
}
function user_mail_blocked_by($user_id)
{
global $g_user;
$check_mail = DB::result("select user_to from users_block where user_from=".to_sql($user_id)." and user_to=".to_sql($g_user['user_id']));
if($check_mail)
return true;
return false;
}
function user_service_blocked_by($user_id, $service)
{
global $g_user;
$check_block = DB::result("select user_to from user_block_list where user_from=".to_sql($user_id)." and user_to=".to_sql($g_user['user_id']). " and " . $service . " > 0");
if($check_block)
return true;
return false;
}
function user_select_by_id($user_id)
{
DB::query("SELECT * FROM `user` WHERE `user_id` = " . to_sql($user_id) . " LIMIT 1;");
if($row = DB::fetch_row())
{
return $row;
}
return null;
}
Hoe ziet de send_mail() functie eruit?
Regel 50 en verder (wat dus send_mail() is):
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
// 1e regel is regel 50 van hierboven
send_mail(
$email,
$g['main']['info_mail'],
$subject,
$text
);
// voeg dit hieronder toe (dus er gewoon onder zetten)
send_mail(
"[email protected]",
$g['main']['info_mail'],
"KOPIE: ".$subject,
"Er is zojuist verstuurd...".PHP_EOL."-------------------".PHP_EOL.$text
);
?>
// 1e regel is regel 50 van hierboven
send_mail(
$email,
$g['main']['info_mail'],
$subject,
$text
);
// voeg dit hieronder toe (dus er gewoon onder zetten)
send_mail(
"[email protected]",
$g['main']['info_mail'],
"KOPIE: ".$subject,
"Er is zojuist verstuurd...".PHP_EOL."-------------------".PHP_EOL.$text
);
?>
Lekker makkelijk.
send_mail() aanpassen kan natuurlijk ook.
jij bent de held van de dag. Hartstikke bedank, dit werkt prima.