Jump to content

ASP to PHP


lbh2011

Recommended Posts

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
%>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.