Skip to main content
October 21, 2007
Question

Convert ASP to PHP

  • October 21, 2007
  • 8 replies
  • 1490 views
Any recommendations to convert this asp to php/mysql?
This topic has been closed for replies.

8 replies

Inspiring
October 24, 2007
> Eagleson's Law: "Any code of your own that you haven't looked at for six
> or more months might as well have been written by someone else."

So very true!

-Darrel


Inspiring
October 24, 2007
Funny that you should use that exact timeframe...

Eagleson's Law: "Any code of your own that you haven't looked at for six
or more months might as well have been written by someone else."

;-)

"darrel" <notreal@nowhere.com> wrote in message
news:fflq5m$35d$1@forums.macromedia.com...
> My knowledge of code and best practices changes so much that code I wrote
> 6 months ago can be embarassingly bad when I go back to update it.


Inspiring
October 23, 2007
> by the way, I heard the asp2php software is almost worse then not using,
> because it only gets about 80% of it right. If that's the case, I'd
> rather build from scratch then debug for hours.

I think you're absolutely correct with that assumption.

In general and IMHO, any 'software-written' code is iffy at best. In the
end, if you write it yourself, it may still be incorrect, but at least
you'll have some knowledge of its intention and behavior.

Even when I'm updating a page using the same language, I tend to start from
scratch. I find 'remodelling' to be much messier than just doing a tear down
and starting over. My knowledge of code and best practices changes so much
that code I wrote 6 months ago can be embarassingly bad when I go back to
update it.

-Darrel


October 23, 2007
by the way, I heard the asp2php software is almost worse then not using, because it only gets about 80% of it right. If that's the case, I'd rather build from scratch then debug for hours.
October 23, 2007
Actually, that's handcoded, sending users from the login page to the page with the code shown I need to translate above... the code checks against a few variables, redirects again in some circumstances to another page that checks their information again (depending which billing system they used at the time), then creates sessions, updates their records to the database, and then redirects appropriately to the restricted area (a lot going on in a short amount of code in an instant during login).

I work on a MAC, so I have to handcode all my ASP... unfortunately.... So I'm looking how easy it is to convert sites from ASP to PHP. So far I found it to be pretty easy to do, maybe 10 minutes per page in a lot of cases, but sometimes the handcoded items need more knowledge of PHP than dreamweaver can't assist me through. Thanks in advance for any help....
Inspiring
October 23, 2007
On 21 Oct 2007 in macromedia.dreamweaver.appdev, jsteinmann wrote:

> Any recommendations to convert this asp to php/mysql?
>
> <%@LANGUAGE="VBSCRIPT"%>
> <!--#include file="Connections/cnConn.asp" -->
> <%
> if request.form <> "" then
>
> dim username, password, DateExpire

That looks like it's a stock DW login user behavior? If so, just create
a PHP/MySQL site, and use the same behavior to create the page.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Inspiring
October 22, 2007
Yes, learn PHP and re-write the code.

Paul Davis
http://www.kaosweaver.com/
Visit us for dozens of useful Dreamweaver Extensions.

http://www.communitymx.com/
Partner at Community MX - Extend your knowledge

jsteinmann wrote:
> Any recommendations to convert this asp to php/mysql?
>
> <%@LANGUAGE="VBSCRIPT"%>
> <!--#include file="Connections/cnConn.asp" -->
> <%
> if request.form <> "" then
>
> dim username, password, DateExpire
> username = request.form ("username")
> password = request.form ("password")
>
> set rs = Server.CreateObject("ADODB.Recordset")
> rs.ActiveConnection = MM_cnConn_STRING
> rs.Source = "SELECT * FROM members WHERE username = '" + Replace(username,
> "'", "''") + "'" & "AND Password = '" + Replace(password, "'", "''") + "'"
> rs.CursorType = 0
> rs.CursorLocation = 2
> rs.LockType = 3
> rs.Open()
> rs_numRows = 0
>
> session("username") = request.form("username")
> session("password") = request.form("password")
>
> if rs.eof or rs.bof then
> response.redirect "logon2.asp"
> else
>
> expire = rs("MemberExpire")
> ip = rs("ip")
> ip2 = rs("ip2")
> ccbillcustomer = rs("ccbillcustomer")
> session("id") = rs("id")
> session("firstName") = rs("firstName")
> session("LastName") = rs("LastName")
> session("MemberID") = rs("username")
> session("memberStatus") = rs("memberStatus")
>
> end if
>
> rs("LastLogin") = date()
> rs("ip2") = Request.ServerVariables("REMOTE_HOST")
> rs.Update
>
> if username = "" THEN
> response.redirect "join.asp"
> elseif session("firstname") <> "" and session("lastName") <> "" and
> session("memberStatus") = "suspended" THEN
> response.redirect "account_update.asp"
> elseif session("firstname") <> "" and session("lastName") <> "" and expire <
> date() THEN
> response.redirect "join_renew.asp"
> elseif session("firstname") <> "" and session("lastName") <> "" and expire =>
> date() THEN
> response.redirect "members/index.asp"
>
> else
> response.redirect "login.asp?err=true"
>
> end if
> end if
> %>
> <%
> rs.Close()
> Set rs = Nothing
> %>
>
October 23, 2007
LOL... can't figure it out huh?
Inspiring
October 22, 2007
> Any recommendations to convert this asp to php/mysql?

Are you asking us to rewrite it for you?

-Darrel