Click here to Skip to main content
15,434,147 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionRun multiple PHP versions on same server Pin
manhfh7-Oct-16 6:14
Membermanhfh7-Oct-16 6:14 
QuestionOnly Home page opening after going live Pin
Member 1275803925-Sep-16 20:28
MemberMember 1275803925-Sep-16 20:28 
SuggestionRe: Only Home page opening after going live Pin
Richard Deeming26-Sep-16 2:07
mveRichard Deeming26-Sep-16 2:07 
AnswerRe: Only Home page opening after going live Pin
Richard MacCutchan26-Sep-16 2:48
mveRichard MacCutchan26-Sep-16 2:48 
AnswerRe: Only Home page opening after going live Pin
ZurdoDev26-Sep-16 3:18
professionalZurdoDev26-Sep-16 3:18 
QuestionI am really stumped on how to check if user exists and redirects. Pin
samflex15-Sep-16 7:08
Membersamflex15-Sep-16 7:08 
AnswerRe: I am really stumped on how to check if user exists and redirects. Pin
Richard Deeming15-Sep-16 7:27
mveRichard Deeming15-Sep-16 7:27 
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
samflex15-Sep-16 7:41
Membersamflex15-Sep-16 7:41 
You to the rescue again. Thank you very much sir.

First off, I am using a hash.

$pass = md5($pass);

I did not paste it as part of my initial code.

Second, I created this custom script that I thought helps keep my code from sql injection attack:

</<pre lang="PHP">// this function is used to sanitize code against sql injection attack.
function ms_escape_string($data) {
        if ( !isset($data) or empty($data) ) return '';
        if ( is_numeric($data) ) return $data;

        $non_displayables = array(
            '/%0[0-8bcef]/',            // url encoded 00-08, 11, 12, 14, 15
            '/%1[0-9a-f]/',             // url encoded 16-31
            '/[\x00-\x08]/',            // 00-08
            '/\x0b/',                   // 11
            '/\x0c/',                   // 12
            '/[\x0e-\x1f]/'             // 14-31
        );
        foreach ( $non_displayables as $regex )
            $data = preg_replace( $regex, '', $data );
        $data = str_replace("'", "''", $data );
        return $data;
    }
pre>

However, I can change it to use parameterized query:

PHP
$strSQL = "SELECT u.empl_first, u.username, u.empl_first +' '+ empl_last as fullname, e.Department, e.UnitName, e.empnum FROM users u inner join Employee e on u.Employee_Id = e.EmpNum inner join tblTBA t on u.Employee_Id = t.Employee_Id WHERE USERNAME = ?
 and PASSWORD = ? ";
 $params = array($_POST["user"], $_POST["pass"]);
 $sqll = sqlsrv_query($con, $strSQL, $params);


Now, if I am on the right track on those two, could please be kind to help with the last part where I am trying to check whether username and / or password is correct and redirecting to appropriate page as described?

Thanks again for your help.
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
Richard Deeming15-Sep-16 7:52
mveRichard Deeming15-Sep-16 7:52 
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
samflex15-Sep-16 9:10
Membersamflex15-Sep-16 9:10 
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
samflex15-Sep-16 10:30
Membersamflex15-Sep-16 10:30 
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
Richard Deeming15-Sep-16 10:50
mveRichard Deeming15-Sep-16 10:50 
GeneralRe: I am really stumped on how to check if user exists and redirects. Pin
samflex15-Sep-16 11:14
Membersamflex15-Sep-16 11:14 
QuestionButton working on second click and not first. Pin
Member 1189879629-Aug-16 4:51
MemberMember 1189879629-Aug-16 4:51 
AnswerRe: Button working on second click and not first. Pin
Planet Thomas4-Jul-17 1:22
MemberPlanet Thomas4-Jul-17 1:22 
QuestionPassing Values to the next Page in PHP Pin
Androoidhotspot Hotspot19-Aug-16 2:28
MemberAndrooidhotspot Hotspot19-Aug-16 2:28 
AnswerRe: Passing Values to the next Page in PHP Pin
ZurdoDev19-Aug-16 3:26
professionalZurdoDev19-Aug-16 3:26 
QuestionBasic Join Not Working Pin
Django_Untaken19-Aug-16 0:43
MemberDjango_Untaken19-Aug-16 0:43 
SuggestionRe: Basic Join Not Working Pin
Richard MacCutchan19-Aug-16 2:00
mveRichard MacCutchan19-Aug-16 2:00 
GeneralRe: Basic Join Not Working Pin
Django_Untaken19-Aug-16 2:17
MemberDjango_Untaken19-Aug-16 2:17 
GeneralRe: Basic Join Not Working Pin
Richard MacCutchan19-Aug-16 3:14
mveRichard MacCutchan19-Aug-16 3:14 
GeneralRe: Basic Join Not Working Pin
johnjonny10-Oct-16 8:18
Memberjohnjonny10-Oct-16 8:18 
Questionassignment Pin
Eto'o3-Aug-16 12:15
MemberEto'o3-Aug-16 12:15 
AnswerRe: assignment Pin
Richard MacCutchan3-Aug-16 22:02
mveRichard MacCutchan3-Aug-16 22:02 
QuestionGoogle Translate facility Pin
Member 1264382519-Jul-16 18:51
MemberMember 1264382519-Jul-16 18:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.