lbh2011 Posted January 6, 2013 Share Posted January 6, 2013 Hi everyone! I’ve been given a website coded in ASP which I would prefer to be coded in PHP so that I can make more sense of it! I can’t work out how to convert this section of site which I believe is placed at the top of each file to login the admin user and set the user session. Would someone be able to provide me with a rough translation!? Thanks! <!--#include virtual="connections/conn.asp" --> <% if request.form("send") = "yes" then varuser = request.form("user") varpass = request.form("pass") set rslogin = conn.execute("select * from security where sec_user = '" & varuser & "' and sec_pass = '" & varpass & "'") if rslogin.eof then varmsg = "There was a problem with your login details, please try again." elseif not rslogin.eof then session.timeout = 120 session("logged") = "admin" response.redirect("home.asp") end if rslogin.close() set rslogin = nothing end if %> Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/ Share on other sites More sharing options...
trq Posted January 6, 2013 Share Posted January 6, 2013 It's a simple login script. Do you know any PHP? Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403513 Share on other sites More sharing options...
lbh2011 Posted January 6, 2013 Author Share Posted January 6, 2013 (edited) Hi, Yes I do know some PHP but how do I convert eof to php for example? Thanks Edited January 6, 2013 by lbh2011 Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403517 Share on other sites More sharing options...
trq Posted January 6, 2013 Share Posted January 6, 2013 Really? I need to write this for you? Where exactly are you stuck? It's a very simple script. Instead of checking eof, just check the count of your results. eg; mysql_num_rows() to see if you have found a match with your query. It really is a very simple login script. I'd simply forget the asp, and write your own in php. It's not like it's a particularly well written example of asp anyway. Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403519 Share on other sites More sharing options...
lbh2011 Posted January 6, 2013 Author Share Posted January 6, 2013 Thanks trk Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403581 Share on other sites More sharing options...
requinix Posted January 6, 2013 Share Posted January 6, 2013 (edited) I’ve been given a website coded in ASP which I would prefer to be coded in PHP so that I can make more sense of it! If all you want is to learn what it does then it's easier to just learn (to read) ASP than to try to transcode everything into PHP. Classic ASP is written in Visual Basic: practically the easiest language to read ever invented. I mean heck, just look at it and take a guess based on the names of things. [edit] Besides, as trq mentioned, it's a horrible script anyways. Edited January 6, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403589 Share on other sites More sharing options...
Barand Posted January 6, 2013 Share Posted January 6, 2013 You might also need to know request.form is equivalent of $_POST response.redirect is equivalent of header("location: url") Quote Link to comment https://forums.phpfreaks.com/topic/272743-asp-to-php/#findComment-1403592 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.