Re: Session Vars loaded from MSSQL Query drop, those loaded from MYSQL Query stick

From: Date: Thu, 16 Sep 2010 16:03:23 +0000
Subject: Re: Session Vars loaded from MSSQL Query drop, those loaded from MYSQL Query stick
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-308131@lists.php.net to get a copy of this message
On 16 September 2010 16:26, Cheryl Sullivan <csulliva@shh.org> wrote: > Absolutely - > > > > This is from the first page > > > > <?php > > $_SESSION['UserLastName'] = strtolower(trim($_POST['txtLastName'])); > > $_SESSION['BadgeID'] = trim($_POST['txtBadgeID']); > > > > //access MS SQL Server database > > $q1 = "select * from emps where emp_last = > '".$_SESSION['UserLastName']."' and emp_badge = > '".$_SESSION['BadgeID']."'"; > > $rs_emp_info = > hitMSSQL($q1,"xxxx_sql","database","table","password",1); > > $_SESSION['SSN'] = $rs_emp_info->fields("emp_ssn"); > > $_SESSION['CostCenter'] = $rs_emp_info->fields("emp_costcenter"); > You're sticking values from $_POST into an SQL query without sanitizing them first. That spells out SQL INJECTION VULNERABILITY. Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 </hype>

« previous php.general (#308131) next »