i have one website that generates a session id and opens another website in the context of this session id.i want one button to open the first site and than automaticaly login on the second site.
site 1:http://thisisanexample/example leads to http://thisisanotherexample/another
this opens the the first site and the second site is opened afterwards:
var myWindow;
function openWin() {
myWindow = window.open("http://thisisanexample/example");
}
</script>
after here i'm stuck. How could i submit the following Post request to site 2
<form action="http://thisisanotherexample/another/" method="POST" name="logonForm">
<input type="text" name="user" value="placeholder">
<input type="hidden" name="passwordnew1" value="">
<input type="hidden" name="passwordnew2" value="">
<input type="password" name="password" value="placeholder">
<input type="hidden" name="welcomescreen" value="1">
<input type="submit" value="Anmelden" name="cmd_login">
I hope you get what i mean :-)
You can use:
window.location.href = "http://www.example.com/otherSite?name=ferret";
to navigate to the second site while passing the username and possibly the password via a query string parameter. The second site will have some kind of method to accept these arguments and automatically log the user in. It's highly recommended that you encrypt the query string data somehow.
https://en.wikipedia.org/wiki/ROT13
Related
I have a simple HTML page that logs into another website by creating a form with a "POST" method and a URL as the action, along with a username and password. After "document.forms[0].submit()", I want a blank page to be displayed instead of URL. I have tried the 4 commands below after "document.forms[0].submit()", but it just momentarily redirects to "about:blank" before redirecting to the URL. The code is as follows:
<form method="POST" action="https://example.com/login">
<input type="text" name="username" value="xxx" />
<input type="password" name="password" value="xxx" />
</form>
document.forms[0].submit();
//window.location.replace("about:blank")
//location.href="about:blank";
//window.open("about:blank", "_self");
location.replace("about:blank");
Is there another way to redirect to the blank page on a more permanent basis?
i am building a form and when i submit it it opens the action url. I want to submit the form on click button which should not open the target url but submit the request. as well as i want to print a message after submit and form should be cleared after submit.
<form id="contact" action="https://control.msg91.com/api/sendhttp.php" method="post">
<h3>Send SMS</h3>
<h4>Build in Process</h4>
<fieldset>
<input name="authkey" type="hidden" value="auth key as required"/>
<input name="mobiles" placeholder="Mobile Number" type="text" tabindex="1" maxlength="10" required >
</fieldset>
<fieldset>
<textarea name="message" placeholder="Type your message here...." tabindex="2" maxlength="320" required></textarea>
</fieldset>
<input name="sender" type="hidden" value="FAKEin" />
<input name="route" type="hidden" value="4" />
<input name="country" type="hidden" value="0" />
<fieldset>
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
any help how can i do this?
also can i add a hidden text in message tab that should add to the message tab in post/get as + instead of &
eg. actionurl.php?authkey=custommade&mobiles=9999999999&message=orginal+message+hidden+message&sender=FAKEin&route=4&country=0&submit=
You can also check the source code of page https://www.tricksbygoogle.com/sms/sms.php
Basically You can't .
The only solution here I see , is using ajax query and use javascript to clear form.
This example I provide is no redirections at all. What means you page will not be reloaded.
Maybe little jquery will help.
var result_func = function(response){
if(response.allOk){
$this.reset();
}
}
$('#contact').submit(function(e){
e.preventDefault()l
var $this = $(this);
var data = $this.serialize();
$.post($this.attr('action'),data,result_func.bind($this));
});
Header location will work , but user still will be redirected.
Based on your question, and the comments it looks like you're going to have to do a little bit of research. Here are some tips though.
If you would like to include the functions from a page without actually visiting the page, than you can use what is called an include statement. This will keep the browser from visiting that page while still executing it. - http://php.net/manual/en/function.include.php
To display a message you're going to need to hide and show the element with javascript. I would suggest viewing this question - Hide div after a few seconds
Basically on submit, you're going to want to check for the variables from your form. You would run a php if statement.
Then, if those variables exist you are going to want to include your action page.
In the same if statement, you're going to want to echo a <div> with a class that has some javascript attached to it to hide it after a few seconds.
The form will automatically clear on submit.
if($variable != null){
include '/action.php' // --- you can add some GET variables to the end of this if you would like to.
echo '<div id="message">Message sent</div>'
}
I want to submit the another website submit button from my website using javascript, is it possible..? My Code are below:
<script type="text/javascript">
function formSubmit() {
document.getElementById("form1").submit();
}
</script>
<form name="form1" method="post" action="http://XXXXX/Login.aspx?ReturnUrl=%2fdefault.aspx?" id="form1" >
<input type="hidden" name="NewCorporateId" id="NewCorporateId" value="XX" />
<input type="hidden" name="UserName" id="UserName" value="XXXX" />
<input type="hidden" name="Password" id="Password" value="XXXX" />
</form>
<form name="form2" id="form2" method="post>
Click here
</form>
Specified URL opened fine in new tab and button not submitted in that
site. That site contain the one submit button and username and
password text filed.. I have username and password value.. So i try to
submit the button in referring site from my website.
Its possible and the post code is correct, but because you post on aspx page Login.aspx, aspx pages protect from sending data that is not come from the same site by adding a hash code of controls. Also there is the ViewState of the page, and other hidden parameters added by aspx - so your call will fail.
Contact with the one that handle the login.aspx page to give you some way to login there - not direct by the page.
related :
What is the purpose of __EVENTVALIDATION __VIEWSTATE in aspx?
I'm developing a search system(multiple filters) that uses pagination with php.
At first i was using the method POST with the main form. But, using POST i was unable to keep the pagination. Reason: when the user search by name, for example, as he clicks in the next pages the query get lost and return to the first page.
To fix this i use GET method instead.
But using GET, the url gets the parameters. And the users don't want that.
Example:
http://mysearch.com/search.php?name=joe&id=1
I just want to be
http://mysearch.com/search.php
I tried this workaround:
if(typeof window.history.pushState == 'function') {
window.history.pushState({}, "Hide", "http://mysearch.com/search.php");
}
But when i hit the "Previous Page/Back" in the browser, the URL with the parameters come back either.
Is there a solution for this? Use GET or POST with pagination and the parameters does not shows in the URL?
You can paginate with $_POST just as easily as with $_GET and without SESSION variables/cookies, you just need to pass the pagination variables as hidden values in your HTML form.
eg - for two buttons, one of which takes you to previous page, and one to next:
//prev button
<form action="paginate.php" method="post">
<input type="hidden" name="prev" value="0"/>
<input type="submit" value="Go to previous page"/>
</form>
//next button
<form action="paginate.php" method="post">
<input type="hidden" name="next" value="2"/>
<input type="submit" value="Go to next page"/>
</form>
//search form
<form action="paginate.php" method="post">
<input type="hidden" name="prev" value="0"/>
<input type="hidden" name="next" value="2"/>
<input type="text" name="search" value="User input goes here"/>
<input type="submit" value="Search the database"/>
</form>
The disadvantage is that POST will give 'page expired' errors when using the browser back button (but not the HTML buttons), which is not great. For that reason I'd prefer $_GET, and also because you can bookmark $_GET queries, but not $_POST.
I am searching a way to make the browser ask the user if he wants to remenber his password, when a form is submited without changing the current page (using the submit event for example).
I made a jsfiddle to show this: http://jsfiddle.net/HeFFh/2.
<form action="javascript:">
<input type="text" value="user" />
<input type="password" value="pass" />
<input type="submit" />
</form>
When you press the submit button, the browser should ask you if the password have to be remembered.
It only works with Firefox. Am I doing something wrong ?
It is based on browser settings and not on the code.
For chrome: goto -> settings -> show advanced settings -> Passwords and Forum -> Select "Offer to save passwords I enter on the web"
For more help visit this link
I believe you have to have the action attribute set to something other than "javascript:" and the inputs should have a name attribute.
Try this:
<form action="/" >
<input type="text" value="user" name="username" />
<input type="password" value="pass" name="password" />
<input type="submit" />
</form>
This will not override the browser setting, but will allow the feature to be used if it's not turned off by the user