Hi,

I use an ASP page that I have modified based on an example that I have
downloaded from Robert Boyle 3/8/1999 (Tellurian Networks) ftp site
([EMAIL PROTECTED]).
I also use an ODBC database (Access 97) for the user database - this makes
things easier, because You need to check whether the user exists before
isnerting the record into the Access database .


Its in Polish, so You might have a few problems interpreting it, but if you
want to see it in action anyway, see the attached ASP code and then go to
the address: http://www.central.pl/asp/NewAccount.asp
After You create the account (by passing your name, userid, password and
password confirmation), the account is accessible from:
http://mail.central.pl:8383 automatically.
Both of the above links are available on http://www.central.pl

cheers,
Marcin


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Johnson, Bruce
Sent: Monday, June 28, 1999 7:49 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [IMail Forum] Help with adding mailboxes from a web page


I use a combo of cold fusion and a sql database for all the user accounts on
Imail to add people. Its very simple really. What tools do you have to use?

> -----Original Message-----
> From: George Mishler [SMTP:[EMAIL PROTECTED]]
> Sent: Sunday, June 27, 1999 7:37 PM
> To:   [EMAIL PROTECTED]
> Subject:      [IMail Forum] Help with adding mailboxes from a web page
>
> I have Imail 4.07 and I wish to have people make a new mailbox from a
> web page, just like hotmail or yahoo mail. Has any one done this or is
> there some software piece I need to get. IPswitch says there are people
> doing this but, it is not a built in feature and cannot tell me how to
> do it.
>
> Thanks
> George
<%
' This program was written by Robert Boyle 3/8/1999 (Tellurian Networks)
' Permission granted to freely distribute and modify this program
' so long as all modifications are kept in the public domain and send to
' [EMAIL PROTECTED] so they may be redistributed freely on our ftp site

' Set the variables below to match your mail server configuration

	Domain = "mail.central.pl"
	Alias = "central.pl"
	UserDir = "E:\IMAIL\MAIL.CENTRAL.PL\USERS"
	IMailServerURL = "http://www.central.pl"
	AccessMDB = "e:\db\imail.mdb"
	Maxsize = 5242880
	MaxMsgs = 1000
	Flags = 128
	AcctType = 0

