Jump to content

Recommended Posts

these errors or holes rather were brought up today whats the best way to fix these (i dont care if the user cant enter any code at all i wouldnt mind <p> tags</p> just for formating but i can work around that

 

just looking to secure up my site a bit more

 

 

Cross Site Scripting(XSS):

You can submit ">code when adding rides.

 

 

<?php
   // includes
    include("../template/conf.php");
    // set up error list array
    $errorList = array();
    $count = 0;

    // validate text input fields
    $Contact = mysql_escape_string($_POST['Contact']);
    $Title = mysql_escape_string($_POST['Title']);
    $About = mysql_escape_string($_POST['About']);
    $Destination  = mysql_escape_string($_POST['Destination']);
    $needoffer = mysql_escape_string($_POST['needoffer']);
    $Origin = mysql_escape_string($_POST['Origin']);
    $Date = mysql_escape_string($_POST['Date']);

    // check for errors

    // if none found...

    if (sizeof($errorList) == 0)

    {

        // open database connection

        $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

        // select database

        mysql_select_db($db) or die ("Unable to select database!");

        // generate and execute query

        $query = "INSERT INTO rideshare (Contact, Title, About, Destination, needoffer, Origin, Date) VALUES('$Contact','$Title','$About','$Destination','$needoffer','$Origin','$Date')";

        $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
?>

 

i think thats all the code needed  its just my insert self submitting form

Link to comment
https://forums.phpfreaks.com/topic/128015-solved-cross-site-scriptingxss/
Share on other sites

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.