Posts: 768
Threads: 40
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2011
Reputation:
0
/include/deletechar.php?id=1' or a_index
That could be very dangerous
same with resetred.php and resetlevel.php
Dont forget that include pages can also be called directly from the browser and values need to be sanitized.
This also works on your premium version.
But thats all i saw for now
Posts: 180
Threads: 8
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2012
Reputation:
0
/include/deletechar.php?id=1' or a_index <'0
That could be very dangerous
same with resetred.php and resetlevel.php
Dont forget that include pages can also be called directly from the browser and values need to be sanitized.
This also works on your premium version.
But thats all i saw for now
Thank's for the advice, how can i make it safer?
Posts: 768
Threads: 40
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2011
Reputation:
0
Check if the user is logged in, and check if the character is from that account.
Also sanitize it, $thing = mysql_real_escape_string( $_GET['thing'] );
And u need a character id, a_index, so that means u are expecting a number, make sure it only continues when u get a number.
The best way to do this is to use ctype_digit();
if( ctype_digit( $thing ))
{
// is a number
}
else
{
// is not a number
}
Posts: 180
Threads: 8
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2012
Reputation:
0
Ok so how's this. I also added the ctype_digit(); and it worked, if i change the id to something other than a number it will give you an error.
<?
//Start session
session_start();
include "settings.php";
// Get Login ID
$accid = $_SESSION['SESS_ACCOUNT_ID'];
?>
<?
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
} else {
?>
<?php
$connect = mysql_connect($server_ip, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
// get value of id that sent from address bar
$id = mysql_real_escape_string( $_GET['id'] );
if( ctype_digit( $id ))
{
// Delete data in mysql from row that has this id
$sql="DELETE FROM t_characters WHERE a_index='$id' AND a_user_index = '$accid'";
$result=mysql_query($sql);
// if successfully deleted
if($result){
echo "Delete Successful you will be redirected in 2 seconds.</a>";
}
else {
echo "ERROR";
}
?>
<meta HTTP-EQUIV="REFRESH" content="1; url=../index.php?page=20">
<?
}
else
{
echo "<font size= '2' color='#FF0000'>That is not a number!</font>";
}
?>
<?
die();
}
?>
<font size= '2' color='#FF0000'>You need to log in first!</font>
<meta HTTP-EQUIV="REFRESH" content="1; url=../index.php">
<?php
// close connection
mysql_close();
?>
With this instead I wasn't able to delete someone else's character.
Posts: 180
Threads: 8
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2012
Reputation:
0
Yes, now its safe
Thanks for the help
I recommend all to redownload this.
Posts: 235
Threads: 34
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Nov 2011
Reputation:
0
good thx black u is good to make sites u reupload later u fix what wizatec say u?