Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 29th, 2006, 4:55 PM   #1
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
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) (&#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064a;&#x0629;)</option><option value="ar_SY">Arabic (Syria) (&#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064a;&#x0629;)</option><option value="id_ID">Bahasa Indonesia</option><option value="bg_BG">Bulgarian (&#x0411;&#x044a;&#x043b;&#x0433;&#x0430;&#x0440;&#x0441;&#x043a;&#x0438;)</option><option value="ca_ES">Catal&agrave;</option><option value="zh_CN">Chinese (Simplified) (&#x7b80;&#x4f53;&#x4e2d;&#x6587;)</option><option value="zh_TW">Chinese (Traditional) (&#x6b63;&#x9ad4;&#x4e2d;&#x6587;)</option><option value="cs_CZ">Czech (&#x010c;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&ntilde;ol</option><option value="et_EE">Eesti</option><option value="fr_FR">Fran&ccedil;ais</option><option value="gl_ES">Galego</option><option value="el_GR">Greek (&#x0395;&#x03bb;&#x03bb;&#x03b7;&#x03bd;&#x03b9;&#x03ba;&#x03ac;)</option><option value="is_IS">&Iacute;slenska</option><option value="it_IT">Italiano</option><option value="ja_JP">Japanese (&#x65e5;&#x672c;&#x8a9e;)</option><option value="ko_KR">Korean (&#xd55c;&#xad6d;&#xc5b4;)</option><option value="lv_LV">Latvie&#x0161;u</option><option value="lt_LT">Lietuvi&#x0173;</option><option value="mk_MK">Macedonian (&#x041c;&#x0430;&#x043a;&#x0435;&#x0434;&#x043e;&#x043d;&#x0441;&#x043a;&#x0438;)</option><option value="hu_HU">Magyar</option><option value="nl_NL">Nederlands</option><option value="nb_NO">Norsk bokm&aring;l</option><option value="nn_NO">Norsk nynorsk</option><option value="pl_PL">Polski</option><option value="pt_PT">Portugu&ecirc;s</option><option value="pt_BR">Portugu&ecirc;s Brasileiro</option><option value="ro_RO">Rom&acirc;n&auml; (Romanian)</option><option value="ru_RU">Russian (&#x0420;&#x0443;&#x0441;&#x0441;&#x043a;&#x0438;&#x0439;) (Windows)</option><option value="ru_RU.KOI8-R">Russian (&#x0420;&#x0443;&#x0441;&#x0441;&#x043a;&#x0438;&#x0439;) (KOI8-R)</option><option value="sk_SK">Slovak (Sloven&#x010d;ina)</option><option value="sl_SI">Slovenian (Sloven&#x0161;&#x010d;ina)</option><option value="fi_FI">Suomi</option><option value="sv_SE">Svenska</option><option value="th_TH">Thai (&#x0e44;&#x0e17;&#x0e22;)</option><option value="uk_UA">Ukrainian (&#x0423;&#x043a;&#x0440;&#x0430;&#x0457;&#x043d;&#x0441;&#x044c;&#x043a;&#x0430;)</option></select></td>
</tr>

<tr>
    <td>&nbsp;</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>
how does i need to be able to use my web client to login with a username and password..
in other words i want to be able to perform this line in an http request:
document.implogin.submit();
i think i need to use the http post command, but in what syntax.. i dont really know html/scripting.. and dont plan on learning for this short term project since im just doing this for fun..
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..
hbe02 is offline   Reply With Quote
Old Sep 29th, 2006, 5:06 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 29th, 2006, 5:09 PM   #3
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 202
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
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
Mocker is offline   Reply With Quote
Old Sep 29th, 2006, 5:47 PM   #4
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
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
what should i send next to get the source code of the page after i login?
how can i access
document.getElementById("implogin")
throughhttp requests?
hbe02 is offline   Reply With Quote
Old Sep 29th, 2006, 7:58 PM   #5
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
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?
hbe02 is offline   Reply With Quote
Old Sep 29th, 2006, 8:23 PM   #6
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,623
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
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.
big_k105 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
send() problem w/ http server kch_86 C 2 Nov 25th, 2005 12:53 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC