Secure PHP Development: Building 50 Practical Applications - podcast episode cover

Secure PHP Development: Building 50 Practical Applications

Feb 23, 202515 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

This Book excerpt details the creation of numerous PHP applications, focusing on secure coding practices and a reusable application framework. The author, Mohammed J. Kabir, presents 50 practical applications, including intranet tools (calendar, contact manager, document publisher), an e-mail survey system, and an e-campaign system. Best practices for PHP development are emphasized, covering topics such as variable naming, configuration management, database interactions, and security. The text includes code examples, database schemas, and installation instructions for the applications. Additionally, it provides command-line utilities to aid system administration tasks.

You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cyber_security_summary

Get the Book now from Amazon:
https://www.amazon.com/Secure-PHP-Development-Practical-Applications/dp/0764549669?&linkCode=ll1&tag=cvthunderx-20&linkId=7968a85af396a276336b13d8212b6bf1&language=en_US&ref_=as_li_ss_tl



Discover our free courses in tech and cybersecurity, Start learning today:
https://linktr.ee/cybercode_academy

Transcript

Speaker 1

All right, everyone get ready because today we are going deep on secure PHP applications.

Speaker 2

Oh yeah, this is going to be fair.

Speaker 1

We've got a ton of resources to pull from, we do. But I think the highlight is going to be this excerpt from a book, Oh for Sure, by Mohammed Jacobeir. He's great who is not only a developer but also a security expert.

Speaker 2

Yeah, he approaches it from both sides.

Speaker 1

Exactly, and I think that's what's so interesting about his perspective on this. Absolutely, And in the preface he makes it pretty clear that this book is for developers who are ready to seriously step up their game.

Speaker 2

Yeah, you really got to be ready to dive in.

Speaker 1

Right.

Speaker 2

It's not for beginners.

Speaker 1

No, this is not PHP one on one, definitely not. But you know what, even if you're not a hardcore coder, Yeah, I think there's a lot to learn here, for sure about just the mindset of software security.

Speaker 2

Absolutely.

Speaker 1

So what really jumped out at you for the preface?

Speaker 2

You know what I thought was interesting? What's that he doesn't waste any time? Oh yeah, he goes straight into the risks, no sugarcoating.

Speaker 1

No, he's like, look, there threats out there.

Speaker 2

Here, They are. Let's get real right into it. Yeah, So to illustrate this, he brings up this example script. Oh yeah, called bad Who's dot php ye, And it's, you know, on the surface, it seems like harmless enough. It's for looking up domain information.

Speaker 1

Right exactly, that's what it sounds like.

Speaker 2

But then he shows how a hacker, Oh yeah, this is the good part could actually use this script to access sensitive system files.

Speaker 1

Yeah, if you're not careful, if.

Speaker 2

The input isn't validated properly.

Speaker 1

If you don't check who's at the door.

Speaker 2

That's a great analogy.

Speaker 1

It's like a bouncer at a club just letting anyone in, not even checking IDs. You can't do that.

Speaker 2

Big problem.

Speaker 1

Huge.

Speaker 2

So the book really emphasizes this concept of input validation.

Speaker 1

Oh it's so important, and you know, it gets into the nitty gritty of using functions like is numeric.

Speaker 2

Is in to check if it's really a number.

Speaker 1

Making sure that the data is what it claims to be. And it goes even further. Yeah, it shows how to create like custom functions. Oh wow, for specific types of data, what like email addresses?

Speaker 2

Oh right, so you can zip code validate that. That's cool.

Speaker 1

So you're not just limited to these built in PHP functions, right.

Speaker 2

You can really tailor it to your needs exactly right, It's smart.

Speaker 1

And then they take it another step further. Hey, do they introduce this data validator class okay, which basically streamlines the process of validating multiple fields.

Speaker 2

Oh wow, so you don't have to do it all all at once. Individual.

Speaker 1

It's like having a whole team of bouncers. I like that analogy, each with their own expertise, checking IDs, looking for fake names, whatever it might be.

Speaker 2

Got the whole team.

Speaker 1

You've got a whole system.

Speaker 2

Yeah, that's cool.

Speaker 1

So we've talked about the dangers of bad input, right, but how do we actually write secure code?

Speaker 2

That's the big question?

Speaker 1

Right? And so Kabir dies into a whole section on best practices, and one that really stood out to me was the emphasis on using meaningful names.

Speaker 2

For your variables.

Speaker 1

Yes, for variables and functions. Yeah, and I know this might seem kind of basic. It does, but it's actually really crucial for reability yeah and surprisingly security.

