View Full Version : email script
does anyone know how to set up a log in script to your email account.. becus i want to set up so i can have people log into there accounts with out having to go to the www.exasko.info/webmail
any ideas?
markblair
12-30-03, 10:57 PM
Do you have the ability to create a subdomain? What I did was I created a subdomain called 'mail'. The path then became mail.domain.com. When I go to that location, it has an index.html page with the following code to automatically forward me to the longer address for the webmail application. In your case, you'd go to mail.exasko.info which would automatically direct you to www.exasko.info/webmail by using the following code:
HTML code for index.html page in the mail subdomain
<html>
<head>
<TITLE>exasko webmail</TITLE>
<meta http-equiv="refresh" content="0;
URL=http://www.exasko.info/webmail/">
</head>
<BODY>
</BODY>
</html>
Let me know if this is what you were looking for.
Yes I can create subdomain names..
Now like if you go to www.yahoo.com you can log in by typing your user name and password in the box and hitting log in.. how would I go about doing that for my email accounts
markblair
12-30-03, 11:24 PM
Originally posted by exasko:
Now like if you go to www.yahoo.com you can log in by typing your user name and password in the box and hitting log in.. how would I go about doing that for my email accounts
Well, that depends on a few things. What webmail client is used on your server? My host uses SquirrelMail and within the app. there are login.php and signout.php files. What I did for one site is modify the login.php file to have my site design. I just went to the sign-on page (login.php), right-clicked and chose 'View Source'. From there I copied the entire page and fit it within my design. The page I'm referring to is here (http://mail.markblair.net/). Notice the URL changes which is what I did with that script above and then the login box is within the page. For me (using SquirrelMail) I just had to make sure the page I created was a PHP file.
If you'd like me to try to help like mine is setup, let me know and I'll do my best.
This is really going to make me sound stupid...
but you said 'within the app. there are login.php and signout.php files' i am using the SquirrelMail, but where can i find the login, and signout.php files?
markblair
12-30-03, 11:43 PM
Not stupid at all. Mine are located under /squirrelmail/src/ on the server. The server I'm on is setup with Ensim using Apache so the structure might be slightly different. Wherever your SquirrelMail is installed, there are probably several folders. Look for the /src/ folder to find those two files. :)
Ehh.. I cannot seem to find it..
has anyone ever done this with Cpanel?
NickDev
12-31-03, 05:19 AM
Find the login.php files and fine the form it uses, no need to copy it all. find the action of the form. no look at the <input > names.
then pass it like so.. http://www.domain.com/mail/loginaction.php?user=asdf&pass=adsf
sorry if you cant understand some i was in a hurry
If you read my above post... I CANNOT find those files.
Chicken
12-31-03, 06:47 AM
Exasko, try: locate squirrelmail to find the directory on your server.
huh? i'm sorry i am really slow here, i don't understand... where do i try to locate squireelam
markblair
12-31-03, 01:49 PM
Originally posted by exasko:
huh? i'm sorry i am really slow here, i don't understand... where do i try to locate squireelam
exasko, I'd say the best thing would be to check with your host. They may have set it up differently than others would so even someone else using a server with cPanel may not be the same. The only other thing I could suggest is to find it the way I did... log in to your site via FTP and go to the root of your space. Then just poke around until you find the directory. For me, it was one level behind the site itself so for example, my site is located at /var/www/html whereas the SquirrelMail install is at /var/www/squirrelmail...
Good luck!
Ever consider OpenWebmail ?
or Postaci ?
Its kinda cool -- they are free :)
exasko doesn't have root access to the server. which is why he can't find those files.
<html>
<head>
<title>Webmail login</title>
</head>
<body>
<form method="post" action="http://www.exasko.info/webmail">
<div align="center">
<p> </p>
<p>Username:
<input type="text" name="user">
<br>
Password:
<input type="password" name="pass">
<br>
<input type="submit" name="submit" value="Login">
</p>
</div>
</form>
</body>
</html>
Just insert that where you need it:)
:suckers:
Right ive nabbed this from the login bit, its a little better than the previous one, just alter the info to corrsepond with your server.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<!-- IMP: Copyright 2001, The Horde Project. IMP is under the GPL. -->
<!-- Horde Project: http://horde.org/ | IMP: http://horde.org/imp/ -->
<!-- GNU Public License: http://www.fsf.org/copyleft/gpl.html -->
<html lang="en-US"><head>
<title>Mail :: Welcome to Horde</title>
<link rel="SHORTCUT ICON" href="/horde/imp/graphics/favicon.ico" type="image/x-icon" />
<link href="/horde/css.php?app=imp" rel="stylesheet" type="text/css" />
</head>
<body onload="setFocus()">
<script language="JavaScript" type="text/javascript">
<!--
function setFocus()
{
document.implogin.imapuser.focus();
}
function submit_login()
{
if (document.implogin.imapuser.value == "") {
alert('Please provide your username and password');
document.implogin.imapuser.focus();
return false;
} else if (document.implogin.pass.value == "") {
alert('Please provide your username and password');
document.implogin.pass.focus();
return false;
} else {
return true;
}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
function enter_key_trap(e)
{
var keyPressed;
if (document.layers) {
keyPressed = String.fromCharCode(e.which);
} else if (document.all) {
keyPressed = String.fromCharCode(window.event.keyCode);
} else if (document.getElementById) {
keyPressed = String.fromCharCode(e.keyCode);
}
if ((keyPressed == "\r" || keyPressed == "\n") && (submit_login())) {
document.implogin.submit();
}
}
//-->
</script>
<form action="/horde/imp/redirect.php" method="post" name="implogin">
<input type="hidden" name="actionID" value="105" />
<input type="hidden" name="url" value="http://www.mihost123.net:2095/horde/login.php" />
<input type="hidden" name="mailbox" value="INBOX" />
<td align="right" class="light"><b>Username</b></td>
<td align="left">
<input type="text" tabindex="1" name="imapuser" size="20" /></td>
<p>
</tr>
<tr>
<td align="right" class="light"><b>Password</b></td>
<td align="left">
<input type="password" tabindex="2" name="pass" size="20"/></td> </p>
<p>
</tr>
<tr>
<td>
<input type="hidden" name="server" value="localhost" />
<input type="hidden" name="port" value="143" />
<input type="hidden" name="namespace" value="" />
<input type="hidden" name="maildomain" value="mihost123.net" />
<input type="hidden" name="protocol" value="imap/notls" />
<input type="hidden" name="realm" value="" />
</td>
<td><input type="hidden" name="folders" value="" /></td>
</tr>
<tr>
<td align="right" class="light"><b>Language</b></td>
<td align="left" class="light"><select name="new_lang" onchange="selectLang()"><option value="bg_BG">Bulgarian</option><option value="ca_ES">Català</option><option value="zh_CN">Chinese (Simplified)</option><option value="zh_TW">Chinese (Traditional)</option><option value="cs_CZ">Czech</option><option value="da_DK">Dansk</option><option value="de_DE">Deutsch</option><option value="en_GB">English (GB)</option><option value="en_US" selected="selected">English (US)</option><option value="es_ES">Español</option><option value="et_EE">Eesti</option><option value="fr_FR">Français</option><option value="el_GR">Greek</option><option value="it_IT">Italiano</option><option value="ja_JP">Japanese</option><option value="ko_KR">Korean</option><option value="lv_LV">Latviešu</option><option value="lt_LT">Lietuviuk</option><option value="hu_HU">Magyar</option><option value="nl_NL">Nederlands</option><option value="nb_NO">Norsk bokmål</option><option value="nn_NO">Norsk nynorsk</option><option value="pl_PL">Polski</option><option value="pt_PT">Português</option><option value="pt_BR">Português Brasileiro</option><option value="ro_RO">Romana</option><option value="ru_RU">Russian (Windows)</option><option value="ru_RU.KOI8-R">Russian (KOI8-R)</option><option value="sk_SK">Slovak</option><option value="sl_SI">Slovenscina</option><option value="fi_FI">Suomi</option><option value="sv_SE">Svenska</option><option value="uk_UA">Ukranian</option></select></td>
</tr>
<tr>
<td> </p>
<p></td> <td align="left" class="light"><input type="submit" class="button" name="button" tabindex="4" value="Log in" onclick="return submit_login();" /></td>
</tr>
</table>
</p>
</form>
<script language="JavaScript" type="text/javascript">
<!--
function updatePort()
{
}
function selectLang()
{
// We need to reload the login page here, but only if the user hasn't
// already entered a username and password.
if (document.implogin.imapuser.value == '' &&
document.implogin.pass.value == '') {
var lang_page = 'login.php?new_lang=' + document.implogin.new_lang[document.implogin.new_lang.selectedIndex].value;
lang_page += '&url=http%3A%2F%2Fwww.mihost123.net%3A2095%2Fhorde% 2Flogin.php';
self.location = lang_page;
}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
// Setup the enter keytrap code
if (window.document.captureEvents != null) {
window.document.captureEvents(Event.KEYPRESS);
window.document.onkeypress = enter_key_trap;
}
//-->
</script>
<!-- This file contains any "Message Of The Day" Type information -->
<!-- It will be included below the log-in form on the login page. -->
<script language="JavaScript" type="text/javascript">
<!--
if (parent.frames.horde_main) parent.document.title = 'Mail :: Welcome to Horde';
//-->
</script>
</body>
</html>
:suckers:
Hmm... maybe I messed up but
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<!-- IMP: Copyright 2001, The Horde Project. IMP is under the GPL. -->
<!-- Horde Project: http://horde.org/ | IMP: http://horde.org/imp/ -->
<!-- GNU Public License: http://www.fsf.org/copyleft/gpl.html -->
<html lang="en-US"><head>
<title>Mail :: Welcome to Horde</title>
<link rel="SHORTCUT ICON" href="/horde/imp/graphics/favicon.ico" type="image/x-icon" />
</head>
<body onload="setFocus()">
<script language="JavaScript" type="text/javascript">
<!--
function setFocus()
{
document.implogin.imapuser.focus();
}
function submit_login()
{
if (document.implogin.imapuser.value == "") {
alert('Please provide your username and password');
document.implogin.imapuser.focus();
return false;
} else if (document.implogin.pass.value == "") {
alert('Please provide your username and password');
document.implogin.pass.focus();
return false;
} else {
return true;
}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
function enter_key_trap(e)
{
var keyPressed;
if (document.layers) {
keyPressed = String.fromCharCode(e.which);
} else if (document.all) {
keyPressed = String.fromCharCode(window.event.keyCode);
} else if (document.getElementById) {
keyPressed = String.fromCharCode(e.keyCode);
}
if ((keyPressed == "\r" || keyPressed == "\n") && (submit_login())) {
document.implogin.submit();
}
}
//-->
</script>
<form action="/horde/imp/redirect.php" method="post" name="implogin">
<input type="hidden" name="folders" value="" />
<input type="hidden" name="realm" value="" />
<input type="hidden" name="protocol" value="imap/notls" />
<input type="hidden" name="maildomain" value="exasko.info" />
<input type="hidden" name="namespace" value="" />
<input type="hidden" name="port" value="143" />
<input type="hidden" name="server" value="localhost" />
<input type="hidden" name="actionID" value="105" />
<input type="hidden" name="url" value="http://www.exasko.info:2095/horde/login.php" />
<input type="hidden" name="mailbox" value="INBOX" />
<td align="right" class="light"><b>Username</b></td>
<td align="left">
<input type="text" tabindex="1" name="imapuser" size="20" /></td>
<p>
</tr>
<tr>
<td align="right" class="light"><b>Password</b></td>
<td align="left">
<input type="password" tabindex="2" name="pass" size="20"/></td> </p>
<p></td> <td align="left" class="light"><input type="submit" class="button" name="button" tabindex="4" value="Log in" onclick="return submit_login();" /></td>
</tr>
</table>
</p>
</form>
<script language="JavaScript" type="text/javascript">
<!--
function updatePort()
{
}
function selectLang()
{
// We need to reload the login page here, but only if the user hasn't
// already entered a username and password.
if (document.implogin.imapuser.value == '' &&
document.implogin.pass.value == '') {
var lang_page = 'login.php?new_lang=' + document.implogin.new_lang[document.implogin.new_lang.selectedIndex].value;
lang_page += '&url=http%3A%2F%2Fwww.exasko.info%3A2095%2Fhorde%2F login.php';
self.location = lang_page;
}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
// Setup the enter keytrap code
if (window.document.captureEvents != null) {
window.document.captureEvents(Event.KEYPRESS);
window.document.onkeypress = enter_key_trap;
}
//-->
</script>
<!-- This file contains any "Message Of The Day" Type information -->
<!-- It will be included below the log-in form on the login page. -->
<script language="JavaScript" type="text/javascript">
<!--
if (parent.frames.horde_main) parent.document.title = 'Mail :: Welcome to Horde';
//-->
</script>
</body>
</html>
That is my modified version and it didnt work for me
Bangs head on table
:suckers:
If you have not solved you problem yet, i may have a soloution. I took this from a cpanel login form but you can makeit work with webmail...i think
Create a page called login.php and one called webmail.php
This is the code for the LOGIn bit
<html>
<head>
<title>Webmail Login</title>
</head>
<body>
<form method="post" action="webmail.php">
<div align="center">
<p> </p>
<p>ANY TEXT HERE</p>
<p>Username:
<input type="text" name="user">
<br>
Password:
<input type="password" name="pass">
<br>
<input type="submit" name="submit" value="Login">
</p>
</div>
</form>
</body>
</html>
Code for the webmail.php
<?
if ($_POST["submit"]) {
if ((!$_POST["user"]) || (!$_POST["pass"])) {
echo("Please fill in all fields");
}
else {
header("Location: http://".$_POST["user"].":".$_POST["pass"]."@www.YOURSITE.com:2095 (or different port)");
}
}
?>
I have no-idea if this will work, ill try it on my server tonight.
wont that still ask for the password for the mailserver?
:suckers:
vBulletin v3.5.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.