Where should I start? php

I want to start a website that users can register and login. and after logging in I want users to be able to submit input-fields that I specify and get all the users login details (to know which user submitted the form to the database) only registered users, and none registered users can’t get to the submission input fields.

how do I start this where to search?? most of the Youtube videos only do a register and login tutorial without counting how to give certain features to the logged-in users.

The language I want to use is PHP.

Thanks,

Personal option: Oh dear god.

Learn something more useful, Like Ruby on Rails.

Yes I have used both.

2 Likes

I’m searching for an easy language to use . is ruby easier than php??

No, either of them is not.

There is no easy backend language.

What ruby does better than php is that at least when on rails, it seeks to take care of a lot of boiler plate. Whereas, if you go php, you will find yourself reading the docs a whole lot more.

To be fair php is a decent language. I have not used class based php/pdo really at all because it did not feel complete to me and more bolted-on after the fact.

I suggest you try them both, and see which one works best for you.

2 Likes

Starting in php5 and primarily in php7, oop is quite good IMO.

I’ve not used ruby and I’m sure its fine, php seems more popular which is why I picked it up.

@Pavilions whatever you choose I strongly recommend you stick to documentation, textual tutorials, discussion boards or anything that’s not a video.

In a nutshell:
Once you have a user system in place, php uses sessions and/or cookies to track the users login status. Your script will gather the session, verify the users login status or privilege in a db and build the page accordingly.

Thank you a lot you made a bit simple so I know where to get started.

Oh dear god, … Ruby … really?

I’d say use Go, it’ll get you way further, and it’s so easy to deploy - just a single binary talking http with both a web server and your code in it, and you can embed templates for pages too.

(used php, ruby, Python, c, c++ boost, Java tomcat/jboss, …)

You need to track users between sessions (user accounts) and you need to track logged in users using session cookies on the client side and the cookie will reference session variable storage storage on the server side, (hopefully cookie id can be crypto signed).

And with every request to any access sensitive page,

  • you need to get the session cookie from the request, validate it
  • exchange it for a whole bunch of session variables that include user identity,
  • and then you need to authorize the page, or request/render the page differently, or provide different backend (GET/POST) request handling behavior based on who the user is.

The login page is what exchanges user credentials sent in a request, with session variables on the server, and a session id cookie that’s then given to the client that the client is expected to reference in future requests.

PHP will magically do a lot of this for you, or at least make it easy, but it’s not that hard no matter the language.

FORTRAN! Jokes. Yes possible but jokes calm down. Anyway, take a long look at Laravel and Composer. PHP has a bad rep but has come a long ways in the past 2 years. If you insist on rolling your own database class then PDO only. If you so much as catch one wiff of mysql_i or even just mysql fucking run. I would recommend JavaScript / Node … It’s taking over the universe. I use both PHP and Node on a somewhat frequent basis. They are both strong tools.

Lol I forgot about Golang.

I am doing what you want to do right now.

I use this:

There is so much material on Laravel.

You’ll need this as well:

https://laravelcollective.com/docs/5.4/html

Laravel is a framework that combines a lot of technologies together. It uses PHP.

It’s useful because it automates a lot of the basic stuff most websites need, or makes doing it easier.

1 Like

you didn’t specify much about your background which makes it hard to provide a comprehensive answer, but I here are some stuff I figured would be useful for you:

1- If you are new to programming and are using this project as educate yourself, the language that you want to learn is javascript. It is used both in backend and frontend, has relatively easy to use runtime environment ( just a browser for the most basic form ) and these is the seeing a lot more new innovation ( as in framework and libraries ) than any other language.

2- similar to rails, which is a framework for ruby and provides lots fo boiler plate code that makes the act of development faster, lots of framework exist that provide similar functionality for php. @Vitalius mentioned one ( laravel ). Another one that I have used and I can vouch for is YII. you can find other by just searching for php frameworks online

3- user management ( session management, authentication, password storage, role base access control, … ) for websites is not, by any means, an easy thing to do. Technically speaking, specially when the issue of scale comes into place, this is one the most sophisticated aspect of web development that developer and system architect have to tackle and goes far beyond the language and the framework that is being used and involves the entire development and production stack that would be put in place. I guess what I am to trying to say hers is be careful.

Don’t let others personal language preferences sway your decision. If you want to learn PHP, go learn it. If you want to learn Python or Elm or whatever, go learn that. The only “wrong” thing you can do is to keep switching languages because people make fun of your language of choice.

I am a professional web developer and have used just about all the web-centered languages, as well as databases from IBMs DB2 to Microsoft SQL. No language is really better than any other, they are just built to do different things.

You can always make fun of different languages.

  • PHP deserves all the hate it gets from the php4 days
  • Javascript was written in 10 days as a joke
  • Java is (or was, I have not kept up to date on it) a walking security disaster

The list could go on and on. There is quite literally no language you can not make fun of, or find a reason not to use it. At the end of the day though, its not the brand of tools available but how you use them.

@Vitalius mentioned that watching Laravel tutorials might be a good place to start. I personally love Laravel. I use it in many of my personal projects, but I would not recommend it to new PHP devs at all. It gives you a lot of power and uses a lot of very advanced development practices. It will just end up frustrating you.
If you are really starting from absolute scratch, give PHP: The Right Way a look. It is a great resource that I reference myself from time to time.

The only other piece of advice I have for your app is to use a database abstraction layer such as PDO. It will save you some headache.

Of course feel free to stop by and ask more questions. Lots of smart people around who would love to help out!

1 Like

Thank You very much for answering and giving advice and details. The only problem I have is that I’m new to backend development and I found that PHP is really easy to pickup I done some simple projects and it was really good experience, but now I’m thinking of trying laravel maybe it could be better for my usage, also I really heard good stuff about javascript but my only problem is I don’t know how to find good tutorials to teach me, when I learn the basics I can’t find the way to develop my learning of the basics into a project that I need to do.

The only problem is that I don’t know where to start.

Thank you judahnator for answering. I really do agree with you I was going back and forth between languages just because PHP had a bad reputation, as for my level of programming I’m a beginner I know the basics like loops functilns variables and multiple other things but that’s it. I never knew how to use the basics in a real time project.

do you think I can jump to laravel with the basics of PHP? or should I stay with PHP?

and again Thank You very much for answering and helping.

I think you should stick to basics when learning. Once you’re comfortable with the basics, you can peek into the sources and evaluate different frameworks, maybe even learn from their implementation.

Reason is that frequently the various frameworks and libraries use some magical language porn to achieve either efficiency or ergonomics. It makes them pretty on the outside, on inside not so much. Unfortunately it doesn’t mean that you won’t have issues with those frameworks down the road. In order to fix those issues, you’ll need to understand how they work. Fixing stuff you rely on is your responsibility as a developer delivering a product.

It might be worth looking into Laravel to see what it has to offer. I talked to some other developer buddies of mine, and there seems to be mixed opinions about if it is good for beginners or not. I don’t think it is the best thing to start with, but since some others think it is a good idea I think you should do it at your own risk.

Here are the docs on basic routing, and here is a good video course on it. It might work out for you, it might not. Just keep in mind that you will be fighting both the learning curve of the language, as well as the learning curve of the framework.

What I might do in your shoes is to build a basic version of your app without the help of a framework so you get experience, then I might go back and build it again using a framework.

If you use IRC there are a few channels you might want to check out. I am a member of #MKEPG (Milwaukee PHP User Group) and #PHP. Lots of friendly folk in there happy to answer questions.
If you don’t do IRC, this forum and reddit would both be happy to answer qustions.

Three month necro thread is locked