![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
http request and html
hey guys here is html code for a page:
<!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>Imail :: Welcome to Imail</title>
<link rel="SHORTCUT ICON" href="/imp/graphics/favicon.ico" type="image/x-icon" />
<link href="/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="/imp/redirect.php?Horde=7ee9cf3d5dba3f4a4bda1103fce00a8f" 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">
Welcome to Imail</td></tr>
<tr>
<td align="right" class="light"><b>Username</b></td>
<td align="left"><input type="text" tabindex="1" name="imapuser" value="" /></td>
</tr>
<tr>
<td align="right" class="light"><b>Password</b></td>
<td align="left"><input type="password" tabindex="2" name="pass" /></td>
</tr>
<tr>
<td>
<input type="hidden" name="server" value="pop.aub.edu.lb" />
<input type="hidden" name="port" value="143" />
<input type="hidden" name="namespace" value="" />
<input type="hidden" name="maildomain" value="aub.edu.lb" />
<input type="hidden" name="protocol" value="imap/notls" />
<input type="hidden" name="realm" value="" />
</td>
<td><input type="hidden" name="folders" value="INBOX." /></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="ar_OM">Arabic (Oman) (العربية)</option><option value="ar_SY">Arabic (Syria) (العربية)</option><option value="id_ID">Bahasa Indonesia</option><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 (Česky)</option><option value="da_DK">Dansk</option><option value="de_DE">Deutsch</option><op
ffb
tion 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="gl_ES">Galego</option><option value="el_GR">Greek (Ελληνικά)</option><option value="is_IS">Íslenska</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">Lietuvių</option><option value="mk_MK">Macedonian (Македонски)</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">Românä (Romanian)</option><option value="ru_RU">Russian (Русский) (Windows)</option><option value="ru_RU.KOI8-R">Russian (Русский) (KOI8-R)</option><option value="sk_SK">Slovak (Slovenčina)</option><option value="sl_SI">Slovenian (Slovenščina)</option><option value="fi_FI">Suomi</option><option value="sv_SE">Svenska</option><option value="th_TH">Thai (ไทย)</option><option value="uk_UA">Ukrainian (Українська)</option></select></td>
</tr>
<tr>
<td> </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>
</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;
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 = 'Imail :: Welcome to Imail';
//-->
</script>
<BR>
<table>
</tr></table>
</body>
</html>in other words i want to be able to perform this line in an http request: document.implogin.submit(); so should i look into http post requests more? how can i know the systax of my http request by looking at the source code of the webpage, specifically the "submit" button.. thanks a bunch all.. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
To get a reference to the form implogin, you don't use document.implogin, but document.getElementById("implogin"). You can store the result of that in a variable if you wish.
Oh, and this should be in the JavaScript forum. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
If you want to check the form, before submitting the form. In the <form> tag put onSubmit="submit_login();" . If submit_login() returns false, the form will not submit.
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi freelance scripts - http://ryanguthrie.com/index.html |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
thanks for the replies guys...
i will make my question a little more specific: This is what i sent to the IP of the website: GET / HTTP/1.1\r\n Accept-Encoding: gzip, deflate\r\n Host: 192.168.141.107\r\n Connection: Keep Alive\r\n\r\n how can i access document.getElementById("implogin") |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
alright i did it... but in a very peculiar way. i made another program which emulates the server of the website that my client program was trying to access it..
this server listens for a connection, it recieves an http get request from the internet browser.. then it send the code i posted below (html/javascript).. then the server closes the connection.. i filled in the username and password in the Internet browser and clicked submit.. whose request offcource went to my emulation of the webserver im trying to see.. i studied the http request, i didnt find any relation to the page's source code.. this is what happens when you press the submit button: POST /imp/redirect.php?Horde=4db15905f8d71e1d00e5f2f376adc085 HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms- excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwav e-flash, */* Referer: http://192.168.141.107/ Accept-Language: en-us Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322 ; .NET CLR 2.0.50727) Host: 192.168.141.107 Content-Length: 193 Connection: Keep-Alive Cache-Control: no-cache actionID=105&url=&mailbox=INBOX&imapuser=hbe02&pass=mypassword&server=pop.aub.edu.lb&p ort=143&namespace=&maildomain=aub.edu.lb&protocol=imap%2Fnotls&realm=&folders=IN BOX.&new_lang=en_US&button=Log+in you can notice where the user and pass went.. user:hbe02 , pass: mypassword after i found out that the internet browser sends this request when i submit the form.. i used this request to access the webserver back in my original web client program.. any critique to my method? |
|
|
|
|
|
#6 |
|
PFO Founder
![]() ![]() |
Moved to Javascript forum
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| send() problem w/ http server | kch_86 | C | 2 | Nov 25th, 2005 1:53 AM |