Jump to content

Recommended Posts

mysql_select_db ($database);

// Make sure the user actually
// selected and uploaded a file

       $hyperlink = $_POST['hyperlink'];
   $currency = $_POST['currency'];
   $name = $_POST['name'];
   $image = $_POST['image'];
   $info = $_POST['info'];
   $keywords = $_POST['keywords'];
   $type = $_POST['type'];

      // Create the query and insert
      // into our database.
      $query = "INSERT INTO Stacks";
      $query .= "(`image`, `hyperlink`,`currency`,`name`,`info`,`keywords`,`type`) VALUES ('$image','$hyperlink','$currency','$name','$info','$keywords','$type')";
    
      $results = mysql_query($query, $link);
     

if($query){




print "<br><font color=white>Your image details have been uploaded to the database.  <a href='member.php'>Return to Upload Page</a></font>"; }
else {
print "No image selected/uploaded";
}


     


// Close our MySQL Link
mysql_close($link);

 

how/where do i add mysql_real_escape_string to this to prevent html attack?

Link to comment
https://forums.phpfreaks.com/topic/171283-how-to-add-mysql_real_escape_string/
Share on other sites

mysql_reral_escape_string does not prevent xss attacks if that's what your getting at, it simply escapes your data for safe insertion into a database.

 

All data going into your queries should first go through mysql_reral_escape_string, for example....

 

$name = mysql_real_escape_string($_POST['name']);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.