| 
		
			
			
				
			
			
				 
			
			
				
			
		 | 
		
			
			
				 
			
				
			
		 | 
	||||
| 
				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.  | 
		
		 
		![]()  | 
	
		
			
  | 	
	
	
		
		|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
| 
		 | 
	Thread Tools | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Oct 2018 
				Location: New Orleans, Louisiana. / Newcastle, England. 
				
				
					Posts: 1,225
				 
				
				
				
				 | 
	
	
	
	
		
			
			 Is there a snippet of code that I can use to automatically secure any form input on a page to the SQL database without the need of placing mysql_real_escape_string on every field to check? 
		
	
		
		
		
		
			Does that make sense? 
				__________________ 
		
		
		
		
	
	Extreme Link List - v1.0  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Bollocks 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2007 
				Location: Bollocks 
				
				
					Posts: 2,793
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Try this, it may or may not work.... 
		
	
		
		
		
		
			It should run through all the values in the $_POST array and make a new array with sanitized values. Code: 
	
$sanitized_post = [];
$dbc = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
foreach($_POST as $key => $value)
{
	$sanitized_post[$key] = $dbc->real_escape_string($value);
}
				__________________ 
		
		
		
		
	
	Interserver unmanaged AMD Ryzen servers from $73.00  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2006 
				Location: Poland 
				
				
					Posts: 9,229
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Code: 
	<?php
$_POST = mysqli_real_escape_array($dblink,$_POST); 
function mysqli_real_escape_array($dblink, $data) {
    if (is_array($data)) {
        foreach ($data as $key => $value) {
            $data[$key] = mysqli_real_escape_array($dblink, $value);
        }
        return $data;
    } else {
        if (!is_numeric($data)) {
            return mysql_real_escape_string($dblink,$data);
        } else {
            return $data;
        }
    }
}
?>
				__________________ 
		
		
		
		
	
	Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Industry Role:  
				Join Date: Aug 2006 
				Location: Little Vienna 
				
				
					Posts: 32,235
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I am using htmlspecialchars and so far it is working fine. But it does not hurt to put extra steps to harden security. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2006 
				Location: Poland 
				
				
					Posts: 9,229
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 That's not enough to stop sql injection. htmlspecialchars is enough for XSS. 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Bollocks 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2007 
				Location: Bollocks 
				
				
					Posts: 2,793
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 htmlspecialchars is meant more for output to an HTML document, and in any case htmlentities does a better job of that. 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Interserver unmanaged AMD Ryzen servers from $73.00  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Industry Role:  
				Join Date: Aug 2006 
				Location: Little Vienna 
				
				
					Posts: 32,235
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Oct 2018 
				Location: New Orleans, Louisiana. / Newcastle, England. 
				
				
					Posts: 1,225
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Awesome, thanks everyone  
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Extreme Link List - v1.0  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Join Date: Jun 2003 
				
				
				
					Posts: 3,285
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I still feel like you should just say fuck it and grab a frame work.  
		
	
		
		
		
		
			I get wanting to 'learn php' but .. do you want to learn to churn butter? or how a sun dial works, perhaps you want to sow seeds with an ox? Why waste so much time learning php, when a framework takes all the pain out of it. i'll tell you right now as a hiring manager, old school PHP devs are discarded because they cant learn modern 'php' 
				__________________ 
		
		
		
		
	
	dead.  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#10 | ||
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Mar 2022 
				Location: In the moment 
				
				
					Posts: 95
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 1) His end goal is to work as an "employee" in some 9-5 rat race job making someone else rich and keeping up with other employees to make the corporate boss happy. 2) He has no interest in learning the basic building blocks of the language. (Like if you want to learn how to work on car engines to build your own hotrod, fuck it just buy a Tesla and buy the dealer upgrades instead) Quote: 
	
 If that's the case, then one could easily say why learn a framework when Wordpress, Joomla, or Drupal takes the pain out of it.  | 
||
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#11 | |
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2006 
				Location: Poland 
				
				
					Posts: 9,229
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 ![]() 
				__________________ 
		
		
		
		
	
	Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Industry Role:  
				Join Date: Aug 2006 
				Location: Little Vienna 
				
				
					Posts: 32,235
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 |