phpmailer zou gwoon moeten werken en kan je daarom makkelijk in andere script inbouwen kijk maar:
<?php
include('header.php');
error_reporting(E_ALL);
if(empty($_SESSION['hex_id'])) {
if(isset($_POST['join'])) {
sleep(3); // tegen brutefore attack
$query1 = mysql_query("SELECT * FROM players WHERE useraangemeldip = '".$IP."'");
$aantal1 = mysql_num_rows($query1);
$query2 = mysql_query("SELECT * FROM gebannen WHERE ip = '".$IP."'");
$aantal2 = mysql_num_rows($query2);
$naam = mysql_real_escape_string(trim($_POST['naam']));
$pass = mysql_real_escape_string(trim($_POST['wachtwoord2']));
$email = mysql_real_escape_string(trim($_POST['email2']));
$query3 = mysql_query("SELECT * FROM players WHERE username = '".$naam."'");
$aantal3 = mysql_num_rows($query3);
$rand1 = rand(1,9);
$rand2 = rand(10,99);
$rand3 = rand(100,999);
$accode = $rand1.$rand2.$rand3;
if($aantal1 == 1) {
echo 'U heeft al een account op dit ip adress: $IP';
}
else if($aantal2 >= 1) {
wanneer();
echo 'U bent verbannen van deze website! klik <a href="ikban.php">hier</a> om te kijken waarom.';
}
else if($naam == "") {
echo 'U moet wel een naam invullen!';
}
else if($pass == "") {
echo 'U moet wel een wachtwoord invullen!';
}
else if($email == "") {
echo 'U moet wel een email invullen!';
}
else if($aantal3 >= 1) {
echo 'Srry maar der is al iemand met deze gebruikersnaam: $naam';
} else {
if($_POST['wachtwoord1'] == $_POST['wachtwoord2']) {
if($_POST['email1'] == $_POST['email2']) {
if(isset($_POST['agree']) && $_POST['agree'] == 1) {
mysql_query("INSERT INTO players (username, userpass, useremail, useraccode, useraangemeldop, useraangemeldip) VALUES ('" . $naam . "', '" . codeer($pass) . "', '" . $email . "', '" . $accode . "', NOW(), '" . $IP . "')") or die(mysql_error());
echo 'Dank u wel voor u aanmelding er is een email gestuurt met een activatie code.';
require('class.phpmailer.php');
class my_phpmailer extends phpmailer {
// Set default variables for all new objects
var $From = "
[email protected]";
var $FromName = "Mebus";
var $Host = "smtp.quicknet.nl";
var $Mailer = "smtp"; // Alternative to IsSMTP()
var $WordWrap = 75;
// Replace the default error_handler
function error_handler($msg) {
print("My Site Error");
print("Description:");
printf("%s", $msg);
exit;
}
// Create an additional function
function do_something($something) {
// Place your new code here
}
}
$mail = new my_phpmailer;
$mail->AddAddress($email, "Activatie Email");
$mail->Subject = "Dank u wel";
$mail->Body = "Dank u wel voor u aanmelding bij hexerlie.
klik op de volgende link om u account te activeren:
<a href="http://localhost/mijnscripts/join.php?activeren=ja&";
if(!$mail->Send())
{
echo "Srry maar vanwegen een fout kon der geen activatie email naar u verzonden worden. Neem alstublieft contact op met de webmaster.";
exit;
}
echo 'Dank u wel voor u aanmelding er is een email gestuurt met een activatie code.';
} else {
echo 'U zult wel met de voorwaarden moeten overeenkomen wilt u zich hier kunnen aanmelden!';
}
} else {
echo 'De 2 opgegeven emails zijn niet gelijk aan elkaar!';
}
} else {
echo 'De 2 opgegeven wachtwoorden zijn niet gelijk aan elkaar!';
}
}
} else {
echo '
<form method="post" name="join" action="join.php">
Naam:<br>
<input type="text" name="naam" maxlength="10"><br><br>
Wachtwoord:<br>
<input type="password" name="wachtwoord1" maxlength="32"><br><br>
Wachtwoord: (controle)<br>
<input type="password" name="wachtwoord2" maxlength="32"><br><br>
Email:<br>
<input type="text" name="email1" maxlength="64"><br><br>
Email: (controle)<br>
<input type="text" name="email2" maxlength="64"><br><br>
<input type="checkbox" name="agree" value="1" id="agree">Ja ik kom overeen met de <a href="voorwaarden.php">voorwaarden</a><br>
<input type="submit" value="join" name="join">
</form>
';
}
} else {
echo 'U bent al ingelogt!';
}
include('footer.php');
?>
GR. mebus!
hier nog een stukje van phpmailer:
class PHPMailer
{
/////////////////////////////////////////////////
// PUBLIC VARIABLES
/////////////////////////////////////////////////
/**
* Email priority (1 = High, 3 = Normal, 5 = low).
* @var int
*/
var $Priority = 3;
/**
* Sets the CharSet of the message.
* @var string
*/
var $CharSet = "iso-8859-1";
/**
* Sets the Content-type of the message.
* @var string
*/
var $ContentType = "text/plain";
/**
* Sets the Encoding of the message. Options for this are "8bit",
* "7bit", "binary", "base64", and "quoted-printable".
* @var string
*/
var $Encoding = "8bit";
/**
* Holds the most recent mailer error message.
* @var string
*/
var $ErrorInfo = "";
/**
* Sets the From email address for the message.
* @var string
*/
var $From = "root@localhost";
/**
* Sets the From name of the message.
* @var string
*/
var $FromName = "Root User";
/**
* Sets the Sender email (Return-Path) of the message. If not empty,
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
* @var string
*/
var $Sender = "";
/**
* Sets the Subject of the message.
* @var string
*/
var $Subject = "";
/**
* Sets the Body of the message. This can be either an HTML or text body.
* If HTML then run IsHTML(true).
* @var string
*/
var $Body = "";
/**
* Sets the text-only body of the message. This automatically sets the
* email to multipart/alternative. This body can be read by mail
* clients that do not have HTML email capability such as mutt. Clients
* that can read HTML will view the normal Body.
* @var string
*/
var $AltBody = "";
/**
* Sets word wrapping on the body of the message to a given number of
* characters.
* @var int
*/
var $WordWrap = 0;
/**
* Method to send mail: ("mail", "sendmail", or "smtp").
* @var string
*/
var $Mailer = "mail";
/**
* Sets the path of the sendmail program.
* @var string
*/
var $Sendmail = "/usr/sbin/sendmail";
/**
* Path to PHPMailer plugins. This is now only useful if the SMTP class
* is in a different directory than the PHP include path.
* @var string
*/
var $PluginDir = "";
/**
* Holds PHPMailer version.
* @var string
*/
var $Version = "1.73";
/**
* Sets the email address that a reading confirmation will be sent.
* @var string
*/
var $ConfirmReadingTo = "";
/**
* Sets the hostname to use in Message-Id and Received headers
* and as default HELO string. If empty, the value returned
* by SERVER_NAME is used or 'localhost.localdomain'.
* @var string
*/
var $Hostname = "";
/////////////////////////////////////////////////
// SMTP VARIABLES
/////////////////////////////////////////////////
/**
* Sets the SMTP hosts. All hosts must be separated by a
* semicolon. You can also specify a different port
* for each host by using this format: [hostname:port]
* (e.g. "smtp1.example.com:25;smtp2.example.com").
* Hosts will be tried in order.
* @var string
*/
var $Host = "localhost";
/**
* Sets the default SMTP server port.
* @var int
*/
var $Port = 25;
/**
* Sets the SMTP HELO of the message (Default is $Hostname).
* @var string
*/
var $Helo = "";
/**
* Sets SMTP authentication. Utilizes the Username and Password variables.
* @var bool
*/
var $SMTPAuth = false;
/**
* Sets SMTP username.
* @var string
*/
var $Username = "";
/**
* Sets SMTP password.
* @var string
*/
var $Password = "";
/**
* Sets the SMTP server timeout in seconds. This function will not
* work with the win32 version.
* @var int
*/
var $Timeout = 10;
/**
* Sets SMTP class debugging on or off.
* @var bool
*/
var $SMTPDebug = false;
/**
* Prevents the SMTP connection from being closed after each mail
* sending. If this is set to true then to close the connection
* requires an explicit call to SmtpClose().
* @var bool
*/
var $SMTPKeepAlive = false;