Speaker 2

Really why is that?

Speaker 1

Well, think about it, Okay, if you have a variable name six dollars.

Speaker 2

Yeah, just six dollars, you have.

Speaker 1

No idea what it represents, right, it could be anything, and that can lead to errors.

Speaker 2

Oh yeah, you can mix things up big time for sure.

Speaker 1

It's like, imagine you're in the kitchen. Okay, you're cooking. I love to cook, and all your spices are just in unlabeled jars. Oh no, you don't know what's what.

Speaker 2

You're gonna mess up the recipe.

Speaker 1

You gotta put cayenne pepper in your cookies instead of cinnamon.

Speaker 2

Oh that would be bad, not good, not good at all.

Speaker 1

So the book really emphasizes using clear variable names, right like template dr oh so instantly, No, yeah, what it is, that's what that variable hole. It makes sense, and it takes it a step further recommending all caps for constants.

Speaker 2

Oh interesting, I haven't seen that before.

Speaker 1

It's a nice visual cue. So it's like it helps you just distinguish.

Speaker 2

Them from regular variables.

Speaker 1

Right, So if you see templa diers all caps, you know, you know it's going to point to the same location throughout.

Speaker 2

The whole application.

Speaker 1

Yeah, that's smart. So far, so good.

Speaker 2

Yeah, this is great.

Speaker 1

We've covered a lot of ground we have. But I think what's really cool is that Kabir goes beyond just individual scripts. Oh yeah, he actually shows you how to build entire secure intranet applications.

Speaker 2

That's a big step up.

Speaker 1

It is. It's like he's giving you a blueprint.

Speaker 2

Like architectural plans. Yes, exactly, secure internal tools.

Speaker 1

So he introduces this concept of an application framework, which is essentially a set of reusable classes and functions, so you don't have to start from scratch exactly.

Speaker 2

It's like prefabricated building block.

Speaker 1

But designed with security in mind.

Speaker 2

Oh that's cool. So they're already secure.

Speaker 1

They're built to be secure come the ground up. Yeah, so you're not having to reinvent the wheel every time.

Speaker 2

That makes sense.

Speaker 1

You can just use these secure components, right and focus on the specific function you need.

Speaker 2

Okay, that makes sense.

Speaker 1

And the way this framework is structured is really interesting.

Speaker 2

Oh.

Speaker 1

How so it's got this logical layered approach.

Speaker 2

Oh, like layers of an onion kind of like that.

Speaker 1

Yeah. So you've got the presentation layer.

Speaker 2

Like the user sees exactly.

Speaker 1

Then you've got the application layer, the brains that's where all the logic happens.

Speaker 2

The logic, okay, and then.

Speaker 1

You've got the database layer where the data lives exactly interacting with the data store.

Speaker 2

Okay, So it's all very very organized, organ like a well run kitchen like that, where everything has its place.

Speaker 1

Everything has its place. But it's not just about being tidy. No. This framework also has some really robust security features built in. Oh, like what for example, authentication and authorization, those are important are centralized.

Speaker 2

Okay.

Speaker 1

So instead of each tool managing its own users and permissions, it's all handled in one secure place.

Speaker 2

Oh.

Speaker 1

It's like having one main entrance for the whole building, for the.

Speaker 2

Whole building a super secure lock.

Speaker 1

Yes, instead of having multiple doors.

Speaker 2

That each need their own security system exactly.

Speaker 1

Okay, that makes sense, much more efficient and secure and secure. Yeah. They've also got this powerful error handler built in. What is that too, which not only logs errors for debugging. Oh, that's helpful, but it also supports internationalization. Okay, so error messages can be displayed in different languages.

Speaker 2

Oh wow, that's useful.

Speaker 1

Yeah, depending on the user's preferences.

Speaker 2

That's a nice touch.

Speaker 1

Makes things a lot easier, it does. And what I really love is that they don't just leave you hanging with this framework, so they give you actually provide concrete example of how to use it, of how to use this framework to build real Internet applications.

Speaker 2

Oh, that's so cool.

Speaker 1

Yeah. So they've got like a central authentication system, a user management system, right, a document publisher, wow, a contact manager.

Speaker 2

These are all things you'd.

Speaker 1

Need, even a calendar manager for real intranet. Yeah, and it's just amazing to see these real world applications come together. Yeah, with such a strong focus on security.

Speaker 2

That's cool. I like that a lot. And you know, it's really cool. What's that the security focus? Yeah, it doesn't stop at the Internet, really. The book goes on to explore a whole range of other applications. Wait, what email marketing?

