<p>If you're trying to create a front-end login form, I'd suggest using this as a starting point: <a href="https://docs.craftcms.com/v3/dev/examples/login-form.html" rel="nofollow noreferrer">https://docs.craftcms.com/v3/dev/examples/login-form.html</a></p>

CC BY-SA 4.0
2019-07-19T06:39:56.867Z
I want to add a login for users of the site, not for the admin section, that link is for the admin section right?, I deleted the tutorial I put in the question as it was apparently really bad code, I followed a better tutorial that works perfectly but just trying to convert $_SESSION to Twigs session object now, not really sure how to do it.
JTR
CC BY-SA 4.0
2019-07-19T18:59:43.683Z
A user is a user in Craft and they either have permissions to access the Control Panel or they don't.  So the link above allows you to create a login form on the front-end of the site so they'll have a valid PHP/Craft session.
Brad Bell
CC BY-SA 4.0
2019-07-20T02:50:32.417Z
If what I'm thinking is right then I just waisted a lot of time haha, so what you're saying is all I have to do is create a user in the Craft CMS settings section and then put that code in my front-end and, then I can apply twig to display certain things on my craft templates to those users so "Welcome, {{ session.username }}"? I thought that login form was a front-end method of reaching the CMS, if it isn't then that sounds exactly like what I want.
JTR
CC BY-SA 4.0
2019-07-20T12:38:00.087Z
Also this seems only possible with Craft Pro, but I guess I'm just going to have to get that.
JTR
CC BY-SA 4.0
2020-08-12T12:00:41.560Z
Yes this is correct – you can use Craft to login users on the front end so they will never see the control panel. Yes you will need pro for multiple user support.
dmatthams
CC BY-SA 4.0
2019-07-18T23:23:16.157Z
2019-07-18T23:23:16.157Z
Brad Bell
<p>I'm trying to implement <a href="https://www.codeofaninja.com/2013/03/php-login-script.html" rel="nofollow noreferrer">this</a> tutorial in my Craft CMS site, I've created all the files and they currently reside in public_html, but twig and the .htaccess of Craft CMS is interfering with it.</p>

<p>Does anyone know what the directory structure should look like to integrate this with craft cms or whether it's possible by other methods?</p>

<p>Appreciate any help.</p>

<users><php><login>
PHP Login & Sessions without Craft Commerce?
# PHP Login & Sessions without Craft Commerce?

(Asked by: username_0 on 2019-07-17)

I'm trying to implement [this](https://www.codeofaninja.com/2013/03/php-login-script.html) tutorial in my Craft CMS site, I've created all the files and they currently reside in public\_html, but twig and the .htaccess of Craft CMS is interfering with it.

Does anyone know what the directory structure should look like to integrate this with craft cms or whether it's possible by other methods?

Appreciate any help.

**Tags:** users, php, login


---

## 1 answers

### Answer by username_1 on 2019-07-18. Score: 1

If you're trying to create a front-end login form, I'd suggest using this as a starting point: <https://docs.craftcms.com/v3/dev/examples/login-form.html>

> **Comments:**
> **username_0**: I want to add a login for users of the site, not for the admin section, that link is for the admin section right?, I deleted the tutorial I put in the question as it was apparently really bad code, I followed a better tutorial that works perfectly but just trying to convert $_SESSION to Twigs session object now, not really sure how to do it.  
> **username_1**: A user is a user in Craft and they either have permissions to access the Control Panel or they don't.  So the link above allows you to create a login form on the front-end of the site so they'll have a valid PHP/Craft session.  
> **username_0**: If what I'm thinking is right then I just waisted a lot of time haha, so what you're saying is all I have to do is create a user in the Craft CMS settings section and then put that code in my front-end and, then I can apply twig to display certain things on my craft templates to those users so "Welcome, {{ session.username }}"? I thought that login form was a front-end method of reaching the CMS, if it isn't then that sounds exactly like what I want.  
> **username_0**: Also this seems only possible with Craft Pro, but I guess I'm just going to have to get that.  
> **username_2**: Yes this is correct – you can use Craft to login users on the front end so they will never see the control panel. Yes you will need pro for multiple user support.  

---

