// Old code
function protect($string) {
return mysql_real_escape_string(strip_tags(addslashes($string)));
}
// New code, $db is in my connect function to connect to the database
function protect($string) {
$string = $db->real_escape_string(strip_tags(addslashes($string));
}
// Or can I do this?
function protect($string) {
return $db->real_escape_string(strip_tags(addslashes($string));
}
This function is used on both my register.php and login.php here:
// register.php
<?php
if(isset($_POST['register'])){
$username = protect($_POST['username']);
$password = protect($_POST['password']);
$email = protect($_POST['email']);
// login.php
$username = protect($_POST['username']);
$password = protect($_POST['password']);
Am I both using and calling that correctly?

New Topic/Question
Reply




MultiQuote




|