PHP horde login page

SePP

Perch
I made a page so you can externally login to horde webmail. I use it so people on my site can directly login to their webmail.
Maybe some people find it usefull.
I just stripped the login page and changed my preferred settings, don't shoot me if some things aren't correct.

You can change the things I marked in red.

Code:
<!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: [url="http://horde.org/"]http://horde.org/[/url] | IMP: [url="http://horde.org/imp/"]http://horde.org/imp/[/url] -->
<!--	GNU Public License: [url="http://www.fsf.org/copyleft/gpl.html"]http://www.fsf.org/copyleft/gpl.html[/url] -->
<html lang="[color=red]nl-NL[/color]"><head>
<title>[color=red]Webmail :: Welkom[/color]</title>
<link href="[url="http://66.36.228.155/horde/css.php?app=imp"]http://66.36.228.155/horde/css.php?app=imp[/url]" 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.server[document.implogin.server.selectedIndex].value.substr(0, 1) == "_") {
		return false;
	}
	if (document.implogin.imapuser.value == "") {
		alert('Please enter a login and password.');
		document.implogin.imapuser.focus();
		return false;
	} else if (document.implogin.pass.value == "") {
		alert('Please enter a login 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="[url="http://66.36.228.155/horde/imp/redirect.php"]http://66.36.228.155/horde/imp/redirect.php[/url]" method="post" name="implogin">
<input type="hidden" name="actionID" value="105" />
<input type="hidden" name="url" value="" />
<input type="hidden" name="mailbox" value="INBOX" />
<table align="center" border="0" width="300">
<tr>
	 <td align="center" colspan="2" class="header"> <strong>[color=red]Webmail[/color]</strong></td>
	</tr>
		<tr>
	<td align="right" class="light"><b>[color=red]Username[/color]</b></td>
	<td align="left"><input type="text" tabindex="1" name="imapuser" value="" /></td>
	</tr>
<tr>
	<td align="right" class="light"><b>[color=red]Password[/color]</b></td>
	<td align="left"><input type="password" tabindex="2" name="pass" /></td>
</tr>
<tr>
	<td><input type="hidden" name="folders" value="INBOX" />
<input type="hidden" name="new_lang" value="[color=red]en_US[/color]"> [color=red]this is your language code, horde will have this language you put here.[/color]
<input type="hidden" tabindex="3" name="server" value="mail.m****here.biz"></td>
</tr>
 
<tr>
	<td>&nbsp;</td>
	<td align="left" class="light"><input type="submit" class="button" name="button" tabindex="4" value="[color=red]Submit[/color]" onclick="return submit_login();" /></td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
 
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;
		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 = 'Webmail :: Welcome';
//-->
</script>
</body>
</html>

Maybe I'll strip it more later on, hope it works and you that you can use it.
You can put this script anywhere it can always login to jodohost horde webmail. Even on your own desktop :p
 
Nice idea. I've made my own Horde installation personally, which seems to work nicely, but this is a relatively easy alternative :)
 
Hi I copy paste the code you posted (changed the ip)
and I got the following:


Warning: registry(/usr/local/cpanel/base/horde/lib/../config/registry.php): failed to open stream: Permission denied in /usr/local/cpanel/base/horde/lib/Registry.php on line 102

Warning: registry(): Failed opening '/usr/local/cpanel/base/horde/lib/../config/registry.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/cpanel/base/horde/lib/Registry.php on line 102

Warning: setlang(/usr/local/cpanel/base/horde/imp/lib/../../config/lang.php): failed to open stream: Permission denied in /usr/local/cpanel/base/horde/lib/Lang.php on line 72

Warning: setlang(): Failed opening '/usr/local/cpanel/base/horde/imp/lib/../../config/lang.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/cpanel/base/horde/lib/Lang.php on line 72

Warning: importconfig(/usr/local/cpanel/base/horde/imp/lib/../../config/horde.php): failed to open stream: Permission denied in /usr/local/cpanel/base/horde/lib/Registry.php on line 588

Warning: importconfig(): Failed opening '/usr/local/cpanel/base/horde/imp/lib/../../config/horde.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/cpanel/base/horde/lib/Registry.php on line 588



Do you have any idea what should I do?
My horde came along with cpanel.

Thanks in advance,
Avi
 
mmm ... this isn't possible because their is no php in that
page and you're getting a php error.

Wich is the url you have in the adresswindow on that error ?
 
Sorry for flooding the thread, but I have another important information.
I have cpanel installed, so horde is installed with cpanel automatically. moreover it is not installed under the webroot.
So I can apache access this directory, I'm created some kind of an alias for /horde to the correct directory and it seem to work but still horde is not loading.

Thanks in advacne,
Avi
 
I made one. Just look at the code behind the one that already exists and stick that type of form on one of your own pages. The only trick is to make sure to include the absolute path to the file for the form action.
 
The Password page is a HSphere page, it has some funky code in it. Did you copy all of the code, or did you just use the form code?
 
Just the form code. Mine doesn't check to see if the two new password fields match. The H-Sphere page that it posts to does that anyway. This code opens the H-Sphere page in a new window.

Here is what I have:

Code:
<form method="POST" name="f_login" action="[url="http://64.156.220.224:8080/psoft/servlet/psoft.hsphere.CP"]http://64.156.220.224:8080/psoft/servlet/psoft.hsphere.CP[/url]">
<TABLE id=table1 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=4 width="100%" border=0>
<TBODY>
<TR>
<TD colSpan=2><U><B>Change Your E-Mail Password</B></U></TD></TR>
<TR>
<TD align=right width="38%">Mailbox (<I>[email protected]</I>):</TD>
<TD width="50%"><INPUT size=40 name=mbox></TD></TR>
<TR>
<TD align=right width="38%">Old (<I>Current</I>) Password:</TD>
<TD width="50%"><INPUT type=password name=old_password></TD></TR>
<TR>
<TD align=right width="38%">New Password:</TD>
<TD width="50%"><INPUT type=password name=password></TD></TR>
<TR>
<TD align=right width="38%">New Password (<I>again</I>):</TD>
<TD width="50%"><INPUT type=password name=password2></TD></TR>
<TR>
<TD colSpan=2>
<P align=center><INPUT onclick="win=window.open('','myWin','toolbars=0'); this.form.target='myWin'" type=submit value="Change E-Mail Password" name=B1></P></TD></TR></TBODY></TABLE></DIV><INPUT type=hidden value=change_mbox_password name=action> <INPUT type=hidden value=design/mail_passw.html name=ftemplate> </FORM>
 
Dude, you guys are making it so hard on yourselves, the login page you have is fine for custom logins, but to return back to this page after failed login, or invalid login attempt, i know they sound similar but i don't mean the same thing, just edit two lines at the bottom of the /horde/imp/redirect.php

should look something like this:
echo "<script>window.location=\"$return_address\"</script>";
}
}

/* No session, and no login attempt. Just go to the login page. */
echo "<script>window.location=\"$return_address\"</script>";

delete the rest of what was there (or # it out if you don't trust me) then set $return_address to the absolute url ie:
http://www.whatever.yoursiteis/directory/page.php

you have to do this because horde and imp by default use bases for their links and you have to have the http:// in there for it to work.

~ Shaun
 
Back
Top