Hi there!

I'm new to this PHP thing but am loving it already!

I am a bit stuck though! Any nice knowledgeable peeps be kind enough to help me?

I am hoping to allow visitors to use short URLs based on their username and user_id looked up from my MySQL database (users table). At the moment the long URL name is a bit ugly ... e.g. http://mydomain/profile.php?mode=viewprofile&u=1 (1 being the user_id number)

What I would like is to be able to use a short URL ... something like http://mydomain/suzy (suzy being the username) which would redirect to the long URL above.

I found an ASP script that does something similar but couldn't get that to work ...

   strTarget = Request.ServerVariables("QUERY_STRING")

   ' *** Possible alias reference
   if instr(strTarget, "~") then    

       ' *** Remove the ~ and any .ASP from the alias
      strAlias = trim(right(strTarget, len(strTarget) - instr(strTarget, "~")))
      strAlias = LCase(replace(UCase(strAlias), ".ASP", ""))
      if trim(strAlias) <> "" then
         ' *** Query the users table to see if this alias belongs to anyone
         Set recTemp = Server.CreateObject("ADODB.RecordSet")
         recTemp.Source = "select usename, user_id from users where alias_file = '" & Replace(strAlias, "'", "''") & "'")
         recTemp.ActiveConnection = conDB

         ' *** Found user record, redirect to their list
         if not (recTemp.BOF and recTemp.EOF) then
            strRedir = "dvd_list.asp?user_id=" & Server.URLEncode(trim(recTemp("User_ID")))
            Set recTemp = Nothing
            Response.Redirect strRedir
          end if
         Set recTemp = Nothing
   end if
end if

' *** No alias link was found. Write 404 status to the client and display error message

Response.Status = "404 Not Found"


<head><title>404 Not Found</title></head>

404 Not Found

I'd really like to use PHP instead!!!

Thanks for your help in advance!