Getting log in information - how does this code work? - php

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

Related

How to Allow only Valid Gmail users sign up in my PHP Laravel website?

I have this my sign up form in my php Laravel site which I think hackers and robots are making unnecessary sign-ups. But now, I want to allow only Valid Gmail users to create an account. I have configured this form but users with unknown mails are able to sign up. I'm a newbie in php Laravel codes. Someone should please help me configure this to achieve the goal. Thanks in advance. See form bellow.
#csrf
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="{{__('Full Name')}}">
</div>
<div class="form-group">
<input type="text" name="username" class="form-control" placeholder="{{__('Username')}}">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="{{__('Gmail')}}">
</div>
<div class="form-group">
<input type="tel" name="tel" class="form-control" placeholder="{{__('WhatsApp Number')}}">
</div>
<div class="form-group">
<input type="text" name="gender" class="form-control" placeholder="{{__('Gender')}}">
</div>
<div class="form-group">
<input type="text" name="item" class="form-control" placeholder="{{__('What do you want to buy? Please type in your issues here')}}">
</div>
Laravel have great set of email validation tools. Here you can find some detail explanation: https://minuteoflaravel.com/validation/laravel-email-validation-be-aware-of-how-you-validate/
I think that will be enough to prevent most "hackers and robots" emails.
If you still want to accept "gmail.com" addresses only, then you can use, again, laravel ends-with validator:
'email' => ['ends_with:gmail.com', ...]
If you want to be sure that they are real emails then I suggest you implement laravel email verification
For more strict verification you can also use some external services like Mailgun email verification.
To stop bots from signing up, you can integrate a captcha service like ReCaptcha.
There are multiple packages which can help you reduce the amount of code to be written. Try having a look at laravel-recaptcha package on Github.

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

converting web page to pdf in protected members area with pdfmyurl

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.

Email contact form without PHP

I'd like to use a contact form for a website I'm creating, but PHP is not an option since the client doesn't wish to use it. Is there a clever way to work around this somehow, by sending email parameters (which is non-standard) perhaps, or by using an external contact form? Are there any good ones that don't use advertising and are easily modified to a different language for example?
Thank you.
Check out formspree.
https://github.com/asm-products/formspree
For action you simply put:
<form action="http://formspree.io/you#email.com" method="post">
<input type="text" name="name">
<input type="email" name="_replyto">
<input type="submit" value="Send">
After verifying your email after the first send this will email you the contents of the form. One thing to keep in mind is that this will take the input names. If you do not include input names it won't send you that form field.
There are hundreds of embeddable (most likely iframe-based) solutions for contact forms, which would enable you to get around using a server-side language like PHP. Just a quick google search will give you some.
Alternatively, you could make a form in HTML, and have a submit button which is actually a mailto: link, and you modify the parameters of that mailto as your form inputs change.
The only downside of this is that it's not as convenient for the user, as it then opens up their email client and they have to actually send it.
Personally, I would try and persuade the client, but if that isn't possible, then those are your options.
Check out www.enformed.io.
Has a couple of interesting options that formspree does not have( Like redirect out of the box, and a html email editor).
I used Formspree but formspree doesn't allow ajax unless you have Gold Version. It doesn't work on the basic so I am planning on making an account on enformed.io. I still haven't used it but I have heard that t is very good. You can also use alerts fro success and error messages.
<form style="margin-left: 6%;" class="email" action="https://www.enformed.io/YOUR_TOKEN" method="post">
<p>Name:</p>
<input type="text" name="first_name" />
<div id="margin" style="height: 0.5%;"></div>
<p>E-mail:</p>
<div id="margin" style="height: 0.5%;"></div>
<input type="text" name="email" />
<div id="margin" style="height: 0.5%;"></div>
<p>Subject:</p>
<div id="margin" style="height: 0.5%;"></div>
<input type="text" name="subject" />
<div id="margin" style="height: 0.5%;"></div>
<p>Message:</p>
<div id="margin" style="height: 0.5%;"></div>
<textarea name="message"></textarea>
<div id="margin" style="height: 0.5%;"></div>
<button type="submit" class="btn btn-default">Submit Form</button>
</form>
Would something as simple as a mailto form work?

Categories