Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
I need PHP code converted to ASP...Can anyone please help?
Old 06-07-2006, 06:09 PM I need PHP code converted to ASP...Can anyone please help?
Experienced Talker

Posts: 30
Trades: 0
Hello,

I normally do all of my server side scripting in PHP, but this particular client is on a Windows server, so I'm trying to find out how to make something I would normally do in PHP work using ASP. Can anyone tell me how to do the following in ASP?

Code:
<?
if (strstr($_SERVER['HTTP_USER_AGENT'], "Googlebot"))
{
$se_referer = $_SERVER['HTTP_REFERER'];
$se_ip = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$se_visit = date("M d, Y at g:i:s A", time()-3600);
$se_method = $_SERVER['REQUEST_METHOD'];
$se_browser = $_SERVER['HTTP_USER_AGENT'];
$se_entry_page = $_SERVER['REQUEST_URI'];
}
//THEN I JUST HAVE THIS INFORMATION EMAILED TO ME...
//WHICH I KNOW HOW TO CODE
?>
Thanks!
__________________
Sherry

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by andersonweb; 06-07-2006 at 07:13 PM..
andersonweb is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-07-2006, 06:20 PM Re: I need PHP code converted to ASP...Can anyone please help?
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Untested, but should point you in the right direction at least... and there's no GetHostByAddr in ASP so you'll have to write your own or something. If you just want an IP Address, I'm pretty sire the REMOTE_ADDR server variable always returns an IP Address.


Code:
<%
If (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Googlebot", vbTextCompare) > 0) Then
 se_referer = Request.ServerVariables("HTTP_REFERER")
 se_ip = GetHostByAddr(Request.ServerVariables("REMOTE_ADDR"))
 se_visit = FormateDateTime(Now, vbLongDate) & " at " & FormatDateTime(Now, vbLongTime)
 se_method = Request.ServerVariables("REQUEST_METHOS")
 se_Browser = Request.ServerVariables("HTTP_USER_AGENT")
 se_entry_page = Request.ServerVariables("REQUEST_URI")
End If
%>
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Minaki; 06-08-2006 at 08:02 AM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 06-07-2006, 06:22 PM Re: I need PHP code converted to ASP...Can anyone please help?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Code:
<%
 
If InStr (Request.ServerVariables ("HTTP_USER_AGENT"), "Googlebot") > 0 then
    SE_REferer = Request.ServerVariables ("HTTP_REFERER")
    SE_IP = Request.ServerVariables ("REMOTE_ADDR")
    SE_Visit = Now() ' I'm not sure how to do that weird PHP date thing.
    SE_Method = Request.ServerVariables ("REQUEST_METHOD")
    SE_Browser = Request.ServerVariables ("HTTP_USER_AGENT")
    SE_Entry_Page = Request.ServerVariables ("REQUEST_URI")    
end if
 
%>
It's basically the same code, except you use Request.ServerVariables instead of $_SERVER .
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 06-07-2006, 06:48 PM Re: I need PHP code converted to ASP...Can anyone please help?
Experienced Talker

Posts: 30
Trades: 0
Hi, Minaki & Adam,

Thank you soooooo much! Between the 2 snippets I was able to get it to do what I needed. I changed Googlebot to Mozilla and it worked, so hopefully, I'll get an email when Google comes crawling!

Thanks again. I appreciate it.

Sherry
__________________
Sherry

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
andersonweb is offline
Reply With Quote
View Public Profile
 
Old 06-07-2006, 07:13 PM Re: I need PHP code converted to ASP...Can anyone please help?
Experienced Talker

Posts: 30
Trades: 0
Since I search these forums for answers before posting, I figured that I'd post the final code that ended up working so that others can benefit as well.

Thanks again, guys.

Code:
<%
If InStr (Request.ServerVariables ("HTTP_USER_AGENT"), "Googlebot") > 0 then
strSe_referer = Request.ServerVariables ("HTTP_REFERER")
strSe_ip = Request.ServerVariables ("REMOTE_ADDR")
strSe_visit = Now()
strSe_method = Request.ServerVariables ("REQUEST_METHOD")
strSe_Browser = Request.ServerVariables ("HTTP_USER_AGENT")
strSe_entry_page = Request.ServerVariables ("REQUEST_URI")
 
End If
%>
__________________
Sherry

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
andersonweb is offline
Reply With Quote
View Public Profile
 
Old 06-07-2006, 08:55 PM Re: I need PHP code converted to ASP...Can anyone please help?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
You welcome!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 06-22-2006, 07:12 AM Re: I need PHP code converted to ASP...Can anyone please help?
Novice Talker

Posts: 5
Trades: 0
i guess u had the code several times, but anyway i'll post it again. Hope it will help u:

<%
If InStr (Request.ServerVariables ("HTTP_USER_AGENT"), "Googlebot") > 0 then
strSe_referer = Request.ServerVariables ("HTTP_REFERER")
strSe_ip = Request.ServerVariables ("REMOTE_ADDR")
strSe_visit = Now()
strSe_method = Request.ServerVariables ("REQUEST_METHOD")
strSe_Browser = Request.ServerVariables ("HTTP_USER_AGENT")
strSe_entry_page = Request.ServerVariables ("REQUEST_URI")

End If
%>
pitas is offline
Reply With Quote
View Public Profile
 
Old 06-22-2006, 11:33 AM Re: I need PHP code converted to ASP...Can anyone please help?
Experienced Talker

Posts: 30
Trades: 0
As you can see in my last post, I posted the answer. It's the exact same thing that you copy and pasted into your meaningless post. There are more creative ways to build up your post total.
__________________
Sherry

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
andersonweb is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 04:45 PM Re: I need PHP code converted to ASP...Can anyone please help?
Extreme Talker

Posts: 170
Name: XpIndia.Com
Trades: 0
Hi friend

Try w3schools.com - its a wealth of free knowledge for all
XpIndia.Com is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I need PHP code converted to ASP...Can anyone please help?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28196 seconds with 12 queries