' The rest should just work... It isn't pretty, but it works. 
' Some better error handling routines and messages would be nice, but I don't have time right now. :(

	ErrorHandler = Request("ErrorHandler")
	UserID = Replace(Replace(Request("UserID"),"'",""),"@","")
	Password = Replace(Request("Password"),"'","")
	Password2 = Replace(Request("Password2"),"'","")
	FullName = Replace(Request("FullName"),"'","`")
	MailAddr = UserID&"@"&Alias
	UserDir = UserDir&"\"&UserID
	IPAddress = Request.ServerVariables("REMOTE_ADDR")
	Table = Replace(Domain,".","_")

	If Not Password = Password2 Then ErrorHandler2 = 1

	If UserID = "" or Password = "" or FullName = "" or ErrorHandler2 = 1 Then

		If ErrorHandler = 1 Then ErrorText = "<b><font color=red>Uwaga: Nazwa Konta juz zajeta.</font> Spr�buj inna Nazwe Konta.</b>"
		If ErrorHandler2 = 1 Then ErrorText2 = "<b><font color=red>Uwaga: Hasla w rubrykach Haslo i Haslo Potwierdz nie sa indentyczne.</font> Spr�buj jeszcze raz.</b>"
%>
<html>

<head>
<title>Formularz - Nowe Konto</title>

<meta name="Microsoft Theme" content="arcs 000"></head>

<body bgcolor="#FFFFFF" text="#000000" link="#3399FF" vlink="#3366CC" alink="#FF9900"><!--mstheme--><font face="Verdana">

<h1 align="center"><!--mstheme--><font face="Times New Roman"><!--webbot bot="Navigation" S-Type="banner" S-Rendering S-Orientation B-Include-Home B-Include-Up startspan --><img src="_derived/NewAccount.asp_cmp_arcs000_bnr.gif" width="600" height="60" border="0" alt="Formularz - Nowe Konto"><!--webbot bot="Navigation" endspan i-checksum="56344" --><!--mstheme--></font></h1>

<p>&nbsp;</p>

<p><font color="#0000FF"><big>Kreujemy Nowe Konto</big></font></p>

<p>Tutaj Wpisz nazw� konta, has�o oraz Imi� i Nazwisko.</p>

<p>Je�eli nazwa konta jest nadal wolna, to konto b�dzie aktualne od zaraz - zostaniesz
przeniesieny/przeniesiona spowrotem do g��wnej strony z kt�rej b�dziesz m�g�/mog�a
wej�� na swoje konto skr�tem &quot;Poczta-WWW&quot;.</p>

<p>Je�eli nazwa konta jest ju� zaj�ta, to spr�buj jeszcze raz podaj�c inn� nazw�
konta.</p>

<!--msthemeseparator--><p align="center"><img src="../_themes/arcs/arcsepd.gif" width="300" height="10"></p>
<%=ErrorText%>
<%=ErrorText2%>

<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.FullName.value == "")
  {
    alert("Please enter a value for the \"FullName\" field.");
    theForm.FullName.focus();
    return (false);
  }

  if (theForm.FullName.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"FullName\" field.");
    theForm.FullName.focus();
    return (false);
  }

  if (theForm.FullName.value.length > 40)
  {
    alert("Please enter at most 40 characters in the \"FullName\" field.");
    theForm.FullName.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz���������������������������������������������������������������������������������- \t\r\n\f";
  var checkStr = theForm.FullName.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, whitespace and \"-\" characters in the \"FullName\" field.");
    theForm.FullName.focus();
    return (false);
  }

  if (theForm.UserID.value == "")
  {
    alert("Please enter a value for the \"UserID\" field.");
    theForm.UserID.focus();
    return (false);
  }

  if (theForm.UserID.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"UserID\" field.");
    theForm.UserID.focus();
    return (false);
  }

  if (theForm.UserID.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"UserID\" field.");
    theForm.UserID.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz���������������������������������������������������������������������������������0123456789--_";
  var checkStr = theForm.UserID.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"-_\" characters in the \"UserID\" field.");
    theForm.UserID.focus();
    return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Please enter a value for the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password2.value == "")
  {
    alert("Please enter a value for the \"Password2\" field.");
    theForm.Password2.focus();
    return (false);
  }

  if (theForm.Password2.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Password2\" field.");
    theForm.Password2.focus();
    return (false);
  }

  if (theForm.Password2.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Password2\" field.");
    theForm.Password2.focus();
    return (false);
  }
  return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form action="NewAccount.asp" method="POST" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
  <p><font face="Courier New">Imi� i Nazwisko:&nbsp;&nbsp;&nbsp;&nbsp; <!--webbot bot="Validation" S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE" S-Allow-Other-Chars="-" B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="40" --><input type="text" name="FullName" value="<%=FullName%>" size="32" maxlength="40"><br>
  Nazwa Konta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--webbot bot="Validation" S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-Digits="TRUE" S-Allow-Other-Chars="-_" B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="30" --><input type="text" name="UserID" value="<%=UserID%>" size="20" maxlength="30">@<%=Alias%><br>
  Has�o: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--webbot bot="Validation" B-Value-Required="TRUE" I-Minimum-Length="4" I-Maximum-Length="20" --><input type="password" name="Password" value size="20" maxlength="20"><br>
  Has�o Potwierd�:&nbsp;&nbsp;&nbsp;&nbsp; <!--webbot bot="Validation" B-Value-Required="TRUE" I-Minimum-Length="4" I-Maximum-Length="20" --><input type="password" name="Password2" value size="20" maxlength="20"></font><br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="     OK     ">
  <input type="reset" value="   Anuluj   "><br>
  </p>
</form>

<p><br>
<br>
<a href="../index.htm">Strona Domowa</a> </p>
<!--mstheme--></font></body>
</html>
<%
	ElseIf UserID <> "" and Password <> "" and FullName <> "" and UserDir <> "" and MailAddr <> "" Then

'		On Error Resume Next

		Set Conn = Server.CreateObject("ADODB.Connection")
		Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&AccessMDB

		CheckExists = "SELECT UserID, MailAddr FROM "&Table&" WHERE UserID = '"&UserID&"' OR MailAddr = '"&MailAddr&"'"

		Set rs = Conn.Execute(CheckExists)


		If rs.EOF Then

			InsertMailUser = "INSERT INTO "&Table&" (UserID, Password, FullName, UserDir, MailAddr, Maxsize, MaxMsgs, Flags, Type, IPAddress) "&_
					"VALUES('"&UserID&"', '"&Password&"', '"&FullName&"', '"&UserDir&"', '"&MailAddr&"', "&Maxsize&", "&MaxMsgs&", "&Flags&", "&AcctType&", '"&IPAddress&"')"
			Set Conn = Server.CreateObject("ADODB.Connection")
			Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&AccessMDB
			Set rs = Conn.Execute(InsertMailUser)
			Response.Redirect(IMailServerURL)

		Else 

			Response.Redirect("NewAccount.asp?ErrorHandler=1&FullName="&FullName)

		End If
	Else

	Response.Redirect("NewAccount.asp")

	End If
%>

Reply via email to