Jump to content


Photo

Some security issues ...


  • Please log in to reply
3 replies to this topic

#1 enkidu72

enkidu72
  • Members
  • PipPipPip
  • Advanced Member
  • 51 posts

Posted 27 September 2006 - 09:42 AM

Hello all ,
I'm coding ( as a noob :)) an application to access to a mysql db to insert and search for books ..

There are two kinds of user, user and admin , authentified by a user/pass stored into the db . Admins have perm=1
and users = 0 . I have basically 2 problems . If u hit the "back" button of the browser u can get access again to the
pages visited previously by an admin o user .
Some quotes :

<?
session_start();

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>

---------------
if (((isset($_SESSION['user'])) &&  ($_SESSION['perms'] == 1))&& (isset($_SESSION['logged']) && $_SESSION['logged']=='1')){


This stuff works perfectly if u don't hit back button and then reload ...

Another question ... I'd like to escape the input .
Which is the better way ? Basically I need to check the user/pass and the input for inserting new books .
It's  mysql_real_escape_string() what I'm looking 4 ? or maybe addslashes() &
stripslashes() ? or escapeshellcmd can do ?

Thx in advance

David








#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 27 September 2006 - 10:11 AM

I would say something like this

$something = mysql_real_escape_string(trim(strip_tags($_POST['something'])));

Good luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 enkidu72

enkidu72
  • Members
  • PipPipPip
  • Advanced Member
  • 51 posts

Posted 27 September 2006 - 01:29 PM

thx Tom !

$something = mysql_real_escape_string(trim(strip_tags($_POST['something'])));

seems  worked for INSERT , but I have problems now for the SELECT ...
If I introduce something like "L' acqua " , the for some reason don't appear in the select result ...

Any idea ?

#4 enkidu72

enkidu72
  • Members
  • PipPipPip
  • Advanced Member
  • 51 posts

Posted 27 September 2006 - 03:29 PM

Anyone for the "$_SESSION" stuff ???




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users