alfaowner |
08-12-2007 09:32 PM |
Quote:
Originally Posted by MissKalunji
(Post 978640)
Working perfectly only thing is user with a space doesnt create and doesnt even work
example one of my users killa k says it was created but when i go in cpanel it doesnts how and even when they try to login it says fail
|
(This was tested on 3.6.4 but will work on 3.5.x)
BACK UP your file www/forum/email.php then replace ALL the code in email.php with the following. It will then work for you :)
username of "the geezer" becomes the-geezer@emailaddress.co.uk
username of "the ultimate geezer" becomes the-ultimate-geezer@emailaddress.co.uk
AO
PHP Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.
define('THIS_SCRIPT', 'email');
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'cpemail',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_user.php');
include ('./includes/cp_email_config.php');
if (!is_member_of($vbulletin->userinfo, 5) AND !is_member_of($vbulletin->userinfo, 6) AND !is_member_of($vbulletin->userinfo, 31) AND !is_member_of($vbulletin->userinfo, 27) AND !is_member_of($vbulletin->userinfo, 7))
{
print_no_permission();
}
// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Cpanel Email Login & Registration Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
$activate = $_GET['activate'];
$cpun = ("" . $vbulletin->userinfo['username'] . "");
$cpun1 = str_replace( "#", "-", $cpun );
$cpun1 = str_replace( "~", "-", $cpun );
$cpun1 = str_replace( "@", "-", $cpun );
$cpun1 = str_replace( " ", "-", $cpun );
$password =$_POST['password'];
$email = $cpun;
ob_start();
if(is_null($activate))
{
$cpquery = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "user AS user WHERE username='$cpun' ") or die(mysql_error());
while ($cpquery3 = $db->fetch_array($cpquery))
$cpquery2 = $cpquery3['cpmail'];
if ($cpquery2 == 1) {
echo ("You have 1 <b>inactive</b> email:: <b> $cpun1@$xxdomain </b><br>");
echo ("To activate your email enter a password below and click Activate<br>");
echo ("<form action=email.php?activate=1 method=post><input type=hidden name=email value=$cpun1 >");
echo ("<input type=hidden name=activate value=1 >");
echo ("<input type=hidden name=domain value=$xxdomain >");
echo ("<input type=text name=password value= >");
echo ("<input type=hidden name=quota value=$xxquota >");
echo (" <input type=submit value=Activate name=submit class=button></form>");
} else {
//echo $cpquery2;
echo ("You have an active email:: <b> $cpun1@$xxdomain </b>");
//CHANGED BY AO //echo ("<form action=cp_email_login.php method=post><input type=hidden name=user value=$cpun >"); echo ("<form action=cp_email_login.php method=post><input type=hidden name=user value=$cpun1 >");
echo ("<br><br>Enter Your Password To Continue:<br><input type=password name=pass><br><input type=submit name=login value=Login></form>");
}
}
else
{
//// start of email creation block
$url = "http$ssl://$xxcpuser:$xxcppass@$xxdomain:$port/frontend/$xxcptheme/mail/doaddpop.html?email=$cpun1&domain=$xxdomain&password=$password"a=$xxquota";
ini_set('user_agent','MSIE 4\.0b2;');
$filepointer = fopen($url,"r");
if($filepointer){
while(!feof($filepointer)){
$buffer = fgets($filepointer, 4096);
$file .= $buffer;
}
fclose($filepointer);
} else {
die(" Sorry, Could not create a connection to our Mail Server, your email was not created, please hit the back button and try again: Contact the admin at $xxadmins_email if you encounter further problems");
}
$message="Email Signup at $xxdomain \n account:$cpun1@$xxdomain \n username:$xxname quota:$xxquota login:$password\n\n If the user forgets their password you can change it in CPanel Email Maintanence \n\nRegards,";
//writing the success into database to prevent duplicate creations errors
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET cpmail = 2 WHERE username='$cpun' LIMIT 1");
//db updated
if (preg_match("/exists/i", $file)) {
$status="failed";
echo ("<center><br/><strong>Sorry <br> $cpun1@$xxdomain </strong><br/><br/>");
echo ("has already been registered/activated. Please contact the administration.</center>");
echo ("<br><br>");
} else {
$status="new account created";
echo "<br/><strong>Thank you $cpun ,</strong><br/>Your email address $cpun@$xxdomain with password $password has been created with $xxquota MB Storage! Thank you for signing up for <br\>$xxdomain email.<br/> You may go back into your email login page now at <a href='http://www.$forumurl/email.php'>http://www.$forumurl/email.php<br/><br/>";
}
//////end of the email creation block
}
$cpemail = ob_get_contents();
ob_end_clean();
// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('cpemail') . '");');
?>
|