Subject | Re: [firebird-php] Application working only in IE |
---|---|
Author | Sakhile Njoko |
Post date | 2011-09-19T14:10:32Z |
Yes, the cookies and javascript are enabled in Firefox and Chrome.
I have included the code in the two scripts.
Script 1 (index.php) has the login form and javascript function (verify_login) that calls and posts form data to script 2 (verifylogin.php), which then uses the data to check if it is in the database.
index.php:
<script>function verify_login() { var getdate = new Date(); var tstamp = getdate.getTime(); xmlhttp=GetXmlHttpObject(); //Checks if Javascript is enabled if (xmlhttp==null) { alert ("Javascript is not enabled. Please enable it or upgrade your browser."); return; }
var aurl="verifylogin.php"; aurl = aurl + '?time=' + tstamp; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") { document.getElementById('verify').innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST",aurl,true); var pmeters = "&mbrnm=" + encodeURI( document.getElementById("mbrnm").value ) + "&usrnm=" + encodeURI( document.getElementById("usrnm").value ) + "&pass=" + encodeURI( document.getElementById("pass").value ); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", pmeters.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(pmeters);}</script>
<body><form align='center' action="javascript:verify_login()" name="FrmLog" id="FrmLog" method="POST" onsubmit="this.submit(); this.reset(); return false" ><TABLE cellwidth="20" cellspacing="10" border="0" cellpadding="0" align='center'> <tbody> <tr> <td>User Number:</td> <td><input type="text" name="mbrnm" id="mbrnm" size="3"/></td> </tr> <tr> <td>Username:</td> <td><input type="text" name="usrnm" id="usrnm" size="8"/></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="pass" id="pass" size="8"/></td> </tr> <tr> <td></td> <td><input type="submit" value="Login" /></td> </tr> </tbody></TABLE></form></body>
verfiylogin.php:
<?php if (is_numeric($_POST['mbrnm']) && isset($_POST['usrnm']) && !empty($_POST['usrnm']) && isset($_POST['pass']) && !empty($_POST['pass'])) { include('config.php'); $tt=ibase_connect($db,$user,$pswd); $number = $_POST['mbrnm']; $usernm = $_POST['usrnm']; $passwd = $_POST['pass']; $qry="select * from LUNG where USRID = '$number' and LOGIN = '$usernm' and PSSWD = '$passwd'"; $rslt = ibase_query($tt,$qry); $rec = ibase_fetch_object($rslt); if (!$rec){ echo "Incorrect login details, please try again."; ibase_close($tt); } else{ $owshp = $rec->SBNZL; $logid = rand(0,2000000000); setcookie("logid",$logid,time() + 3600); setcookie("usrid",$usrid,time() + 3600); setcookie("owshp",$owshp,time() + 3600); setcookie("level",$level,time() + 3600); $qry3="select USRNM, USRSN from USRS where USRID = '$number'"; $rslt3 = ibase_query($tt,$qry3); $rec3 = ibase_fetch_object($rslt3); echo "<table align='center'><tr><td>"; //echo
"Welcome ".$rec3->USRNM." ".$rec3->USRSN.", please click <a href='home.php?logid=".$logid."&owshp=".$owshp."'>Continue</a>."; echo "Welcome ".$rec3->USRNM." ".$rec3->USRSN.", please click <a href='home.php'>Continue</a>."; echo "</td></tr></table>"; ibase_close($tt); } }?>--- On Mon, 19/9/11, Lester Caine <lester@...> wrote:
From: Lester Caine <lester@...>
Subject: Re: [firebird-php] Application working only in IE
To: firebird-php@yahoogroups.com
Date: Monday, 19 September, 2011, 16:36
Sakhile Njoko wrote:
Bit difficult to fault find when we have no information ;)
This simple php page, or linked to something else?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
[Non-text portions of this message have been removed]
I have included the code in the two scripts.
Script 1 (index.php) has the login form and javascript function (verify_login) that calls and posts form data to script 2 (verifylogin.php), which then uses the data to check if it is in the database.
index.php:
<script>function verify_login() { var getdate = new Date(); var tstamp = getdate.getTime(); xmlhttp=GetXmlHttpObject(); //Checks if Javascript is enabled if (xmlhttp==null) { alert ("Javascript is not enabled. Please enable it or upgrade your browser."); return; }
var aurl="verifylogin.php"; aurl = aurl + '?time=' + tstamp; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") { document.getElementById('verify').innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST",aurl,true); var pmeters = "&mbrnm=" + encodeURI( document.getElementById("mbrnm").value ) + "&usrnm=" + encodeURI( document.getElementById("usrnm").value ) + "&pass=" + encodeURI( document.getElementById("pass").value ); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", pmeters.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(pmeters);}</script>
<body><form align='center' action="javascript:verify_login()" name="FrmLog" id="FrmLog" method="POST" onsubmit="this.submit(); this.reset(); return false" ><TABLE cellwidth="20" cellspacing="10" border="0" cellpadding="0" align='center'> <tbody> <tr> <td>User Number:</td> <td><input type="text" name="mbrnm" id="mbrnm" size="3"/></td> </tr> <tr> <td>Username:</td> <td><input type="text" name="usrnm" id="usrnm" size="8"/></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="pass" id="pass" size="8"/></td> </tr> <tr> <td></td> <td><input type="submit" value="Login" /></td> </tr> </tbody></TABLE></form></body>
verfiylogin.php:
<?php if (is_numeric($_POST['mbrnm']) && isset($_POST['usrnm']) && !empty($_POST['usrnm']) && isset($_POST['pass']) && !empty($_POST['pass'])) { include('config.php'); $tt=ibase_connect($db,$user,$pswd); $number = $_POST['mbrnm']; $usernm = $_POST['usrnm']; $passwd = $_POST['pass']; $qry="select * from LUNG where USRID = '$number' and LOGIN = '$usernm' and PSSWD = '$passwd'"; $rslt = ibase_query($tt,$qry); $rec = ibase_fetch_object($rslt); if (!$rec){ echo "Incorrect login details, please try again."; ibase_close($tt); } else{ $owshp = $rec->SBNZL; $logid = rand(0,2000000000); setcookie("logid",$logid,time() + 3600); setcookie("usrid",$usrid,time() + 3600); setcookie("owshp",$owshp,time() + 3600); setcookie("level",$level,time() + 3600); $qry3="select USRNM, USRSN from USRS where USRID = '$number'"; $rslt3 = ibase_query($tt,$qry3); $rec3 = ibase_fetch_object($rslt3); echo "<table align='center'><tr><td>"; //echo
"Welcome ".$rec3->USRNM." ".$rec3->USRSN.", please click <a href='home.php?logid=".$logid."&owshp=".$owshp."'>Continue</a>."; echo "Welcome ".$rec3->USRNM." ".$rec3->USRSN.", please click <a href='home.php'>Continue</a>."; echo "</td></tr></table>"; ibase_close($tt); } }?>--- On Mon, 19/9/11, Lester Caine <lester@...> wrote:
From: Lester Caine <lester@...>
Subject: Re: [firebird-php] Application working only in IE
To: firebird-php@yahoogroups.com
Date: Monday, 19 September, 2011, 16:36
Sakhile Njoko wrote:
> Oh, when I say it doesn't work I mean I enter the USERNUMBER, LOGINNAME and PASSWORD but it just clears everything when I press enter and stays on the same login page. No error comes up.Presumably cookies are enabled in firefox and chrome?
Bit difficult to fault find when we have no information ;)
This simple php page, or linked to something else?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
[Non-text portions of this message have been removed]