Ok What I want to do is allow my VIP users to setup their own email addresses.
So I setup a template that looks like this:
Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<h2 class="blockhead">V.I.P Email for {vb:raw bbuserinfo.musername}</h2>
<div class="blockbody">
<div class="blockrow">
<form name="frmEmail" method="post">
<table width="400" border="0">
<tr><td>Username:</td><td>{vb:raw bbuserinfo.username}@mydomain.com</td></tr>
<tr><td>Password:</td><td><input name="pass" size="20" type="password" /></td></tr>
<tr><td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Create Email Account" /></td></tr>
</table>
</form>
<div align="center"></div>
</div>
</div>
{vb:raw footer}
</body>
</html>
and makevipemail.php simply looks like this:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'VIP Email');
define('CSRF_PROTECTION', true);
// change this depending on your filename
// ################### 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('VIP Email');
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = construct_navbits(array('' => 'VIP Email'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'VIP Email';
//$vbulletin->userinfo[usergroupid] == 1;
if($_REQUEST['submit']){
$user = $vbulletin->userinfo['username'];
$pass = $_REQUEST['pass'];
if (!empty($user)){
// Create email account
$f = fopen ("http://login@mydomain.com:2082/frontend/x3/mail/doaddpop.html?email=".$user."&domain=mydomain.com&password=".$pass.""a=50", "r");
@fclose($f);
}
}
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('VIP Email');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Yet I get this error when I submit the form:
Code:
vBulletin Message
Your submission could not be processed because a security token was missing.
If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error.
I don't understand why it is so hard to get an incredibly simple php script to work?