Jump to content

curl on submit question


shadiadiph

Recommended Posts

My problem is this.

 

I have  a login for I am trying to curl which has an onsubmit=return SignIn_submitForm() in the form line this wouldn't bother me usually but this statement checks tot see if the user and password are empty but then it continues to set the cookie using the document element before submitting how should i do this any ideas?

 

Link to comment
Share on other sites

Sorry for the move, just saw javascript code :)

 

The login you are trying to login to with cURL, is it your own page? If so, try the fix ignace posted. If not, we would need a bit more information. Does this not work? How does it not work, no cookie being set?

 

If this is your site are you wanting to allow people cURL access? If so, why not create a non-javascript login for that?

Link to comment
Share on other sites

Do either providers support OpenID?

 

But what you are doing is having the user enter in their email information then going to the site and signing them in and allowing them to browse it from your site like they are logged in? Is that correct?

 

Is there a reason you are doing it this way?

Link to comment
Share on other sites

no I am asking them to invite their contacts this is very frustrating alot of trial and error problem is some of them use javascript which I absolutely hate if its just to validate if info has been enetered its easy to bypass but in some sites I am looking at they use javascript to validate then set the cookie I am a bit lost there

Link to comment
Share on other sites

no I am asking them to invite their contacts this is very frustrating alot of trial and error problem is some of them use javascript which I absolutely hate if its just to validate if info has been enetered its easy to bypass but in some sites I am looking at they use javascript to validate then set the cookie I am a bit lost there

 

Gotcha, the javascript setting the cookie is the bitch part.

 

I do not think there is a way to bypass this. What is the cookie it is setting? Is it just to test that you have javascript enabled? If so, you may be able to browse the site on your local box and copy the cookie from the file on your local box and mimic that way in your cookies.txt that you are using in the cURL function.

 

You may have to dynamically write it each time, but if it is just a test that should work.

 

Link to comment
Share on other sites

problem is it sets the cookie using document elementid values easy i know the value of login1 = $login password = $password

 

but for example here is the onsubmit script I have made a cookie named sitename.txt and loginName2.txt and saved them in the same directory as the script problem I have at the moment is it keeps taking me to an error 302 page says click here to login if i click on the link i am logged in directly to the site i have tried pregmating the link in the click here page and following it but it says session expired??

 

I somehow need to make sure the cookie is correct i think but then i dont get if i click the link it successfullly logs me in if i follow the link in curl it says session expired

 

<script>/*<![CDATA[*/ function SignIn_submitForm()
{
    SignIn_storeLoginName();
    var login = SignIn_stringtrim(document.getElementById('login1').value);
    var pwd = SignIn_stringtrim(document.getElementById('password').value);
    if(login == '' || pwd == '')
    {
        document.getElementById('EmptyUsernamePassWord').style.cssText='';
        return false;
    }
    else
    {
            document.getElementById('EmptyUsernamePassWord').style.cssText='Display:None';
    }
    return true;
}

function SignIn_storeLoginName() {
var expdate=new Date ();
expdate.setTime (expdate.getTime()+(365*24*60*60*1000)); // 24 hrs from now
SignIn_SetCookie('loginName2',document.mailcom.login1.value,expdate);
if(document.mailcom.siteselected)
{
    var sitetype=((document.mailcom.siteselected[0].checked=="1")? "normal":"betaus");
    SignIn_SetCookie('sitetype',sitetype,expdate);
}
return true;
}

function SignIn_stringtrim(str)
{
    try {
        return str.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
    }
    catch(e) 
    {  
    }
}

function SignIn_SetCookie(name,value,expires,path,sitedomain,secure) {
document.cookie=name+"="+escape(value)+
 ((expires)? "; expires="+expires.toGMTString():"")+
 ((path)? "; path=":"; path=/")+
 ((sitedomain)? "; domain="+sitedomain:"; domain=.mail.com")+
 ((secure)? "; secure":"");
}

function SignIn_getCookieVal(offset)
{
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) 
    endstr=document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function SignIn_GetCookie(name) {
var arg=name+"=", alen=arg.length,clen=document.cookie.length, i=0;
while (i<clen) {
	var j=i+alen;
	if (document.cookie.substring(i,j)==arg) return SignIn_getCookieVal(j);
	i=document.cookie.indexOf(" ",i)+1;
	if (i==0) break;
}
return null;
}

function SignIn_startup() {
    try{
    (SignIn_GetCookie('sitetype')=="betaus")? document.mailcom.siteselected[1].click():document.mailcom.siteselected[0].click();
    if (SignIn_GetCookie('loginName2')) {
	    if (document.mailcom.login.value=="") {
		    document.mailcom.login.value=SignIn_GetCookie('loginName2');			
	    }
    }
    }
    catch(e){}
}
function SignIn_ToggleText(txtBox, text, toShowDefault)
{   
    var trimmedTbVal  = SignIn_stringtrim(txtBox.value);
    var trimmedTxtVal = SignIn_stringtrim(text);
    
    if(toShowDefault)
    {
        if(trimmedTbVal=='')
            txtBox.value =  trimmedTxtVal;        
    }
    else
    {
        if(trimmedTbVal==trimmedTxtVal)
            txtBox.value = '';
    }
    
}
function SignIn_Error()
{        
    var qstring = SignIn_GetQueryString(window.location.href,'err');
    if(qstring!=null && qstring !='')
    {
        try
        {
            var SignInErrorArray = new Array(); 
            SignInErrorArray['err_disabled_login'] = 'Invalid username/password';
            SignInErrorArray['err_EmptyUserNamePassword'] = 'Username Empty and/or Password Empty';
            SignInErrorArray['err_invalid_login'] = 'Invalid username/password.';
            SignInErrorArray['err_serverconnect_fail'] = 'Error connecting to Server';
            SignInErrorArray['err_suspended_user'] = 'Invalid username/password';
            SignInErrorArray['err_wrong_site'] = 'You\'re logging in the wrong site. Please login at http://www.mail.com';
            
            var errorDiv = document.getElementById('warning');
            var error = SignInErrorArray[qstring];
            if(error !=null)
            {
                errorDiv.innerHTML = error;
                errorDiv.style.display='';
            }
        }
        catch(e)
        {            
        }
     }   
}
function SignIn_GetQueryString(url, key )
{
    url = unescape(url);        
    var re = new RegExp( "[?&]" + key + "=([^&$]*)", "i" );
    var offset = url.search( re );
    if ( offset == -1 ) return null;
    return RegExp.$1;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.