Jump to content

How does this little script look?


Reaper0167

Recommended Posts

Is there anything else that I should have, security I mean?

 

<?php
session_start();

if( (isset($_SESSION['who'])) || (isset($_SESSION['auth'])) )
{
  include 'connection.php';
  $delete_this = $_GET['delete_id'];
  $got_you = $_SESSION['who'];
  $result = mysql_query("SELECT * FROM my_table WHERE id = '$delete_this' ");
  while ($row = mysql_fetch_array($result))	
  {
   $server_pic = $row['imgpath'];
   $server_file = $row['track_loc'];
  }
  unlink($server_pic);  //removes picture from server
  unlink($server_file);  //removes file from server
  mysql_query("DELETE FROM my_table WHERE id='$delete_this'");  //remove track info from db
  mysql_query("DELETE FROM my_table2 WHERE track_id = '$delete_this'");  //remove track comments from db
  mysql_query("DELETE FROM my_table3 WHERE track_id = '$delete_this'");  //remove best lap time info from db

  mysql_close();
  header("location:my_page.php");
  exit();
}

?>

Link to comment
Share on other sites

You're not using mysql_real_escape_string().

 

I don't see what purpose $got_you even serves; you assign to it and then never use it.

 

What's to stop me from putting whatever I want into delete_id and deleting stuff other people posted?

Link to comment
Share on other sites

I know what you mean,

switch

$delete_this = $_GET['delete_id'];

 

to

$delete_this = mysql_real_escape_string($_GET['delete_id']);

 

and yes, I had $got_you in the code for future add-ons to the script, it is probably best to leave it out til it is needed?

 

So would that be about it with the mysql_real_escape_string ?

 

What else could someone do?

Link to comment
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.