asp til php - hjælp søges
Hejsa,Jeg har 3 små asp-scripts som jeg meget gerne skulle have konverteret til php. Er der ikke en venlig sjæl (eller flere), som kan hjælpe mig?
Jeg poster dem her:
addscore.asp:
<%@language="VBScript"%>
<%
Response.Expires =0
sName=Request.form("Name")
sScore=Request.form("Score")
'Connect to the Database
ConnectionString="DRIVER=MySQL ODBC 3.51 Driver;SERVER=localhost;" &_
"UID=nimmer;PWD=password;" &_
"DATABASE=bba;"
set objCon = Server.CreateObject("ADODB.Connection")
objCon.open(ConnectionString)
'Add a New Score
objCon.EXECUTE("INSERT INTO tblDartsHighScore (player_name, score) VALUES (' " & sName & "', " & sScore & ")")
%>
getscores.asp:
<%@language="VBScript"%>
<%
'Response.Expires=0
'Connect to the Database
ConnectionString="DRIVER=MySQL ODBC 3.51 Driver;SERVER=localhost;" &_
"UID=nimmer;PWD=password;" &_
"DATABASE=bba;"
set objCon = Server.CreateObject("ADODB.Connection")
objCon.open(ConnectionString)
'Select All Highscores
SET objRS = objCon.EXECUTE("SELECT * FROM tblDartsHighScore ORDER BY score ASC")
IF objRS.EOF then ' Return No Scores
sResponse = "Score1=" & SERVER.URLENCODE("1. Nobody n/a Darts") & "&Score2=" & SERVER.URLENCODE("2. Nobody n/a Darts") & "&Score3=" & SERVER.URLENCODE("3. Nobody n/a Darts")
RESPONSE.WRITE sResponse
ELSE
' Return 3 top highest scores
IF NOT objRS.EOF THEN sScore1 = "1. " & TRIM(objRS.Fields(1)) & " " & objRS.Fields(2) & " Darts"
objRS.MOVENEXT
IF NOT objRS.EOF THEN
sScore2 = "2. " & TRIM(objRS.Fields(1)) & " " & objRS.Fields(2) & " Darts"
ELSE
sScore2 = "2. Nobody n/a Darts"
END IF
IF NOT objRS.EOF THEN objRS.MOVENEXT
IF NOT objRS.EOF THEN
sScore3 = "3. " & TRIM(objRS.Fields(1)) & " " & objRS.Fields(2) & " Darts"
ELSE
sScore3 = "3. Nobody n/a Darts"
END IF
IF NOT objRS.EOF THEN objRS.MOVENEXT
IF NOT objRS.EOF THEN
sScore4 = "4. " & TRIM(objRS.Fields(1)) & " " & objRS.Fields(2) & " Darts"
ELSE
sScore4 = "4. Nobody n/a Darts"
END IF
IF NOT objRS.EOF THEN objRS.MOVENEXT
IF NOT objRS.EOF THEN
sScore5 = "5. " & TRIM(objRS.Fields(1)) & " " & objRS.Fields(2) & " Darts"
ELSE
sScore5 = "5. Nobody n/a Darts"
END IF
RESPONSE.WRITE "Score1=" & SERVER.URLENCODE(sScore1) & "&Score2=" & SERVER.URLENCODE(sScore2) & "&Score3=" & SERVER.URLENCODE(sScore3) & "&Score4=" & SERVER.URLENCODE(sScore4) & "&Score5=" & SERVER.URLENCODE(sScore5)
END IF
objCon.CLOSE
SET objCon=NOTHING
%>
getscore.asp:
<%@language="VBScript"%>
<%
Response.Expires =0
'Connect to the Database
ConnectionString="DRIVER=MySQL ODBC 3.51 Driver;SERVER=localhost;" &_
"UID=nimmer;PWD=password;" &_
"DATABASE=bba;"
set objCon = Server.CreateObject("ADODB.Connection")
objCon.open(ConnectionString)
'Select All Highscores
SET objRS = objCon.EXECUTE("SELECT * FROM tblDartsHighScore ORDER BY score ASC")
IF objRS.EOF then
sResponse = "lowestscore=" & SERVER.URLENCODE("2000")
RESPONSE.WRITE sResponse
ELSE
objRS.MOVENEXT
objRS.MOVENEXT
IF objRS.EOF THEN
sResponse = "lowestscore=" & SERVER.URLENCODE("2000")
ELSE
sResponse = "lowestscore=" & SERVER.URLENCODE(objRS.Fields(2))
END IF
Response.WRITE sResponse
END IF
objCon.CLOSE
SET objCon=NOTHING
%>
På forhånd tak
Kim