Fra PHP til ASP
Nogen der kan omskrive dette stykke php kode til asp?Det skal stadig køre med mysql dog bare med asp i sted for php.
<?php
extract($_POST, EXTR_PREFIX_SAME, "post_");
$ip=$_SERVER['REMOTE_ADDR'];
$ua=$_SERVER['HTTP_USER_AGENT'];
$host=$_SERVER['HTTP_HOST'];
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_res = $HTTP_COOKIE_VARS["users_resolution"];
else //means cookie is not found set it using Javascript
{
?>
<script language="javascript">
<!--
writeCookie();
function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}
//-->
</script>
<?php
}
$dbcnx = @mysql_connect("your_mysql_server","user_name","password");
$dbselect = @mysql_select_db("database_name");
if ((!$dbcnx) || (!$dbselect)) { echo "Can't connect to database"; }
$query = "insert into stats SET id='$id',file='$file',title='$title',state='$state',ip='$ip',res='$screen_res',hostname='$hostname',host='$host',ua='$ua'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
?>