Speaker 1

Oh wow, surveys okay.

Speaker 2

Command line utilities interesting, even virtual host management.

Speaker 1

Yeah. He's really showing us that no matter what you're building with PHP, security should always be top of mind.

Speaker 2

It's like a golden thread running through the whole book.

Speaker 1

Absolutely. So, which of these applications really stead out to you?

Speaker 2

You know? One that I thought was really interesting was the telefriends system.

Speaker 1

Oh yeah, that's a classic.

Speaker 2

It's like a staple on so many websites.

Speaker 1

Yeah, you see it everywhere.

Speaker 2

But the way Kaber incorporates a scoring mechanism to prevent abuse.

Speaker 1

Oh, that's smart.

Speaker 2

It's really clever.

Speaker 1

Yeah, how does that work?

Speaker 2

So basically it encourages sharing, but it also stops spammers.

Speaker 1

In their tracks, so you can't just you.

Speaker 2

Can't just blasted out to everyone. You have to actually be selective.

Speaker 1

That's cool.

Speaker 2

Yeah, I thought it was a really neat way to add a layer of security to a common feature that's like a game.

Speaker 1

Yeah, kind of, but with real world security implications exactly. I like it.

Speaker 2

What about email campaigns.

Speaker 1

Oh yeah, those are.

Speaker 2

Tricky, they can be from a security perspective.

Speaker 1

Yeah, because you're dealing with so much sensitive.

Speaker 2

Data, right exactly.

Speaker 1

And you don't want that getting into the wrong hands.

Speaker 2

Absolutely. And the book goes into detail about building an email system. Okay, that allows for personalized mass emails.

Speaker 1

So you can still target specific groups, right, but you're doing it securely exactly.

Speaker 2

And it also covers tracking responses.

Speaker 1

Well that's important, so.

Speaker 2

You can see who's opening your emails, who's clicking on links, but.

Speaker 1

All while making sure that the data.

Speaker 2

Is protected absolutely, that's paramount.

Speaker 1

And that the system can't be hijacked for spam.

Speaker 2

Right, because that's a huge problem, huge problem. Yeah, you don't want your system being used to send out junk mail.

Speaker 1

No one wants that. No. Okay, so we've talked about I have applications, but what about command line stuff?

Speaker 2

Oh yeah, that's a whole other world, it is.

Speaker 1

And to be honest, it always seems a bit intimidating.

Speaker 2

I know what you mean.

Speaker 1

To non developers, it can be a bit cryptic. Yeah, all those commands and things.

Speaker 2

But Kabeer makes it seem really approachable. Really yeah. He breaks it down really well.

Speaker 1

So what kind of command line applications does he cover? Well?

Speaker 2

One example he gives is a command line reminder tool.

Speaker 1

Oh that's cool.

Speaker 2

Yeah, it's like having a personal.

Speaker 1

Assistant that lives on the command line exactly.

Speaker 2

And it can send you notifications for appointments or deadlines.

Speaker 1

So it's like a to do list but on steroids exactly. I like it.

Speaker 2

And he also covers virtual host management.

Speaker 1

Oh wow, that's getting pretty advanced.

Speaker 2

It is, but it's something that a lot of system administrators have to deal with.

Speaker 1

Yeah, setting up and managing all those virtual hosts exactly.

Speaker 2

And Kaber actually provides a tool a tool, Yeah. He calls it the Apache Virtual Hostmaker, and it helps automate the process.

Speaker 1

Oh so it makes it easier. That's easier and more secure.

Speaker 2

Hopefully that's the goal. You know. It's amazing we've covered so much.

Speaker 1

We really have actual.

Speaker 2

Code examples to like these big picture application frameworks.

Speaker 1

The whole spectrum.

Speaker 2

But I think what's really cool about this book is that that it doesn't just tell you what to do, right, It explains the why, Yeah, the reasoning yeah, behind secure PHP development. It's not just a cookbook, more like a philosophy.

Speaker 1

Yeah, like a way of thinking.

Speaker 2

And I think that's what makes it so valuable.

Speaker 1

Oh, absolutely, because Kaber is not.

Speaker 2

Just giving you a set of rules to follow blindly.

Speaker 1

He's helping you understand the principles.

Speaker 2

Yeah, the underlying principle.

Speaker 1

So you can make informed decisions in your own projects, in your own work.

Speaker 2

Yeah, that's key.

Speaker 1

It's like he's not just teaching you to fish.

Speaker 2

He's teaching you to think.

Speaker 1

Like a fish, or maybe like a fisherman.

Speaker 2

