converting web page to pdf in protected members area with pdfmyurl - php

I'm using the pdfmyurl api to convert web pages to PDF. This works fine for all pages on my website, which are not in the members area. My members area requires a user to log in first.
According to the documentation (http://pdfmyurl.com/html-to-pdf-api#secure) I should be able to pass form fields so their converter can access the page. However when I try this, I still get a PDF of the login page.
My login form (http://members.mysite.com/login.php) has the following HTML:
<form class="form-horizontal" id="memberlogin" action="checkpass.php" method="post">
<div class="control-group">
<label class="control-label" for="user">Username:</label>
<div class="controls">
<input name="user" id="user" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password:</label>
<div class="controls">
<input type="password" id="password" name="password" required>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</form>
And in the checkpass.php script I only check for the values of user and password.
I'm using the following API call:
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/login.php&form_fields[user]=username&form_fields[password]=password
I'm confident the password for the user is correct as I can manually log in. I'm pretty sure this is also how I should pass an array over HTTP GET.
Any ideas?

Your form page is http://members.mysite.com/login.php, but you check the login parameters at http://members.site.com/checkpass.php
I think PDFmyURL will need to pass the login parameters to http://members.site.com/checkpass.php, because that's where you check them.
Try the following API call to do this
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/checkpass.php&form_fields[user]=username&form_fields[password]=password
Other than this you must check server logs to find problems with authentication.

Related

Moodle Accept Login from external site from external website

We are adding Moodle to our site (different server, different sub-domain, but same main domain, and the servers are set up to be able to communicate with each other) and what we want to have it do is:
if the User accesses the main site
User logs in User clicks a link to Moodle
The user is automatically logged into Moodle without
having to reenter their info.
i have added the html form with hidden type in my main domine as moodle post url.
Main domine:
<form class="mt-3" action="http://localhost/moodle/login/index.php" method="post" id="login">
<input id="anchor" type="hidden" name="anchor" value="">
<script>document.getElementById('anchor').value = location.hash;</script>
<input type="hidden" name="logintoken" value="xUe9G7a012vTHpvtOxAfzu84YJ046pu4">
<input type="hidden" name="loginhas" value="eda690fdf">
<div class="form-group">
<label for="username" class="sr-only">Username / email</label>
<input type="text" name="username" id="username" class="form-control" value="admin" placeholder="Username / email" autocomplete="username">
</div>
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" name="password" id="password" value="eda690fdf" class="form-control" placeholder="Password" autocomplete="current-password">
</div>
<div class="rememberpass mt-3">
<input type="checkbox" name="rememberusername" id="rememberusername" value="1">
<label for="rememberusername">Remember username</label>
</div>
<button type="submit" class="btn btn-primary btn-block mt-3" id="login">Log in</button>
How to accept this request in moodle ? or if you have any rolution regarding this issue plese help me out of this.
Don't know if possible with Moodle. We do it for several systems using CAS (central authentication service), where several yii2 apps login against a CAS implemented with web2py.
In the Yii side we use https://github.com/2amigos/yii2-usuario for user management and https://github.com/daxslab/yii2-cas-client for auth against the CAS.
Perhaps you need to implement a CAS on Yii and check how make that Moodle authenticates against it.

Google Chrome Autofill not offering to remember login

I have coded a log in page and followed the advice on https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ but Chrome still won't ask me to save my login. Any ideas what I'm missing?
<form method="post" action="/admin/do.php?func=login">
<div class="row justify-content-center">
<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3">
<input tabindex="<?php echo $tabindex++; ?>" type="email" class="form-control" id="email" name="username" autocomplete="username" placeholder="Email address" value="">
</div>
<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3">
<input tabindex="<?php echo $tabindex++; ?>" type="password" class="form-control" id="password" name="current-password" autocomplete="current-password" placeholder="Password" value="">
</div>
<div class="col-4 col-md-3 col-lg-2 mb-3">
<button tabindex="<?php echo $tabindex++; ?>" class="btn btn-primary btn-block" type="submit">Log in <i class="fas fa-arrow-right"></i></button>
</div>
</div>
</form>
Enable the "Offer to save passwords" setting at this link.
After the first login and save, the next logins are suggested.
also You should refer to chrome://settings/payments for the payments field. Then add.
For address fields to chrome://settings/addresses
Thanks for your help, everyone. It turns out this problem was localised to a device, so my code is fine!
Still not sure why this one particular device hasn't synced the login details, but they are definitely syncing to others now so I will troubleshoot the one device separately.
Old question, but still a relevant topic.
The issue was only solved for me as soon as NET_CERT_AUTHORITY_INVALID flag was cleared from the browser.
To do this it required a trusted Cert Auth issued certificate. As soon as I installed my cert, passwords immediately became available for saving / auto-filling.
With self-signed SSL certs it wasn't possible to save / auto-fill passwords.
Your email field has its autocomplete set to username.
Since your input accepts emails only, this creates confusion
You should set the autocomplete to email
OK after 4 hours of investigating and testing login forms with Chrome here are my conclusion.
1- First, make sure your configurations are correct, I'm pretty sure your "Offer to save your web passwords" button is turned-on and everything is fine.
2- Chrome will not offer to save your password if it is not correct.
And how does he know if the password you just entered is correct or not ?
First I thought it will use the HTTP response status code for that, but it turns out it uses something else. I think after many tests that Chrome will think the password you just entered is wrong if he detected the same login form again on the response for submitting the form.
Suppose this is your login form :
<form method="post" action="/signin">
<input type="email" name="email" required>
<input type="password" name="password" required>
</form>
On your server you are doing something like this
<?php
$loginForm =
'<form method="post" action="/signin">' .
'<input type="email" name="email" required>' .
'<input type="password" name="password" required>' .
'</form>';
if ($passwordIsCorrect){
echo " You are logged in successfully!<br>";
echo $loginForm;
} else {
echo " Wrong email or password!<br>";
echo $loginForm;
}
Chrome will think you entered wrong password even if you entered the correct one because he detects the same form with same input names. And this is why #user206 workaround of changing the action attribute of the form did work with him, because Chrome thought the password was correct because the same login form is not detected on the new action page.
3- Chrome will stop offering you to save password if you ignored the offer for the same username/email 3 times (you will need to use another name/email to invoke the offer again).
So to sum this up:
1- make sure your configurations are correct.
2- make sure the the page that you send after a successful login does not have the same login form.
3- make sure you didn't ignore the offer 3 times (you can try a different new email to make sure it's not this reason).
I did my tests on Chrome 76 on Linux

Sending Bootstrap Form Data To Email Address

I have a bootstrap form which I need to send to am email address once the contact form has been submitted. I've built the form using Bootstrap but I've not used PHP before and I'm not sure how to integrate this with the rest of the site.
Is there an alternative to PHP for simply and safely submitting this form data to the email address?
<div class="row" id="contact_us_form">
<h1>Ready to talk?</h1>
<h4 style="margin-bottom:30px">Please call 0345897394852, email email#email.com or fill out the contact form below for a FREE 15 minute consultation.</h4>
<div class="col-sm-5 form-group">
<input class="form-control" id="name" name="fname" placeholder="First Name" type="text" required>
<input class="form-control" id="name" name="lname" placeholder="Last Name" type="text" required>
<input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
</div>
<div class="col-sm-7 form-group">
<textarea class="form-control" id="comments" name="comments" placeholder="Message" rows="5"></textarea>
</div>
<div class="col-sm-12 form-group"><button class="btn btn-default pull-right" type="submit">Send</button></div>
</div>
You could do it in a few steps. Or just one tutorial.
You should first learn some more about how PHP form handling works. Start with this: http://www.w3schools.com/php/php_forms.asp (Dont forget the <form> tags around your form, as you currently do not have these)
(You could do validation, as you want it safely send: http://www.w3schools.com/php/php_form_url_email.asp)
Then move on to sending emails. As linked by #shubham: How to send an email using PHP?
It is not that hard. There are many complete tutorials online. As a simple google search delivered this tutorial: http://www.html-form-guide.com/email-form/php-form-to-email.html
Also be cautious when implementing a contact form. A contact form without captcha validation is prone to spam. Please consider implementing captcha. Hope this helps.

Send email with php for wordpress page

I want to create send email form for wordpress page.
WordPress did not allow php But I can use php by using some plugin.
The problem is I did not know how to create it.
I can not make php file separate. Following is my html code.
please help me to write php code.
php should be separate I can insert it at top or bottom of page. but not in separate file
<form action="" method="post">
<div class="form-group">
<label name="first_name">Name:</label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label name="email">Email:</label>
<input type="email" class="form-control" name="email">
</div>
<div class="form-group">
<label name="subject">Subject:</label>
<input type="text" class="form-control" name="subject">
</div>
<div class="form-group">
<label name="message">Message:</label>
<textarea type="textarea" rows="5" class="form-control" name="message"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-default">Send</button>
</form>
WordPress has a lot of useful plugins for sending mails. I would recommend you to check this: https://pl.wordpress.org/plugins/contact-form-7/
If I'm understanding correctly, you need a contact form to send messages from your WordPress page. Plugin above is very good for things like this and it provides possibility to style your form.

Getting log in information - how does this code work?

I found a similar question here that someone wanted to create a user account loggin similar to this, but it lead me to believe it has to be all done in php in order to handle it and put into a MySQL database. From my understanding this isn't php and it is on the main html website.
How is the data captured and then stored on a database with this code then?
This is taken directly form http://cardoneuniversity.com/
<span class="dominate-and-login-form-text">Already a member?</span>
<form action="https://login.lightspeedvt.com/actions.cfm?lg=447&v=35" method="POST">
<input type="hidden" name="action" value="login">
<div class="form-group username-field">
<label class="sr-only" for="exampleInputUser3">Username</label>
<input name="username" type="text" class="form-control" id="exampleInputUser3" placeholder="Username">
</div>
<div class="form-group password-field">
<label class="sr-only" for="exampleInputPassword3">Password</label>
<input name="password" type="password" class="form-control" id="exampleInputPassword3" placeholder="Password">
</div>
<button type="submit" class="btn btn-default login-univ-btn">Login</button>
<br>
<i>Forgot Username/Password?</i>
</form>
If I seem like nothing more then an uneducated lost programmer, can you care to send me in the direction to learn?
I'm trying to create a learning/course website like this one.
Actually this form is processed by ColdFusion. ColdFusion does a similar job to PHP where it is a server side scripting language. Here is a good tutorial that will teach the basics of a login system using HTML, MySQL and PHP.
User Membership With PHP
For a more advanced and secure tutorial check this out:
How to Create a Secure Login Script in PHP and MySQL

Categories