Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-25-2016, 03:55 AM   #1
mikeworks
Confirmed User
 
Join Date: Apr 2010
Posts: 272
Learning PHP

I am trying to learn php/mysql and have completed a couple of courses so far on udemy. Still a lot to learn, but my goal is to code my own cms system that I could use on a network of high traffic sites. But while working through online course some questions don't seem to be answered or discussed much yet.

1. How to make script secure? A lot of courses so far are fairly brief on this, are there any good sources for information or books to study?

2. Caching? What caching should I be learning about to help run high traffic sites. I have experience with sites running memcache/smarty template cache.
mikeworks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 04:33 AM   #2
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,365
1. No answer here. It's like if you ask "how to make my home secure?" There could be a ton of recommendations, but no universal solution.

2. When PHP engine generates a page, it usually does a lot of things. Performs SQL queries, access various files and simple executes the code. Caching is a method do avoid it. Once the page was generated, it's saved as a simple HTML file. So next time when someone will try to open it, he will see the previously generated static version - the PHP code will not be executed, SQL queries will not be performed etc.
__________________
Obey the Cowgod
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 04:43 AM   #3
Klen
 
Klen's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,234
Quote:
Originally Posted by mikeworks View Post
I am trying to learn php/mysql and have completed a couple of courses so far on udemy. Still a lot to learn, but my goal is to code my own cms system that I could use on a network of high traffic sites. But while working through online course some questions don't seem to be answered or discussed much yet.

1. How to make script secure? A lot of courses so far are fairly brief on this, are there any good sources for information or books to study?

2. Caching? What caching should I be learning about to help run high traffic sites. I have experience with sites running memcache/smarty template cache.
1. By trying to hack your own script, you can also ask other programmers to trying to hack it.
Basically you need to check your script against any kind of injections, regardless is it mysql or any other kind. But sometime even trivial solutions can block most of injections, for example command htmlentities which turns characters which are required to execute injection into html code.

2. I am using memcached and it do the fine job, page loads fast once is runned for first time, and it stil loads fast even if you make a change on page. There are additional caching engines, like Opcache and Ioncube which you can use as well with it, but also pay attention to your queries - a lot of optimization can be done by simply using either better queries or better data structure. For example,
you can organize data by dividing tables to frequently used data and settings data.
Klen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 05:11 AM   #4
Barry-xlovecam
It's 42
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
1. Limit user input to scripts to the expected input.

2. Set the correct (lowest permissions necessary) for all files and directories.

By only allowing only the expected, the dangerous unexpected user input will be rejected.

Google is your friend: https://www.google.com/search?q=secure+PHP
Lots of opinions and ideas here ^
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 08:30 AM   #5
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
best advice I can give you is to use a php framework... If you're a beginner to PHP a CodeIgniter is a good start. Using a framework you'll have to worry less about security and these regular PHP stuff and you'll focus more on what are you trying to build.
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 10:29 AM   #6
NakedWomenTime
Confirmed User
 
NakedWomenTime's Avatar
 
Industry Role:
Join Date: Oct 2015
Posts: 560
Quote:
Originally Posted by mikeworks View Post
1. How to make script secure? A lot of courses so far are fairly brief on this, are there any good sources for information or books to study?
A lot of this is running validation routines on data that can be passed into the script, e.g. from form fields or querystrings, so that rogue instructions can't be included with that data.
NakedWomenTime is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 12:37 PM   #7
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
One basic way to do caching is use the output buffering.

Put

ob_start();

at the start of your script, before you write any HTML. At the end, after you've written all the HTML, put

ob_end_flush();

That sends the contents of the buffer to the client with headers. To cache the page instead of sending it, you can make use of ob_get_contents(); and save the result as a file. Then the next time that page is requested, serve that file instead of rebuilding the page. After the file is a certain age, delete it and rebuild the page.

That's a basic way of doing caching. The problems arise when you want to dynamically add a value in the HTML which is different for each visitor, say if you're dynamically writing JS. Then it gets a bit more tricky....
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-25-2016, 10:10 PM   #8
deonbell
Confirmed User
 
deonbell's Avatar
 
Industry Role:
Join Date: Sep 2015
Posts: 1,045
never truss user input.

htmlspecialchar is good php function.

Looks at parameterized sql statements to avoids sqlinjection. Much old information for sql still on web shows old ways of things. that is dangerous.
deonbell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-26-2016, 04:00 AM   #9
Daniel BongaCash
Confirmed User
 
Industry Role:
Join Date: Aug 2016
Posts: 353
When it comes to secure, it is all individual, there are a lot of solutions you can find.
__________________
Skype: daniel.bongacash | E-Mail: [email protected] | ICQ: 706111038



Kind Regards,
Daniel
Affiliate Manager
Daniel BongaCash is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-29-2016, 11:37 AM   #10
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,734
https://laracasts.com/series/php-for-beginners

good series
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Tube Themes
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-29-2016, 11:42 AM   #11
Miguel T
♦ Web Developer ♦
 
Miguel T's Avatar
 
Industry Role:
Join Date: May 2005
Location: Full-Stack Developer
Posts: 12,467
If I'd pick a framework, I'd go with Laravel
__________________

Full Stack Webdeveloper: HTML5/CSS3, jQuery, AJAX, ElevatedX, NATS, MechBunny, Wordpress
Miguel T is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2016, 04:43 AM   #12
deonbell
Confirmed User
 
deonbell's Avatar
 
Industry Role:
Join Date: Sep 2015
Posts: 1,045
also, when i say don't trust user input. do input validation on the back-end. Even Post data can be manipulated using a proxy tool like Burp suite.

You can validate using javascript on the front end, just to save user time. But make sure security validation is done on the back-end.

deonbell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2016, 05:01 AM   #13
Tasty1
Judge Jury and Executioner
 
Tasty1's Avatar
 
Industry Role:
Join Date: Jan 2005
Location: South-America
Posts: 8,842
Quote:
Originally Posted by Zuzana Miguel View Post
If I'd pick a framework, I'd go with Laravel
Heard more people using that, must try myself.
__________________

everything is fake
Tasty1 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2016, 05:25 AM   #14
mikeworks
Confirmed User
 
Join Date: Apr 2010
Posts: 272
Thanks for all advice. I'm getting a better understanding of what is required. So far have coded blog type script, with uploads, admin area, tags, search and a basic shopping cart while following video tutorials.

In general terms I guess the stages could be broken down as such:
-code secure script
-optimize db queries
-implement memcache

Is memcache the only caching solution I need to use? With current scripts I see they use memcache and template cache, but I guess the template cache is because it uses smarty?
mikeworks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
sites, lot, learning, traffic, caching, learn, courses, secure, fairly, script, experience, run, running, memcache/smarty, cache, template, books, information, study, sources, goal, code, cms, udemy, couple



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.