Im quite handy when it comes to PHP, but this object oriented side of it all just blows me away completely. The smallest thing has to be made super complex and annoying. Its a shame to be forced to learn it to be able to get work :(
Nevertheless, I respect you greatly for taking the time to do this and hope that people take the time to watch it again and again instead of bugging you endlessly.
oh, no it's cool, I was just testing the form, but the preg_match section of {5,12} was giving me an error on the data I was entering, I didn't know why, as it turns out it was that piece of code, i am not that good on reg expressions. What i meant was that i think allowing people to put characters should go beyond 12..maybe like 40..but that's my opinion.
Oh ok. Yea regular expression can be tricky at first, but once you get the hang of it then it will be a breeze. Well, if you have any questions or problems with these tutorials feel free to send me a message.
$e->getMessage() is part of the exception class. The error is called when we throw an exception:
throw new Exception("Put your error message in here");
And about your second question. Yes, you can output the $e error message right away, but in most cases it would be considered bad programming practice. Each method inside a class should have unique task. In this case, verify post is used only to verify post data. Therefore, I have a showErrors method to perform error output. And so on.
How do you find the database root?
MrJakosaurus 2 weeks ago
Hi phpclass !
Thanx for these great tutorial ! Really appreciated.
Just on thing u may explain : why do set $this->id to 0 on the construct ?
I'm having trouble to pass the database validation with PDO.
Just trying to figure it out..;
Thanks in advance !
kostraone 1 month ago
This has been flagged as spam show
@phpclass I'm getting an error in the member's area page. Here's what it says:
Notice: Undefined index: token in class.login.php on line 20
Call Stack
# Time Memory Function Location
1 0.0005 671760 {main}( ) ..\index.php:0
2 0.0016 729752 Login->__construct( ) ..\index.php:6
What seems to be the problem? Thank you.
143Alizon 1 month ago
Comment removed
143Alizon 1 month ago
Comment removed
143Alizon 1 month ago
Comment removed
143Alizon 1 month ago
IT's so dificult to read. but i liked.
RicardoonPrograms 1 month ago
it showing this massage when i do anything i mean refresh, login, etc.
"Forbidden
You don't have permission to access /sid/< on this server."
what is this and why show this massage tell me phpclass
sstarpossible 3 months ago
Im quite handy when it comes to PHP, but this object oriented side of it all just blows me away completely. The smallest thing has to be made super complex and annoying. Its a shame to be forced to learn it to be able to get work :(
Nevertheless, I respect you greatly for taking the time to do this and hope that people take the time to watch it again and again instead of bugging you endlessly.
strafir 5 months ago
great tutorial, however it is a bit hard to understand because you are using methods that you create afterwards. That can really throw people off.
martynesku 5 months ago
where is the database file? i need the sql. did'nt find it
habroxby 7 months ago
Hello phpclass.
Now I´m all new to this, but I did check the database connection and information thats all fine.
Notice: Undefined index: token in C:\xampp\htdocs\PhpProject3\class.login.php on line 20
Notice: Undefined index: username in C:\xampp\htdocs\PhpProject3\class.login.php on line 23
Notice: Undefined index: password in C:\xampp\htdocs\PhpProject3\class.login.php on line 25
Please let me know if you think you can help with this problem.
Thanks again for the nice work..
Best regar
wizzuriz 7 months ago
Thanks for this tut ! I learn much about OPP. Subscribed, and wait for new tuts.
Mapciooo 1 year ago
For anyone struggling with the public function isDataValid preg-match code, here it is:
return (preg_match('/^[a-zA-Z0-9](5,12)$/',$this->_username) && preg_match('/^[a-zA-Z0-9](5,12)$/',$this->_password))? 1 : 0;
BlakeReynolds09 1 year ago
ugg... now I have to go figure out some regular expression stuff so allow special characters in the password :p
abney317 1 year ago
nice tutorial.. i learn a lot.. looking forward to your tutorials. hope to see more of your stuff. keep it up .. greetings from phil..
klief2000 1 year ago
Oh dude that preg_match from {5,12} is very unrealistic and was giving me an error on testing.
CamiloSanchez1979 2 years ago
Can you be a little more specific. Are you trying to create your own regular expression? Please provide the code that is giving you the problem.
phpclass 2 years ago
oh, no it's cool, I was just testing the form, but the preg_match section of {5,12} was giving me an error on the data I was entering, I didn't know why, as it turns out it was that piece of code, i am not that good on reg expressions. What i meant was that i think allowing people to put characters should go beyond 12..maybe like 40..but that's my opinion.
CamiloSanchez1979 2 years ago
Oh ok. Yea regular expression can be tricky at first, but once you get the hang of it then it will be a breeze. Well, if you have any questions or problems with these tutorials feel free to send me a message.
phpclass 2 years ago
Thanks dude, keep up those tuts!
CamiloSanchez1979 2 years ago
hey phpclass friend..i am confused about
$this->error[] = $e getMessage();
Where in the script do we call the error msg?
can't $e just be echoed out without the array?
Thanks
CamiloSanchez1979 2 years ago
$e->getMessage() is part of the exception class. The error is called when we throw an exception:
throw new Exception("Put your error message in here");
And about your second question. Yes, you can output the $e error message right away, but in most cases it would be considered bad programming practice. Each method inside a class should have unique task. In this case, verify post is used only to verify post data. Therefore, I have a showErrors method to perform error output. And so on.
phpclass 2 years ago
Wtf...
CrazyMongols 2 years ago
Hello. Is there a problem?
phpclass 2 years ago