A fisherman who's also a security expert.

Speaker 1

Yeah, a very specialized fisherman.

Speaker 2

Yeah exactly, But you get the point I do.

Speaker 1

It's about developing that security mindset.

Speaker 2

It's a way of life, it really is for a developer.

Speaker 1

And I think that's a key takeaway. Yeah, for any developer.

Speaker 2

Really, whether you're just starting out, regardless of experience, or you've been doing this for years.

Speaker 1

That security first approach.

Speaker 2

It's essential.

Speaker 1

It's essential. It's got to be baked in from the beginning, from day one.

Speaker 2

Absolutely.

Speaker 1

And this makes me think about something else that the book touches on. Oh what's that speed optimization?

Speaker 2

Oh yeah, that's a whole other can of worms. It is, but it's important, it's important.

Speaker 1

But how do you balance that? That's the question, the need for security with the desire for fast responsive applications.

Speaker 2

If you want both, you want it all right.

Speaker 1

But sometimes it feels like those two things are odds. Yeah, like they're pulling in opposite directions.

Speaker 2

You know. Sometimes adding those extra layers of security it can slow things down a bit, a little bit.

Speaker 1

Yeah, So how do you find that sweet spot?

Speaker 2

That's the million dollar question.

Speaker 1

Right where it's both secure and fasts.

Speaker 2

Well, it's a balancing act.

Speaker 1

It really is.

Speaker 2

It's a trade off.

Speaker 1

So in some cases, security might be the top priority, absolutely, even if it means sacrifice it giving up a little bit of performance.

Speaker 2

A little bit of speed.

Speaker 1

Yeah, Like if you're dealing with highly sensitive data.

Speaker 2

Oh yeah, like financial.

Speaker 1

Wreck, medical information.

Speaker 2

You don't want to mess around with that.

Speaker 1

Did. Security trumps everything absolutely, But in other situations, yeah, speed might be more critical.

Speaker 2

It might be, right, Like think about a real time application. Yeah, like a stock trading platform or a multiplayer game.

Speaker 1

Where every millisecond counts exactly.

Speaker 2

You can't afford to have any lag.

Speaker 1

Any delay could be costly, yeah, or disrupt the whole experience.

Speaker 2

The whole user experience.

Speaker 1

So you've got to be more creative you do in finding ways to optimize security.

Speaker 2

Without sacrificing too much performance.

Speaker 1

Right.

Speaker 2

It's a tough challenge, it is.

Speaker 1

It's like choosing a sports.

Speaker 2

Car and a tank. Yeah, both have their advantages.

Speaker 1

You want to get there fast, you do, but you also want to be safe exactly.

Speaker 2

But you can't always have both.

Speaker 1

You can't have it all.

Speaker 2

Sometimes you have to make a choice.

Speaker 1

And that's why it's so important for developers and understanding really understands both sides, both security and performance.

Speaker 2

Right. You have to be able to assess the risks.

Speaker 1

Yeah, make those tough decisions. I find the right balance for your specific application exactly.

Speaker 2

There's no one size fits all solution.

Speaker 1

So if you're listening to this and you're thinking, oh my god, this is complex, this is overwhelming, it'll be intimidated.

Speaker 2

Yeah, don't pair it, because take.

Speaker 1

It one step at a time, one step at a time. You know, start by incorporating some of those basic principles like what validating your inputs, using meaningful names, thinking about security from the beginning, from the very start. And remember, learning is a journey.

Speaker 2

It's a marathon, not a sprint. It really is the world of cybersecurity.

Speaker 1

It's constantly changing, it's always evolving. So you got to say curious, Yeah, keep learning, keep exploring, never stop learning. Stop learning. There are tons of resources out there. There are online communities, books look like this.

Speaker 2

One, articles, conferences, podcasts, we're a podcast.

Speaker 1

All sorts of things to help you stay up to date exactly.

Speaker 2

You're not alone.

Speaker 1

And as you're learning and growing, always remember what's that Security isn't just about protecting data.

Speaker 2

It's about protecting people.

Speaker 1

It's about people.

Speaker 2

Yeah, the code we write it has.

Speaker 1

Real world consequences.

Speaker 2

It does.

Speaker 1

We have a responsibility developer to build applications.

Speaker 2

That are both powerful and secure. That's a good way to put it.

Speaker 1

So as you continue to explore the world of secure PHP development. Remember to balance functionality with security, and always keep that human element in mind.

Speaker 2

It's all about people, it is.

Speaker 1

Thanks for joining us on this deep dive.

Speaker 2

It's been a pleasure.

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android