I have been trying to utilise the signup script that is used on http://www.warwithboredom.com which allows users to signup for email acounts via a html form, however i cant seem to get the file to work.
If posts the username and password to the sql but isnt setting up the pop account.
The program consists of two files and a sql
the files are: config.php
&?
//before this will work you will need to make a database and then run signup.sql in phpmyadmin
//if you need any help email me at
[email protected]
//also once you have made the table you Must add any email addresses that you already have
//to the data base manually otherwise this script can overwrite mailboxes
$host = &www.yourdomain.com&;//your url
$domain = &yourdomain.com&;//your domain without the www
$cpaneluser = &username&;//your cpanel username
$cpanelpass = &password&;//your cpanel password
$cpaneltheme= &cpanelxp_hg&; //this is the word after frontend/ and the next / when you login to cpanel
$dbhost=&localhost&; //Usually localhost
$dbuser=&user&;//mysql username
$dbtable=&users&;//only change this if you have access to only one database
$dbpass=&&;//mysql password
$dbname=&users&;//The name of the database
$quota=4000;//how much space in k you want to give the user
$mailurl=&mail/index.php&;//The url for your web based mail program I use http://uebimiau.sourceforge.net but you can use anything
//see http://www.hotscripts.com/PHP/Scripts_and_Programs/Email_Systems
//End of settings! you should not need to change anything below this
?&
and
signup.php
&?php
$pathtoconfig=&config.php&;
include(&theme.php&

;
doheader();
if(isset($newuser))
{
include($pathtoconfig);
$newemail = &$newuser@$domain&;
$mpassword = $password2;
$link = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname) or die(&Could not select database&

;
$query=&SELECT username FROM $dbtable WHERE((username = '$username'))&;
$result= mysql_query($query,$link);
if(mysql_num_rows($result) ==0)
{
$query=&INSERT INTO $dbtable(name,username,password,email) VALUES ('$name','$newuser','$pass2','$replymail');&;
mysql_query($query,$link);
$socket = fsockopen($host,2082);
$authstr = &$cpaneluser:$cpanelpass&;
$pass = base64_encode($authstr);
$in = &GET /frontend/$cpaneltheme/mail/doaddpop.html?email=$newemail&domain=$domain&password=$mpassword&a=$quota\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n&;
fputs($socket,$in);
fclose( $socket );
?& Your account has been setup successfully please login &a href=&mail/index.php&&here&/a&
&?
}
else {
echo &Username already in use please try another one.&br&&a href=signup.php&Back&/a&&;
}
mysql_close($link);
}
else { ?&
&form name=&orderform& method=&post& action=&signup.php&&
&table border=&0& cellspacing=&1& cellpadding=&0&&
&tr&
&td&Your full Name:&/td&
&td colspan=&2&&&input name=&name& type=&text&&&/td&
&/tr&
&tr&
&td width=&147&&Other Email Address:&/td&
&td colspan=&2&&&input name=&replymail& type=&text&&
(In case you forget your password)&/td&
&/tr&
&tr&
&td&Prefered Email Address:&/td&
&td colspan=&2&&&input name=&newuser& type=&text&&
@WarWithBoredom.com&/td&
&/tr&
&tr&
&td&Password:&/td&
&td colspan=&2&&&input name=&password1& type=&password&&&/td&
&/tr&
&tr&
&td&Retype Password:&/td&
&td colspan=&2&&&input name=&password2& type=&password&&&/td&
&/tr&
&tr&
&td& &/td&
&td colspan=&2&& &/td&
&/tr&
&tr&
&td& &/td&
&td width=&344&& &div align=&center&&
&input name=&signupbtn& type=&button& id=&signupbtn& value=&Signup& onClick=&validateform()&&
&/div&&/td&
&td width=&163&& &/td&
&/tr&
&/table&
&script language=&JavaScript1.2&&
function validateform()
{
if (checkEmailAddress(document.orderform.replymail))
{
if(document.orderform.password1.value == document.orderform.password2.value)
{
document.orderform.submit();
}
else
{
alert(&The passwords you typed do not appear to match&

;
}
}
}
function checkEmailAddress(field) {
var good;
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){
good = true
} else {
alert('Please enter a valid e-mail address.')
field.focus()
field.select()
good = false
}
return good;
}
&/script&
&/form&
&? }
dofooter();
?&
the sql file is:
CREATE TABLE `users` (
`name` char(50) NOT NULL default '',
`username` char(50) NOT NULL default '',
`password` char(20) NOT NULL default '',
`id` int(11) NOT NULL auto_increment,
`email` char(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Now im trying to use this but cant seem to get it to work.
My mail is horde which is available via :2095/horde/index.php and my cpanel theme is &cpanel&
anyone have any ideas what may be wrong with this code?