Ok, here's the original chunk of code that is most important:
<body onload="document.form.submit();">
<form name="form" action="./" method="post">
<input type="hidden" name="_auth" value="<?session_id()?>" />
<input name="_action" value="login" type="hidden" />
<input name="_user" size="30" type="hidden" value="USERNAME" />
<input name="_pass" size="30" type="hidden"value="PASSWORD" />
<input name="_host" size="30" type="hidden" value="HOST" />
</form>
</body>
You shortened your code example, so I dont know if you did this, but:
1) make sure your form action is set to "./"
2) make sure you have specified USERNAME, PASSWORD, **and** HOST
3) the magic part that makes it login automatically is the <body onload="
document.form.submit();">
If this doesn't help, post the entire page of code you are using instead of just snippets.
-Geuis
Question:
I'm trying to create my own out-of-directory script for logging into
RC. I tried it myself, and then with the info from
http://lists.dorkzilla.org/archive/roundcube-dev/2005Dec/1352.html
and still haven't been able to get it.
My page does this...
<?php
start_session();
?>
<html head and stuff>
<script type="text/javascript" src="/path-to-roundcube/program/js/
common.js"></script>
<script type="text/javascript" src="/path-to-roundcube/program/js/
app.js "></script>
<script type="text/javascript">
<!--
var rcmail = new rcube_webmail();
rcmail.set_env('comm_path', '/path-to-roundcube/?_auth=<?php print
session_id(); ?>&_task=mail');
rcmail.display_message('Read below to learn more about our two
development Webmail projects.');
rcmail.set_env('task', 'login');
rcmail.gui_object('message', 'message');
rcmail.gui_object('loginform', 'form');
//-->
</script>
Then a login form with the hidden (as well as the _user, _pass
variable as text entry)
<input type="hidden" name="_auth" value="<?php print session_id(); ?
>" />
<input name="_action" value="login" type="hidden" />
The form worked when I first copied it, not thinking about session
variables or anything, when that session variable was still active,
so I'm confident that the issue is that the $_auth is not being set
with the JS - please let me know any thoughts you might have 'cause
this is the only thing stopping this baby from going live.
Thanks!
J-dawg