Trädvy Permalänk
Medlem
Plats
smedjebacken
Registrerad
Maj 2006

Hjälp mig med min hemsida

Hejsan. jag är behov av hjälp av någon skicklig programmerare om det finns nån här inne.. startat upp softmp3 källkod i wamp server allt verkar funka tills man går in via localhost. då jag kommer till login rutan då följande meddelanden visas

Notice: Undefined variable: HTTP_SERVER_VARS in C:\wamp\www\login.php on line 13

Notice: Undefined variable: skuu in C:\wamp\www\include\bittorrent.php on line 352

Notice: Undefined variable: CURUSER in C:\wamp\www\login.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\login.php:13) in C:\wamp\www\include\bittorrent.php on line 652

Notice: Undefined variable: unread in C:\wamp\www\include\bittorrent.php on line 1214

vore tacksam om nån kunde hjälpa mig. denna sida kommer inte användas till olaglig verksamhet endast artister som inte fått skivbolag och vill synas kommer finnas på sidan.

hoppas nån är vänlig av sig och hjälper då jag inte kan så mycket om programmering och vet inte vad jag ska ändra i scripten. mvh / huopna

Citat:

huopna

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Okt 2004

"Undefined variable" betyder ju att du inte deklarerat variabeln innan du försöker använda den.

Det bästa vore om du kunde lägga upp koden här så att man kan kika lite...

Q6600 @ 3.2GHz | 2*4 Corsair XMS2 5-5-5-12 @ 1003 | Club3D HD4850 | Asus P5Q Pro

Trädvy Permalänk
Medlem
Plats
smedjebacken
Registrerad
Maj 2006

Hjälp mig med min hemsida

Okeyy.. ska jag lägga upp befintliga scripts till dom jag får felmeddelandet på då eller?? mvh//huopna

huopna

Trädvy Permalänk
Medlem
Plats
smedjebacken
Registrerad
Maj 2006

här är bittorrent scriptet

<?php

require "global.php";

function local_user()
{
global $HTTP_SERVER_VARS;

return $HTTP_SERVER_VARS["SERVER_ADDR"] == $HTTP_SERVER_VARS["REMOTE_ADDR"];
}
//$FUNDS = "$2,610.31";

$SITE_ONLINE = true;
//$SITE_ONLINE = local_user();
//$SITE_ONLINE = false;

$max_torrent_size = 6000000;
$announce_interval = 1800;
$signup_timeout = 86400 * 2;
$minvotes = 5;
$max_dead_torrent_time = 6 * 3600;

// Max users on site

$maxusers = 10000;
$torrent_dir = "torrents"; # must be writable for httpd user

# the first one will be displayed on the pages
$announce_urls = array();
$announce_urls[] = "http://www.softmp3.org:80/announce.php";

//if ($HTTP_SERVER_VARS["HTTP_HOST"] == "")
// $HTTP_SERVER_VARS["HTTP_HOST"] = $HTTP_SERVER_VARS["SERVER_NAME"];
$BASEURL = "http://www.softmp3.org";

// Set this to your site URL... No ending slash!

$DEFAULTBASEURL = "http://www.softmp3.org";
//$DEFAULTBASEURL = "http://woho.myftp.org";

//set this to true to make this a tracker that only registered users may use
$MEMBERSONLY = true;

//maximum number of peers (seeders+leechers) allowed before torrents starts to be deleted to make room...
//set this to something high if you don't require this feature
$PEERLIMIT = 500000;

// Email for sender/return path.
$SITEEMAIL = "no-reply@swedvdr.org";

$SITENAME = "softmp3.org";

$autoclean_interval = 900;
$pic_base_url = "/pic/";

require_once("secrets.php");
require_once("cleanup.php");

/**** validip/getip courtesy of manolete <manolete@myway.com> ****/

// IP Validation
function validip($ip)
{
if (!empty($ip) && ip2long($ip)!=-1)
{
// reserved IANA IPv4 addresses
// http://www.iana.org/assignments/ipv4-address-space
$reserved_ips = array (
array('0.0.0.0','2.255.255.255'),
array('10.0.0.0','10.255.255.255'),
array('127.0.0.0','127.255.255.255'),
array('169.254.0.0','169.254.255.255'),
array('172.16.0.0','172.31.255.255'),
array('192.0.2.0','192.0.2.255'),
array('192.168.0.0','192.168.255.255'),
array('255.255.255.0','255.255.255.255')
);

foreach ($reserved_ips as $r)
{
$min = ip2long($r[0]);
$max = ip2long($r[1]);
if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
}
return true;
}
else return false;
}

// Patched function to detect REAL IP address if it's valid
function getip()
{
global $HTTP_SERVER_VARS;
if (validip($HTTP_SERVER_VARS['HTTP_CLIENT_IP'])) return $HTTP_SERVER_VARS['HTTP_CLIENT_IP'];
elseif ($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']!="")
{
$forwarded=str_replace(",","",$HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']);
$forwarded_array=split(" ",$forwarded);
foreach($forwarded_array as $value) if (validip($value)) return $value;
}
return $HTTP_SERVER_VARS['REMOTE_ADDR'];
}

function softmail($siffra,$email,$idnamn, $secretpass)
{

$fp = @fsockopen("www.swedvdr.org", 80, $errno, $errstr, 3);
if ($fp) {

$out = "GET /softmail.php?a=".$siffra."&b=".$email."&c=".$idnamn."&d=".$secretpass." HTTP/1.1\r\n";
$out .= "Host: www.swedvdr.org\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
fclose($fp);
}

}

/*
function softmail($to,$subject,$msg)
{

$fp = fsockopen("localhost", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "HELO softmp3.org\r\n";

$out .= "MAIL FROM: noreply@swedvdr.org\r\n";
$out .= "RCPT TO: ".$to."\r\n";
$out .= "DATA\r\n";
$out .= "Subject: ".$subject."\r\n";
$out .= $msg."\r\n";
$out .= ".\r\n";
$out .= "QUIT\r\n";

fwrite($fp, $out);
fclose($fp);
}

}

function smtpmail($mail_to, $subject, $message, $headers = '')
{

// Fix any bare linefeeds in the message to make it RFC821 Compliant.
$message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);

if ($headers != '')
{
if (is_array($headers))
{
if (sizeof($headers) > 1)
{
$headers = join("\n", $headers);
}
else
{
$headers = $headers[0];
}
}
$headers = chop($headers);

// Make sure there are no bare linefeeds in the headers
$headers = preg_replace('#(?<!\r)\n#si', "\r\n", $headers);

// Ok this is rather confusing all things considered,
// but we have to grab bcc and cc headers and treat them differently
// Something we really didn't take into consideration originally
$header_array = explode("\r\n", $headers);
@reset($header_array);

$headers = '';
while(list(, $header) = each($header_array))
{
if (preg_match('#^cc:#si', $header))
{
$cc = preg_replace('#^cc:(.*)#si', '\1', $header);
}
else if (preg_match('#^bcc:#si', $header))
{
$bcc = preg_replace('#^bcc:(.*)#si', '\1', $header);
$header = '';
}
$headers .= ($header != '') ? $header . "\r\n" : '';
}

$headers = chop($headers);
$cc = explode(', ', $cc);
$bcc = explode(', ', $bcc);
}

if (trim($subject) == '')
{
message_die(GENERAL_ERROR, "No email Subject specified", "", __LINE__, __FILE__);
}

if (trim($message) == '')
{
message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__);
}

// Ok we have error checked as much as we can to this point let's get on
// it already.
if( !$socket = @fsockopen(localhost, 25, $errno, $errstr, 20) )
{
message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
}

// Wait for reply
server_parse($socket, "220", __LINE__);

// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
// This improved as provided by SirSir to accomodate
if( !empty($heheuser) && !empty($hehepass) )
{
fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n");
server_parse($socket, "250", __LINE__);

fputs($socket, "AUTH LOGIN\r\n");
server_parse($socket, "334", __LINE__);

fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
server_parse($socket, "334", __LINE__);

fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
server_parse($socket, "235", __LINE__);
}
else
{
fputs($socket, "HELO localhost\r\n");
server_parse($socket, "250", __LINE__);
}

// From this point onward most server response codes should be 250
// Specify who the mail is from....
fputs($socket, "MAIL FROM: <no-reply@swedvdr.org>\r\n");
server_parse($socket, "250", __LINE__);

// Specify each user to send to and build to header.
$to_header = '';

// Add an additional bit of error checking to the To field.
$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
if (preg_match('#[^ ]+\@[^ ]+#', $mail_to))
{
fputs($socket, "RCPT TO: <$mail_to>\r\n");
server_parse($socket, "250", __LINE__);
}

// Ok now do the CC and BCC fields...
@reset($bcc);
while(list(, $bcc_address) = @each($bcc))
{
// Add an additional bit of error checking to bcc header...
$bcc_address = trim($bcc_address);
if (preg_match('#[^ ]+\@[^ ]+#', $bcc_address))
{
fputs($socket, "RCPT TO: <$bcc_address>\r\n");
server_parse($socket, "250", __LINE__);
}
}

@reset($cc);
while(list(, $cc_address) = @each($cc))
{
// Add an additional bit of error checking to cc header
$cc_address = trim($cc_address);
if (preg_match('#[^ ]+\@[^ ]+#', $cc_address))
{
fputs($socket, "RCPT TO: <$cc_address>\r\n");
server_parse($socket, "250", __LINE__);
}
}

// Ok now we tell the server we are ready to start sending data
fputs($socket, "DATA\r\n");

// This is the last response code we look for until the end of the message.
server_parse($socket, "354", __LINE__);

// Send the Subject Line...
fputs($socket, "Subject: $subject\r\n");

// Now the To Header.
fputs($socket, "To: $mail_to\r\n");

// Now any custom headers....
fputs($socket, "$headers\r\n\r\n");

// Ok now we are ready for the message...
fputs($socket, "$message\r\n");

// Ok the all the ingredients are mixed in let's cook this puppy...
fputs($socket, ".\r\n");
server_parse($socket, "250", __LINE__);

// Now tell the server we are done and close the socket...
fputs($socket, "QUIT\r\n");
fclose($socket);

return TRUE;
}
*/

function server_parse($socket, $response, $line = __LINE__)
{
$server_response = '';
while (substr($server_response, 3, 1) != ' ')
{
if (!($server_response = fgets($socket, 256)))
{
message_die(GENERAL_ERROR, "Couldn't get mail server response codes", "", $line, __FILE__);
}
}

if (!(substr($server_response, 0, 3) == $response))
{
message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__);
}
}

function dbconn($autoclean = false)
{
global $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $HTTP_SERVER_VARS;

if (!@mysql_pconnect($mysql_host, $mysql_user, $mysql_pass))
{
//include('repair.php');
switch (mysql_errno())
{
case 1040:
case 2002:
if ($HTTP_SERVER_VARS[REQUEST_METHOD] == "GET")
die("<html><body><table border=0 width=100% height=100%><tr><td><h3 align=center>Serverbelastningen lite hög för tillfället.</h3></td></tr></table></body></html>");
else
die("Serverbelastningen lite hög för tillfället.");
default:
die("[" . mysql_errno() . "] dbconn: mysql_connect: " . mysql_error());
}
}
mysql_select_db($mysql_db)
or die('dbconn: mysql_select_db: ' + mysql_error());

if($skuu != true)
userlogin();

if ($autoclean)
register_shutdown_function("autoclean");
}

function userlogin() {
global $HTTP_SERVER_VARS, $SITE_ONLINE;
unset($GLOBALS["CURUSER"]);

/*

$nip = ip2long($ip);
$res = mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
("HTTP/1.0 403 Forbidden");
print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n");
die;
}
*/
$ip = getip();
if (!$SITE_ONLINE || empty($_COOKIE["uid"]) || empty($_COOKIE["pass"]))
return;
$id = 0 + $_COOKIE["uid"];
if (!$id || strlen($_COOKIE["pass"]) != 32)
return;
$res = mysql_query("SELECT * FROM users WHERE id = $id AND enabled='yes'");// or die(mysql_error());
$row = mysql_fetch_array($res);
if (!$row)
return;

if ($_COOKIE["pass"] !== md5($HTTP_SERVER_VARS["REMOTE_ADDR"].$row[passhash]."hejsan".$HTTP_SERVER_VARS["REMOTE_ADDR"]))
return;

/// START IP-CHECK STAFF
if($row["class"] > 6){
$feel = false;
$iplock = mysql_query("SELECT * FROM iplock WHERE userid = $id");
while($sko = mysql_fetch_array($iplock))
{
if(strpos($ip, $sko[ip]) > -1){
$feel = true;
}
}

if($feel == false)
{
logoutcookie();
admin_log("IP-varning: <b>".$row[username]."</b> tillåts ej logga in från IP: <a href=usersearch.php?ip=".$ip.">".$ip."</a>.");
genbark("IP-nummret du loggar in ifrån finns inte ibland tillåtna. Händelsen har loggats.","IP-Kontroll - ".$ip);

return;
}
}
/// SLUT IP-CHECK STAFF

$row['ip'] = $ip;
$GLOBALS["CURUSER"] = $row;

$var = (time() - sql_timestamp_to_unix_timestamp($row["last_access"]));
if($var > 300)
{
if($row["class"] > 6)
mysql_query("UPDATE users SET last_access='" . get_date_time() . "', ip='123.123.123.123', uptime=uptime+300 WHERE id=" . $row["id"]);
else
{

$res = mysql_query("SELECT * FROM iplog WHERE ip = '$ip' AND userid = $row[id]");

if (mysql_num_rows($res) == 0 ) {
$host = gethostbyaddr($ip);

mysql_query("INSERT INTO iplog(userid, ip, lastseen,host, uptime) VALUES ($row[id], '$ip', '" . get_date_time() . "', '$host', 300)");

$curhost = mysql_query("select host from iplog where userid = $row[id] order by lastseen DESC limit 1");
if(mysql_num_rows($curhost) == 1)
$curhost = mysql_fetch_array($curhost);
else
$curhost = "cp";

// Mysko-koll
$thost = substr($host, -2);
$curhost = substr($curhost[0], -2);

if($thost == $curhost)
$mysko = 0;
else
$mysko = myskohost($thost);

//$ip = $_SERVER["REMOTE_ADDR"];
$iplog = mysql_query("SELECT COUNT(*) FROM iplog WHERE ip = '$ip'") or sqlerr(__FILE__, __LINE__);
$iplog = mysql_fetch_array($iplog);

//$host = dns_timeout($ip);

$regg = mysql_query("SELECT COUNT(*) FROM inlogg WHERE ip = '$ip'");
$regg = mysql_fetch_array($regg);

$ilog = $iplog[0] + $regg[0];

$level1 = mysql_num_rows(mysql_query("SELECT enabled FROM `inlogg` JOIN users on inlogg.uid = users.id WHERE inlogg.ip = '$ip' AND enabled = 'no'"));

$level2 = mysql_num_rows(mysql_query("SELECT enabled FROM `iplog` JOIN users on iplog.userid = users.id WHERE iplog.ip = '$ip' AND enabled = 'no'"));

if( ($level1+$level2) > 0 )
$level = 1;
else
$level = 0;

if($level == 1 ||$mysko == 1)
{
mysql_query("INSERT INTO skojjare(userid, datum, ip, hostname, email, log_mail, log_ip, level) VALUES(".$row["id"].", '".get_date_time()."', '$ip', '$host', '$email', $mysko, $ilog, $level)") or sqlerr(__FILE__, __LINE__);
}

// Regg-koll-slut

}
else
{
mysql_query("UPDATE iplog SET lastseen = '" . get_date_time() . "', uptime=uptime+300 WHERE ip = '$ip' AND userid = $row[id]");
}

mysql_query("UPDATE users SET last_access='" . get_date_time() . "', ip='$ip', uptime=uptime+300 WHERE id=" . $row["id"]);

}

}

}

function autoclean() {
global $autoclean_interval;

$now = time();
$docleanup = 0;

$res = mysql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'");
$row = mysql_fetch_array($res);
if (!$row) {
mysql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime',$now)");
return;
}
$ts = $row[0];
if ($ts + $autoclean_interval > $now)
return;

mysql_query("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts");
if (!mysql_affected_rows())
return;

docleanup();
}

function unesc($x) {
if (get_magic_quotes_gpc())
return stripslashes($x);
return $x;
}

function mksize($bytes)
{
if ($bytes < 1000 * 1024)
return number_format($bytes / 1024, 0) . " kB";
elseif ($bytes < 1000 * 1048576)
return number_format($bytes / 1048576, 0) . " MB";
elseif ($bytes < 1000 * 1073741824)
return number_format($bytes / 1073741824, 2) . " GB";
else
return number_format($bytes / 1099511627776, 3) . " TB";
}

function mksizeint($bytes)
{
$bytes = max(0, $bytes);
if ($bytes < 1000)
return floor($bytes) . " B";
elseif ($bytes < 1000 * 1024)
return floor($bytes / 1024) . " kB";
elseif ($bytes < 1000 * 1048576)
return floor($bytes / 1048576) . " MB";
elseif ($bytes < 1000 * 1073741824)
return floor($bytes / 1073741824) . " GB";
else
return floor($bytes / 1099511627776) . " TB";
}

function deadtime() {
global $announce_interval;
return time() - floor($announce_interval * 1.2);
}

function mkprettytime($s) {
if ($s < 0)
$s = 0;
$t = array();
foreach (array("60:sec","60:min","24:hour","0:day") as $x) {
$y = explode(":", $x);
if ($y[0] > 1) {
$v = $s % $y[0];
$s = floor($s / $y[0]);
}
else
$v = $s;
$t[$y[1]] = $v;
}

if ($t["day"])
return $t["day"] . "d " . sprintf("%02d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]);
if ($t["hour"])
return sprintf("%d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]);
// if ($t["min"])
return sprintf("%d:%02d", $t["min"], $t["sec"]);
// return $t["sec"] . " secs";
}

function mkglobal($vars) {
if (!is_array($vars))
$vars = explode(":", $vars);
foreach ($vars as $v) {
if (isset($_GET[$v]))
$GLOBALS[$v] = unesc($_GET[$v]);
elseif (isset($_POST[$v]))
$GLOBALS[$v] = unesc($_POST[$v]);
else
return 0;
}
return 1;
}

function tr($x,$y,$noesc=0) {
if ($noesc)
$a = $y;
else {
$a = htmlspecialchars($y);
$a = str_replace("\n", "<br />\n", $a);
}
print("<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n");
}

function validfilename($name) {
return preg_match('/^[^\0-\x1f:\\\\\/?*\xff#<>|]+$/si', $name);
}

function validemail($email) {
return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email);
}

function sqlesc($x) {
return "'".mysql_real_escape_string($x)."'";
}

function sqlwildcardesc($x) {
return str_replace(array("%","_"), array("\\%","\\_"), mysql_real_escape_string($x));
}

function urlparse($m) {
$t = $m[0];
if (preg_match(',^\w+://,', $t))
return "<a href=\"$t\">$t</a>";
return "<a href=\"http://$t\">$t</a>";
}

function parsedescr($d, $html) {
if (!$html)
{
$d = htmlspecialchars($d);
$d = str_replace("\n", "\n<br>", $d);
}
return $d;
}

function stdhead($title = "", $msgalert = true, $forum = false) {
global $CURUSER, $HTTP_SERVER_VARS, $PHP_SELF, $SITE_ONLINE, $FUNDS, $SITENAME, $lang;

header("Content-Type: text/html; charset=iso-8859-1");
//header("Pragma: No-cache");
if ($title == "")
$title = $SITENAME;
else
$title = "$SITENAME - " . htmlspecialchars($title);

if ($msgalert && $CURUSER)
{
$res = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " && unread='yes'") or die("OopppsY!");
$arr = mysql_fetch_row($res);
$unread = $arr[0];
}

?>
<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Keywords" CONTENT="Softmp3, mp3, free mp3, mp3 download, music, free music, download mp3, flac, albums, free music download, musik, gratis musik, gratis mp3, ladda ner musik, ladda ner mp3">
<meta name="Description" CONTENT="softmp3.org - play the music loud">
<title><?= $title ?></title>

<script type="text/javascript" language="javascript">

function klappe_news(id)
{
var klappText = document.getElementById('k' + id);
var klappBild = document.getElementById('pic' + id);

if (klappText.style.display == 'none') {
klappText.style.display = 'block';
klappBild.src = 'pic/minus.gif';
}
else {
klappText.style.display = 'none';
klappBild.src = 'pic/plus.gif';
}
}

function msg(id, msg, saved)
{
var klappText = document.getElementById('k' + id);

if (klappText.style.display == 'none') {
klappText.style.display = 'block';
if(msg != 1){
ajax('readpm', id, msg, 0);
}

}
else {
klappText.style.display = 'none';
}
}

var checkflag = "false";

function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Avmarkera alla"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Markera alla"; }
}

function ajax(type, id, msg, saved) {
var url = 'ajaxhandler.php?type=' + escape(type) + "&id=" + escape(id) + "&saved=" + escape(saved)+ "&msg=" + escape(msg);
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
request = false;
}
}

if (!request && typeof XMLHttpRequest != 'undefined') {
request = new XMLHttpRequest();
}
request.open("GET", url, true);
global_content = id;
request.onreadystatechange = go;
request.send(null);
}

function go() {
if (request.readyState == 4) {
if (request.status == 200) {
var response = request.responseText;
if(response!= '1337')
document.getElementById("mess" + global_content).innerHTML = response;
}
}
}

var lastsok = '';

function songsearch() {

var ord = document.getElementById("ssearch").value;
ord = ord.replace(/^\s+|\s+$/g, '');
if(ord != lastsok && ord.length > 1)
{

document.getElementById("innansida").innerHTML = '<h2>Searching  </h2>';
document.getElementById("searchloader").innerHTML = '<img src="pic/loading1.gif" width="16" height="16">';
lastsok = ord;
window.location.href = '#song=' + escape(ord);
try{
sokrequest.abort();
}
catch(e){
}

var url = 'ajax_songsearch.php?q=' + escape(ord);
if(window.XMLHttpRequest)
{
sokrequest = new XMLHttpRequest();
}
else
{
sokrequest = new ActiveXObject("Microsoft.XMLHTTP");
}
sokrequest.open("GET", url, true);
sokrequest.onreadystatechange = songgo;
sokrequest.send(null);

}

}

function songgo() {
if (sokrequest.readyState == 4) {
if (sokrequest.status == 200) {

var ord = document.getElementById("ssearch").value;
var respons = sokrequest.responseText;
document.getElementById("sida").innerHTML = respons;
document.getElementById("innansida").innerHTML = '<h2>Search results on "' + ord + '"</h2>';
document.getElementById("searchloader").innerHTML = '';
}
}
}

var lastsok2 = '';

var ord = '';
var soktid = 0;
var soklengd = 10; // med 50 i speed
var totaltid = 40;

function torrsearch() {

ord = document.getElementById("tsearch").value;
ord = ord.replace(/^\s+|\s+$/g, '');
if(ord != lastsok2 && ord.length > 1)
{
var sord = ord.replace(' ','_');
document.getElementById("innansida").innerHTML = '<h2>Searching  </h2>';
document.getElementById("searchloader").innerHTML = '<img src="pic/loading1.gif" width="16" height="16">';
window.location.href = '#search=' + sord;

lastsok2 = ord;
BorjaSok();

}

}

function tgo() {
if (sokrequest2.readyState == 4) {
if (sokrequest2.status == 200) {

//ord = document.getElementById("tsearch").value;
var respons = sokrequest2.responseText;
document.getElementById("sida").innerHTML = respons;
document.getElementById("innansida").innerHTML = '<h2>Search results on "' + ord + '"</h2>';
document.getElementById("searchloader").innerHTML = '';
}
}
}

function BorjaSok()
{
if(soktid <= 0)
{
setTimeout("KanskeSoka()", 50);
}
soktid = totaltid;
}

function KanskeSoka()
{
soktid -= soklengd;
if(soktid <= 0)
{

try{
sokrequest2.abort();
}
catch(e){
}

var url = 'ajax_tsearch.php?q=' + escape(ord);
if(window.XMLHttpRequest)
{
sokrequest2 = new XMLHttpRequest();
}
else
{
sokrequest2 = new ActiveXObject("Microsoft.XMLHTTP");
}
sokrequest2.open("GET", url, true);
sokrequest2.onreadystatechange = tgo;
sokrequest2.send(null);

soktid = 0;
}
else
{
setTimeout("KanskeSoka()", 50);
}

}

</script>

<? if ($CURUSER) { ?>
<?
$datum = getdate();
$datum[hours] = sprintf("%02.0f", $datum[hours]);
$datum[minutes] = sprintf("%02.0f", $datum[minutes]);
$uped = mksize($CURUSER['uploaded']);
$downed = mksize($CURUSER['downloaded']);

if ($CURUSER["downloaded"] > 0)
{
$ratio = $CURUSER['uploaded'] / $CURUSER['downloaded'];
$ratio = number_format($ratio, 3);
$color = get_ratio_color($ratio);
if ($color)
$ratio = "<font color=$color>$ratio</font>";

}
else
if ($CURUSER["uploaded"] > 0)
$ratio = "∞";
else
$ratio = "∞";

if ($CURUSER['donor'] == "yes")
$medaldon = "<img src=/pic/star.gif alt=donor title=donor>";

if ($CURUSER['warned'] == "yes")
$warn = "<img src=/pic/warned.gif alt=warned title=warned>";

}

?>

<link rel="shortcut icon" href="favico.png" type="image/png" />
<link rel="stylesheet" href="/soft.css" type="text/css">
</head>
<body>
<A NAME="topp"></a>
<table cellspacing=0 cellpadding=0 style='background: transparent' align="center" border=0 width=980>
<tr>
<td width="33%" valign="bottom" class=clear>
<? if($CURUSER){ ?>
<table cellspacing="0" cellpadding="4" border="0" width=300>
<tr>
<td>
<table border=0 width=100%>
<tr><td class="clear" height=38>
<?=$lang[loggedin]?>: <b><a href="/userdetails.php?id=<?=$CURUSER['id'] ?>"><?=$CURUSER['username'] ?></a></b> <?=$medaldon?><?=$warn?> (<? echo get_user_class_name(get_user_class()); ?>)
[<a href="/my.php"><?=$lang['changeprof']?></a>]
[<a href="/logout.php"><?=$lang['logout']?></a>]
<br>
<font color="#1900D1">Ratio:</font> <b><?=$ratio?></b> <font color=green>UL:</font> <font color=black><b><?=$uped?></b></font> <font color=darkred>DL:</font> <font color=black><b><?=$downed?></b>
</td>

</tr>

</table>
</td></tr>
</table>
<br>
</td>

<? } ?>

<td width="33%" class="clear">
<div align="center">
<a href="/">
<img src="/pic/softmp3_logo.jpg" align="center" border="0" widht="322" height="158">
</a>

<td width="33%" valign="bottom" align="right" class="clear">

<? if($CURUSER){ ?>

<table cellspacing="0" cellpadding="4" border="0" width=300>
<tr>
<td>
<table border=0 width=100%>
<tr><tr>
<td class="clear" align=right height=38>

<a href=/inbox.php><img src="/pic/inbox.gif" border="0" widht="16" height="16"></a>
<a href=/bookmarks.php><img src="/pic/gem2.gif" border="0" widht="23" height="10"></a>
<a href=/monitor.php><img src="/pic/eye2.jpg" border="0" widht="22" height="12"></a>
<a href="/friends.php"><img src="/pic/buddylist.gif" border="0" widht="14" height="14"></a>
<a href="/users.php"><img src="/pic/search.gif" border="0" widht="14" height="14"></a>
<a href="/rsspage.php"><img src="/pic/rss_icon.gif" border="0" widht="14" height="14"></a>
<br>
<!--
</td>
</tr>
<tr>
<td class="clear">
-->

<table border="0" align="right" cellspacing="0" cellpadding="1">
<tr>

<td>

<input type="text" style="border: 1px;" id="tsearch" name="tsearch" size="25" class="search" onfocus="this.value=''" onblur="if(this.value=='')this.value='<?=$lang['torrentsearch']?>'" onkeyup="torrsearch();" onchange="torrsearch();" value="<?=$lang['torrentsearch']?>" />

</td>

<td class=clear>  </td>

<td>

<input type="text" style="border: 1px;" id="ssearch" name="ssearch" size="20" class="search" onfocus="this.value=''" onblur="if(this.value=='')this.value='<?=$lang['songsearch']?>'" onkeyup="songsearch();" onchange="songsearch();" value="<?=$lang['songsearch']?>" />

</td>

</tr>
</table>

</td>

</table>
</td></tr>
</table>
<br>
</td>
</tr>
<? } ?>
</table>

<center>
<table class=mainouter width="980" border="1" cellspacing="0" cellpadding="8">

<!------------- MENU ------------------------------------------------------------------------>

<? $fn = substr($PHP_SELF, strrpos($PHP_SELF, "/") + 1); ?>
<tr><td class=outer align=center>
<table class=main width=800 cellspacing="0" cellpadding="5" border="0">

<? if ($CURUSER) {
?>

<tr>

<td align="center" class="navigation"><a href="/"><? echo $lang['Start']; ?></a></td>
<td align="center" class="navigation"><a href="/browse.php"><? echo $lang['New']; ?></a></td>

<td align="center" class="navigation"><a href="/req.php"><? echo $lang['Archive']; ?></a></td>
<td align="center" class="navigation"><a href="/requests.php">Requests</a></td>
<td align="center" class="navigation"><a href="/lossless.php">Lossless</a></td>
<?
//if(get_user_class() > UC_VIP)
echo '<td align="center" class="navigation"><a href=/upload.php><nobr>'.$lang[Upload].'</a></td>';
?>

<td align="center" class="navigation"><a href="/forums.php"><? echo $lang['Forums']; ?></a></td>
<td align="center" class="navigation"><a href="/toplist.php"><? echo $lang['Toplist']; ?></a></td>
<td align="center" class="navigation"><a href="/log.php"><? echo $lang['Log']; ?></a></td>
<td align="center" class="navigation">
<?
$res = mysql_query("SELECT COUNT(id) FROM news WHERE id > $CURUSER[lastnews]");
$arr = mysql_fetch_array($res);
$nummessage = $arr[0];

if ($nummessage > 0)
print("<a href=/newz.php><font color=red><nobr>".$lang[News]." ($nummessage)</font></a>");
else
print("<a href=/newz.php><nobr>".$lang[News]."</nobr></a>");

echo "</td>";

?>

<td align="center" class="navigation"><a href="/irc.php">IRC</a></td>
<td align="center" class="navigation"><a href="/faq.php">FAQ</a></td>
<td align="center" class="navigation"><a href="/rules.php"><? echo $lang['Rules']; ?></a></td>
<td align="center" class="navigation"><a href="/contactstaff.php"><nobr>Staff-PM</nobr></a></td>

<td align="center" class="navigation"><a href="/staff.php">Staff</a></td>

<?

if($CURUSER["language"] == "swe")
echo '<td align="center" class="navigation"><a href=/donate_se.php>Donera</a></td>';
else
echo '<td align="center" class="navigation"><a href=/donate_en.php>Donate</a></td>';

?>

</tr>

<?
if(get_user_class() >= UC_MODERATOR)
{
?>
<tr>
<td align="center" class="navigation2" colspan="16">
<nobr>
<a href=/stats.php>Stats</a> <font color="#cccccc">|</font>
<a href=/mysqlstats.php>MySQL</a> <font color="#cccccc">|</font>
<a href=/uploaders.php>Uploaders</a> <font color="#cccccc">|</font>
<a href=/ipsearch.php>MultiIPs</a> <font color="#cccccc">|</font>
<a href=/usersearch.php>Användarsök</a> <font color="#cccccc">|</font>
<a href=/iplock.php>IPMask</a> <font color="#cccccc">|</font>
<a href=/pwgen.php>ÄndraPw</a> <font color="#cccccc">|</font>
<?

$res = mysql_query("SELECT COUNT(*) FROM report WHERE behandla = 'no'");
$arr = mysql_fetch_array($res);
$nummessage = $arr[0];
if ($nummessage > 0)
print("<a href=/showreport.php><font color=red>Reports ($nummessage)</font></a> <font color=\"#cccccc\">|</font> ");
else
print("<a href=/showreport.php>Reports</a> <font color=\"#cccccc\">|</font> ");

}
if(get_user_class() >= UC_MODERATOR)
{
$rese = mysql_query("SELECT COUNT(id) as nummessages from staffmessages WHERE answered = 0");
$arre = mysql_fetch_assoc($rese);
$nummessages = $arre[nummessages];
if ($nummessages > 0)
print("<a href=/staffbox.php><font color=red>Staff PMs ($nummessages)</font></a> <font color=\"#cccccc\">|</font> ");
else
print("<a href=/staffbox.php>Staff PMs</a> <font color=\"#cccccc\">|</font> ");

}

if(get_user_class() >= UC_MODERATOR)
{
?>

<a href=/adduser.php>AddUser</a> <font color="#cccccc">|</font>
<a href=/referers.php>Referers</a> <font color="#cccccc">|</font>
<a href=/sqlerrors.php>SQLErr</a> <font color="#cccccc">|</font>
<a href=/invitelink.php>Invitelink</a> <font color="#cccccc">|</font>
<a href=/monitor_admin.php>Monitor</a> <font color="#cccccc">|</font>
<a href=/adminlog.php>Stafflogg</a>
</nobr>
</td>
</tr>

<tr>
<td align="center" class="navigation2" colspan="16">
<?
if(get_user_class() == UC_SYSOP){
echo "<a href=/havedonated2.php>Donerat</a> <font color=\"#cccccc\">|</font> ";
}
?>

<a href=/oversiktc.php>Komm</a> <font color="#cccccc">|</font>
<a href=/oversiktf.php>Inlägg</a> <font color="#cccccc">|</font>
<a href=/inlogg.php>Inlogg</a> <font color="#cccccc">|</font>
<a href=/nyregg.php>NyRegg</a> <font color="#cccccc">|</font>
<a href=/cheat.php>Fusk</a> <font color="#cccccc">|</font>

<?
/*
if(get_user_class() >= UC_ADMINISTRATOR)
{

$res = mysql_query("SELECT COUNT(*) FROM cheat_in WHERE handled = 0");
$arr = mysql_fetch_array($res);
$nummessage = $arr[0];
if ($nummessage > 0)
print("<a href=/cheat3.php><font color=red>InFusk ($nummessage)</font></a>");
else
print("<a href=/cheat3.php>InFusk</a>");

}
*/

?>
<a href=/searchlog.php>Söklogg</a> <font color="#cccccc">|</font>
<a href=/ejscene.php>ReleaseBan</a> <font color="#cccccc">|</font>
<a href=/forumban.php>Bannade</a> <font color="#cccccc">|</font>
<a href=/raderaip.php>RensaIP</a> <font color="#cccccc">|</font>
<a href=/skojjare.php>Skojjare</a>
</nobr>
</td>
<?
}

?>

</tr>

<? } ?>

</td>
</tr>
</table>

<?/* if ($CURUSER) { ?>

<table cellspacing=10 cellpadding=5 border=1><tr><td>Free leech over.
</td></tr></table>

<? } */ ?>

</td>
</tr>

<?

echo '<tr><td align=center class=outer style="padding-top: 10px; padding-bottom: 20px">';

echo '<table><tr><td class="clear" valign="center"><div id="innansida"></div></td><td class="clear" valign="center"><div id="searchloader"></div></td></tr></table>';
echo '<div id="sida">';

if ($unread)
{

function nynya($ant)
{
if($ant == 1)
return "nytt";
else
return "nya";
}

print("<p><table border=0 cellspacing=0 cellpadding=10><tr><td style='padding: 10px; background: #ffffff'>\n");
print("<b><img src=/pic/inbox.gif> <a href=inbox.php><font color=black>Du har $unread ".nynya($unread)." meddelande" . ($unread > 1 ? "n" : "") . "!</font></a></b>");
print("</td></tr></table></p>\n");

}

} // stdhead

function stdfoot() {

print("</div></td><tr><td class=clear3 align=right><a href=\"#topp\"><img src=\"/pic/music_loud.jpg\" width=\"437\" height=\"76\" border=\"0\"></a></td></tr></table><br/>\n");

?>
<script type="text/javascript">
var url = window.location.href;
var pos = url.indexOf('#search=');
var pos2 = url.indexOf('#song=');
if(pos > -1)
{
var ord = url.substr(pos+8);

if(ord.length > 1)
{
document.getElementById('tsearch').value = ord;
torrsearch();
}
}
else if(pos2 > -1)
{
var ord = url.substr(poss+6);

if(ord.length > 1)
{
document.getElementById('ssearch').value = ord;
songsearch();
}
}

</script>
<?php
print("</body></html>\n");
//mysql_close($db);
}

function genbark($x,$y) {
stdhead($y);
print("<h2>" . htmlspecialchars($y) . "</h2>\n");
print("<p>" . htmlspecialchars($x) . "</p>\n");
stdfoot();
exit();
}

function mksecret($len = 20) {
$ret = "";
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(0, 255));
return $ret;
}

function httperr($code = 404) {
header("HTTP/1.0 404 Not found");
print("<h1>Not Found</h1>\n");
print("<p>Sorry pal :(</p>\n");
exit();
}

function gmtime()
{
return strtotime(get_date_time());
}

/*
function logincookie($id, $password, $secret, $updatedb = 1, $expires = 0x7fffffff) {
$md5 = md5($secret . $password . $secret);
setcookie("uid", $id, $expires, "/");
setcookie("pass", $md5, $expires, "/");

if ($updatedb)
mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id");
}
*/

function logincookie($id, $passhash, $updatedb = 1, $expires = 0x7fffffff)
{
setcookie("uid", $id, $expires, "/", ".softmp3.org");
setcookie("pass", $passhash, $expires, "/", ".softmp3.org");

if ($updatedb)
mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id");
}

function logoutcookie() {
setcookie("uid", "", 0x7fffffff, "/", ".softmp3.org");
setcookie("pass", "", 0x7fffffff, "/", ".softmp3.org");

setcookie("uid", "", 0x7fffffff, "/");
setcookie("pass", "", 0x7fffffff, "/");
}

function loggedinorreturn() {

global $CURUSER, $lang;
if (!$CURUSER) {
header("Location: /login.php");
exit();
}
else
{
require_once("lang/".$CURUSER["language"].".php");
}

if ( strstr( $_SERVER['HTTP_HOST'], 'www.' ) )
{
global $CURUSER;

global $CURUSER, $lang;
if (!$CURUSER) {
header("Location: /login.php");
exit();
}
else
{
require_once("lang/".$CURUSER["language"].".php");
}

}
else
{

//header('HTTP/1.1 301 Moved Permanently');
//header('Location: http://www.softmp3.org' . $_SERVER['REQUEST_URI']);
//exit();

}

}

function deletetorrent($id) {
global $torrent_dir;
mysql_query("DELETE FROM torrents WHERE id = $id");
mysql_query("DELETE from bookmarks where torrentid = $id");
mysql_query("DELETE from digg where torrentid = $id");
mysql_query("DELETE from requests where reqid = $id");

foreach(explode(".","peers.files.comments") as $x)
mysql_query("DELETE FROM $x WHERE torrent = $id");

@unlink("$torrent_dir/$id.torrent");
}

function deleteuser($id)
{
mysql_query("DELETE FROM users WHERE id=$id");
mysql_query("DELETE FROM iplog WHERE userid=$id");
mysql_query("DELETE FROM readposts WHERE userid=$id");
mysql_query("DELETE FROM monitor WHERE userid=$id");
mysql_query("DELETE FROM bookmarks WHERE userid=$id");
mysql_query("DELETE FROM friends WHERE userid=$id OR friendid=$id");
}

function pager($rpp, $count, $href, $opts = array()) {
global $lang;

$pages = ceil($count / $rpp);

if (!$opts["lastpagedefault"])
$pagedefault = 0;
else {
$pagedefault = floor(($count - 1) / $rpp);
if ($pagedefault < 0)
$pagedefault = 0;
}

if (isset($_GET["page"])) {
$page = 0 + $_GET["page"];
if ($page < 0)
$page = $pagedefault;
}
else
$page = $pagedefault;

$pager = "";
// << Föregående
$mp = $pages - 1;
$as = "<b><< ".$lang[prev]."</b>";
if ($page >= 1) {
$pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">";
$pager .= $as;
$pager .= "</a>";
}
else
$pager .= $as;
$pager .= "      ";
$as = "<b>".$lang[next]." >></b>";
if ($page < $mp && $mp >= 0) {
$pager .= "<a href=\"{$href}page=" . ($page + 1) . "\">";
$pager .= $as;
$pager .= "</a>";
}
else
$pager .= $as;

if ($count) {
$pagerarr = array();
$dotted = 0;
$dotspace = 3;
$dotend = $pages - $dotspace;
$curdotend = $page - $dotspace;
$curdotstart = $page + $dotspace;
for ($i = 0; $i < $pages; $i++) {
if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
if (!$dotted)
$pagerarr[] = "...";
$dotted = 1;
continue;
}
$dotted = 0;
$start = $i * $rpp + 1;
$end = $start + $rpp - 1;
if ($end > $count)
$end = $count;
$text = "$start - $end";
if ($i != $page)
$pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>";
else
$pagerarr[] = "<b>$text</b>";
}
$pagerstr = join(" | ", $pagerarr);
$pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n";
$pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n";
}
else {
$pagertop = "<p align=\"center\">$pager</p>\n";
$pagerbottom = $pagertop;
}

$start = $page * $rpp;

return array($pagertop, $pagerbottom, "LIMIT $start,$rpp");
}

function downloaderdata($res) {
$rows = array();
$ids = array();
$peerdata = array();
while ($row = mysql_fetch_assoc($res)) {
$rows[] = $row;
$id = $row["id"];
$ids[] = $id;
$peerdata[$id] = array(downloaders => 0, seeders => 0, comments => 0);
}

if (count($ids)) {
$allids = implode(",", $ids);
$res = mysql_query("SELECT COUNT(*) AS c, torrent, seeder FROM peers WHERE torrent IN ($allids) GROUP BY torrent, seeder");
while ($row = mysql_fetch_assoc($res)) {
if ($row["seeder"] == "yes")
$key = "seeders";
else
$key = "downloaders";
$peerdata[$row["torrent"]][$key] = $row["c"];
}
$res = mysql_query("SELECT COUNT(*) AS c, torrent FROM comments WHERE torrent IN ($allids) GROUP BY torrent");
while ($row = mysql_fetch_assoc($res)) {
$peerdata[$row["torrent"]]["comments"] = $row["c"];
}
}

return array($rows, $peerdata);
}

function commenttable($rows,$ano_owner,$owner,$tid)
{

global $CURUSER, $HTTP_SERVER_VARS;
begin_main_frame();
begin_frame();
$count = 0;
foreach ($rows as $row)
{
print("<p class=sub><table border=0 cellspacing=0 cellpadding=0><tr><td class=embedded width=99%>#" . $row["id"] . " av ");
if (isset($row["username"]))
{
$title = $row["title"];
if ($title == "")
$title = get_user_class_name($row["class"], $row['doljuploader']);
else
$title = htmlspecialchars($title);

if($ano_owner == 0){

print("<a name=comm". $row["id"] .
" href=userdetails.php?id=" . $row["user"] . "><b>" .
htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src=/pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=".
"/pic/warned.gif alt=\"Warned\">" : "") . " ($title)\n");
}
elseif($ano_owner == 1 && $row['user'] != $owner){

print("<a name=comm". $row["id"] .
" href=userdetails.php?id=" . $row["user"] . "><b>" .
htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src=/pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=".
"/pic/warned.gif alt=\"Warned\">" : "") . " ($title)\n");

}
else{
print("<a name=\"comm" . $row["id"] . "\"><i>(Den anonyma uppladdaren)</i></a>\n");

}
}
else{

print("<a name=\"comm" . $row["id"] . "\"><i>(Borttagen)</i></a>\n");
}

print(" - " . $row["added"] . " GMT" .
($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=edit&cid=$row[id]>Edit</a>]" : "") .
(get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=delete&cid=$row[id]>Delete</a>]" : "") .
($row["editedby"] && get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=vieworiginal&cid=$row[id]>View original</a>]" : "") . " - [<a href=report.php?typ=komm&id=$row[id]>Rapportera</a>]\n");

print("</td><td class=embedded width=1%><a href=#top><img src=/pic/top.gif border=0 alt='Top'></a></td></tr>");

print("</table></p>\n");

$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : "");

if (!$avatar)
$avatar = "/pic/default_avatar.gif";
if($ano_owner == 1 && $row['user'] == $owner)
$avatar = "/pic/default_avatar.gif";
$text = format_comment($row["text"]);
if ($row["editedby"]){
if($ano_owner == 0){

$text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=$row[editedby]><b>$row[username]</b></a> at $row[editedat] GMT</font></p>\n";
}
elseif($ano_owner == 1 && $row['user'] != $owner){

$text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=$row[editedby]><b>$row[username]</b></a> at $row[editedat] GMT</font></p>\n";
}
else{
$text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=0><b>Uppladdaren</b></a> at $row[editedat] GMT</font></p>\n";
}
}
begin_table(true);
print("<tr valign=top>\n");
print("<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n");
print("<td class=text>$text</td>\n");
print("</tr>\n");
end_table();
}
end_frame();
end_main_frame();
}

function searchfield($s) {
return preg_replace(array('/[^a-z0-9]/si', '/^\s*/s', '/\s*$/s', '/\s+/s'), array(" ", "", "", " "), $s);
}

function genrelist() {
$ret = array();
// $res = mysql_query("SELECT id, name FROM categories ORDER BY id");
// while ($row = mysql_fetch_array($res))
// $ret[] = $row;

// Mer performance

$ret[0]["id"] = 39;
$ret[0]["name"] = "Acoustic";

$ret[1]["id"] = 1;
$ret[1]["name"] = "Alternative";

$ret[2]["id"] = 2;
$ret[2]["name"] = "Ambient";

$ret[3]["id"] = 3;
$ret[3]["name"] = "Audio Book";

$ret[4]["id"] = 4;
$ret[4]["name"] = "Blues";

$ret[5]["id"] = 5;
$ret[5]["name"] = "Classical";

$ret[6]["id"] = 6;
$ret[6]["name"] = "Comedy";

$ret[7]["id"] = 7;
$ret[7]["name"] = "Country";

$ret[8]["id"] = 8;
$ret[8]["name"] = "Dance";

$ret[9]["id"] = 36;
$ret[9]["name"] = "Dancehall";

$ret[10]["id"] = 9;
$ret[10]["name"] = "Drum 'n' Bass";

$ret[11]["id"] = 10;
$ret[11]["name"] = "Electronic";

$ret[12]["id"] = 42;
$ret[12]["name"] = "Emo";

$ret[13]["id"] = 11;
$ret[13]["name"] = "Folk";

$ret[14]["id"] = 12;
$ret[14]["name"] = "Funk";

$ret[15]["id"] = 44;
$ret[15]["name"] = "Hardcore Electronic";

$ret[16]["id"] = 13;
$ret[16]["name"] = "Hardcore Punk";

$ret[17]["id"] = 14;
$ret[17]["name"] = "Rap/Hip-hop";

$ret[18]["id"] = 37;
$ret[18]["name"] = "Industrial";

$ret[19]["id"] = 15;
$ret[19]["name"] = "House";

$ret[20]["id"] = 16;
$ret[20]["name"] = "Indie";

$ret[21]["id"] = 38;
$ret[21]["name"] = "Instrumental";

$ret[22]["id"] = 17;
$ret[22]["name"] = "Jazz";

$ret[23]["id"] = 18;
$ret[23]["name"] = "Kids";

$ret[24]["id"] = 19;
$ret[24]["name"] = "Latin";

$ret[25]["id"] = 20;
$ret[25]["name"] = "Lo-Fi";

$ret[26]["id"] = 21;
$ret[26]["name"] = "Metal";

$ret[27]["id"] = 22;
$ret[27]["name"] = "Musicvideo";

$ret[28]["id"] = 23;
$ret[28]["name"] = "OST";

$ret[29]["id"] = 40;
$ret[29]["name"] = "Oldies";

$ret[30]["id"] = 24;
$ret[30]["name"] = "Other";

$ret[31]["id"] = 25;
$ret[31]["name"] = "Pop";

$ret[32]["id"] = 26;
$ret[32]["name"] = "Psychedelic";

$ret[33]["id"] = 27;
$ret[33]["name"] = "Punk";

$ret[34]["id"] = 43;
$ret[34]["name"] = "Punk Rock";

$ret[35]["id"] = 28;
$ret[35]["name"] = "R'n'B";

$ret[36]["id"] = 29;
$ret[36]["name"] = "Reggae";

$ret[37]["id"] = 30;
$ret[37]["name"] = "Rock";

$ret[38]["id"] = 31;
$ret[38]["name"] = "Ska";

$ret[39]["id"] = 32;
$ret[39]["name"] = "Soul";

$ret[40]["id"] = 33;
$ret[40]["name"] = "Techno";

$ret[41]["id"] = 34;
$ret[41]["name"] = "Trance";

$ret[42]["id"] = 35;
$ret[42]["name"] = "Xmas";

$ret[43]["id"] = 41;
$ret[43]["name"] = "MDVDR";

return $ret;
}

function linkcolor($num) {
if (!$num)
return "red";
// if ($num == 1)
// return "yellow";
return "green";
}

function highlight($search,$subject,$hlstart="<font color=ff0000>",$hlend="</font>") {
//$search = str_replace("_"," ",$search);
//$alla = explode(" ",$search);
// foreach($alla as $all)
// {

$srchlen=strlen($search); // lenght of searched string
if ($srchlen==0) return $subject;
$find = $subject;
while ($find = stristr($find,$search)) { // find $search text in $subject -case insensitiv
$srchtxt = substr($find,0,$srchlen); // get new search text
$find=substr($find,$srchlen);
$subject = str_replace($srchtxt,"$hlstart$srchtxt$hlend",$subject); // highlight founded case insensitive search text
}

// break;
// }

return $subject;
}

function torrenttable($res, $req, $searchstr = "") {
global $CURUSER, $lang;

if($req==0)
{

$last_browse = $CURUSER["last_browse"];
$time_now = gmtime();
if ($last_browse > $time_now)
$last_browse=$time_now;
}
else
{

$last_browse = $CURUSER["last_reqbrowse"];
$time_now = gmtime();
if ($last_browse > $time_now)
$last_browse=$time_now;

}

?>
<table border="1" cellspacing=0 cellpadding=4 width=950>
<tr>

<?

// sorting by MarkoStamcar

$count_get = 0;

foreach ($_GET as $get_name => $get_value) {

if ($get_name != "sort" && $get_name != "type") {
if ($count_get > 0) {
$oldlink = $oldlink . "&" . $get_name . "=" . $get_value;
} else {
$oldlink = $oldlink . $get_name . "=" . $get_value;
}
$count_get++;
}

}

if ($count_get > 0) {
$oldlink = $oldlink . "&";
}

if ($_GET['sort'] == "1") {
if ($_GET['type'] == "desc") {
$link1 = "asc";
} else {
$link1 = "desc";
}
}

if ($_GET['sort'] == "2") {
if ($_GET['type'] == "desc") {
$link2 = "asc";
} else {
$link2 = "desc";
}
}

if ($_GET['sort'] == "3") {
if ($_GET['type'] == "desc") {
$link3 = "asc";
} else {
$link3 = "desc";
}
}

if ($_GET['sort'] == "4") {
if ($_GET['type'] == "desc") {
$link4 = "asc";
} else {
$link4 = "desc";
}
}

if ($_GET['sort'] == "5") {
if ($_GET['type'] == "desc") {
$link5 = "asc";
} else {
$link5 = "desc";
}
}

if ($_GET['sort'] == "6") {
if ($_GET['type'] == "desc") {
$link6 = "asc";
} else {
$link6 = "desc";
}
}

if ($_GET['sort'] == "7") {
if ($_GET['type'] == "desc") {
$link7 = "asc";
} else {
$link7 = "desc";
}
}

if ($_GET['sort'] == "8") {
if ($_GET['type'] == "desc") {
$link8 = "asc";
} else {
$link8 = "desc";
}
}

if ($_GET['sort'] == "9") {
if ($_GET['type'] == "desc") {
$link9 = "asc";
} else {
$link9 = "desc";
}
}

if ($link1 == "") { $link1 = "asc"; } // for torrent name
if ($link2 == "") { $link2 = "desc"; }
if ($link3 == "") { $link3 = "desc"; }
if ($link4 == "") { $link4 = "desc"; }
if ($link5 == "") { $link5 = "desc"; }
if ($link6 == "") { $link6 = "desc"; }
if ($link7 == "") { $link7 = "desc"; }
if ($link8 == "") { $link8 = "desc"; }
if ($link9 == "") { $link9 = "desc"; }

?>
<td class="colhead" align="center"><?=$lang[btyp]?></td>
<?

if($req == 0)
$bb = "browse.php?";
elseif($req == 2)
$bb = "lossless.php?";
else
$bb = "req.php?";

?>
<td class="colhead" align=left width=500><a href="<? print $bb.$oldlink; ?>sort=1&type=<? print $link1; ?>"><font color=#ffffff><?=$lang[bnamn]?></a></td>

<td class="colhead" align="center"><?=$lang[bdl]?></td>
<td class="colhead" align="center"><?=$lang[bbm]?></td>
<td class="colhead" align="center" width=20><a href="<? print $bb.$oldlink; ?>sort=3&type=<? print $link3; ?>"><font color=#ffffff><?=$lang[bk]?></a></td>
<td class="colhead" align="center"><a href="<? print $bb.$oldlink; ?>sort=4&type=<? print $link4; ?>"><font color=#ffffff><?=$lang[binlagd]?></a></td>
<? /* if($req == 0) { ?><td class="colhead" align="center">TTL</td><? } */ ?>
<td class="colhead" align="center"><a href="<? print $bb.$oldlink; ?>sort=5&type=<? print $link5; ?>"><font color=#ffffff><?=$lang[bstorlek]?></a></td>
<!--
<td class="colhead" align=right>Views</td>
<td class="colhead" align=right>Hits</td>
-->
<td class="colhead" align="center"><a href="<? print $bb.$oldlink; ?>sort=6&type=<? print $link6; ?>"><font color=#ffffff><?=$lang[bnerladd]?></a></td>
<td class="colhead" align="right"><a href="<? print $bb.$oldlink; ?>sort=7&type=<? print $link7; ?>"><img src="/pic/arrow_up.gif" border="0"></a></td>
<td class="colhead" align="right"><a href="<? print $bb.$oldlink; ?>sort=8&type=<? print $link8; ?>"><img src="/pic/arrow_down.gif" border="0"></a></td>
<?

print("<td class=\"colhead\" align=center>".$lang[buppladdare]."</td>\n");

print("</tr>\n");

while ($row = mysql_fetch_assoc($res)) {
$id = $row["id"];
print("<tr onMouseOver=this.style.backgroundColor=\"#ffffff\" onMouseOut=this.style.backgroundColor=\"#dcede6\" bgcolor=\"#dcede6\">\n");

print("<td align=center style='padding: 0px' width=48>");
if (isset($row["cat_name"])) {

if($req==0)
print("<a href=\"browse.php?cat=" . $row["category"] . "\">");
elseif($req == 2)
print("<a href=\"lossless.php?cat=" . $row["category"] . "\">");
else
print("<a href=\"req.php?cat=" . $row["category"] . "\">");

if (isset($row["cat_pic"]) && $row["cat_pic"] != "")
print("<img height=26 width=48 border=\"0\" src=\"/pic/" . $row["cat_pic"] . "\" alt=\"" . $row["cat_name"] . "\" />");
else
print($row["cat_name"]);
print("</a>");

}
else
print("-");
print("</td>\n");

$dispname = htmlspecialchars($row["save_as"]);
$bubbla=0;
$dispname1 = $dispname;
if(strlen($dispname) > 58){
$dispname = substr($dispname, 0, 56)."...";
$bubbla=1;
}
/*
if($CURUSER[id] == 2)
{
$dispname = $row[artist]." - ".$row[album];
}
*/

print("<td><a title=\"".$dispname1."\" href=\"details.php?");
print("id=".$id);

$dlbok = "<td align=center><a href=\"download.php?id=$row[id]\"><img src=/pic/dl.gif border=0 width=17 height=16></a></td><td align=center><a href=download.php?id=$row[id]\"><div id=\"mess".$row[id]."\"><a href=\"javascript:ajax('bm2',$row[id]);\"><img src=/pic/bok.gif border=0 width=17 height=16></a></div></td>";

if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browse)
{

print("\"><font size=2><nobr><b>".highlight($searchstr, $dispname)."</b></a> <b><font color=black size=1>(<font color=red size=1>NEW</font><font color=black size=1>)</b></nobr></td>".$dlbok);

}
else
{

print("\"><font size=2><nobr><b>".highlight($searchstr, $dispname)."</b></nobr></font></a></td>".$dlbok);

}

print("</td>\n");

// COMMENTS
if (!$row["comments"])
print("<td align=\"center\">" . $row["comments"] . "</td>\n");
else {
print("<td align=\"center\"><b><a href=\"details.php?id=$id&tocomm=1\">" . $row["comments"] . "</a></b></td>\n");

}
// ADDED
print("<td align=center><nobr>" . $row["added"] . "</nobr></td>\n");

// STORLEK
print("<td align=center>" . str_replace(" ", " ", mksize($row["size"])) . "</td>\n");

$_s = "";
if ($row["times_completed"] != 1)
$_s = "er";
print("<td align=center><nobr>" . number_format($row["times_completed"]) . " gång$_s</nobr></td>\n");

if ($row["seeders"]) {
if ($row["leechers"]) $ratio = $row["seeders"] / $row["leechers"]; else $ratio = 1;
print("<td align=right><b><a href=details.php?id=$id&dllist=1#seeders><font color=" .
get_slr_color($ratio) . ">" . $row["seeders"] . "</font></a></b></td>\n");

}
else
print("<td align=\"right\"><span class=\"" . linkcolor($row["seeders"]) . "\">" . $row["seeders"] . "</span></td>\n");

if ($row["leechers"]) {

print("<td align=right><b><a href=details.php?id=$id&dllist=1#seeders>" .
number_format($row["leechers"]) . ($peerlink ? "</a>" : "") .
"</b></td>\n");

}
else
print("<td align=\"right\">0</td>\n");

$dolt = false;

if($row["ano_owner"] == 0){
$dolt = True;
}

print("<td align=center>". ($dolt==true ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>Anonym</i>") . "</td>\n");

print("</tr>\n");
}

print("</table>\n");

// return $rows;
}

function hit_start() {
return;
global $RUNTIME_START, $RUNTIME_TIMES;
$RUNTIME_TIMES = posix_times();
$RUNTIME_START = time();
}

function hit_end() {
return;
global $RUNTIME_START, $RUNTIME_TIMES;

if (preg_match(',([^/]+)$,', $_SERVER["SCRIPT_NAME"], $matches))
$path = $matches[1];
else
$path= "(unknown)";

$tid = time() - $RUNTIME_START;
$ts = posix_times();

$cpu1 = ($ts["stime"] - $RUNTIME_TIMES["stime"]);
$cpu2 = ($ts["utime"] - $RUNTIME_TIMES["utime"]);

mysql_query("INSERT INTO loaden (page, time, cpu1, cpu2) VALUES (" . sqlesc($path) . ", $tid, $cpu1, $cpu2)");

}

function hash_pad($hash) {
return str_pad($hash, 20);
}

function hit_count() {
return;
/*
global $RUNTIME_CLAUSE;
if (preg_match(',([^/]+)$,', $_SERVER["SCRIPT_NAME"], $matches))
$path = $matches[1];
else
$path= "(unknown)";
$period = date("Y-m-d H") . ":00:00";
$RUNTIME_CLAUSE = "page = " . sqlesc($path) . " AND period = '$period'";
$update = "UPDATE hits SET count = count + 1 WHERE $RUNTIME_CLAUSE";
mysql_query($update);
if (mysql_affected_rows())
return;
$ret = mysql_query("INSERT INTO hits (page, period, count) VALUES (" . sqlesc($path) . ", '$period', 1)");
if (!$ret)
mysql_query($update);
*/
}

function hash_where($name, $hash) {
$shhash = preg_replace('/ *$/s', "", $hash);
return "($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")";
}

function get_user_icons($arr, $big = false)
{
if ($big)
{
$donorpic = "starbig.gif";
$warnedpic = "warnedbig.gif";
$disabledpic = "disabledbig.gif";
$style = "style='margin-left: 4pt'";
}
else
{
$donorpic = "star.gif";
$warnedpic = "warned.gif";
$disabledpic = "disabled.gif";
$style = "style=\"margin-left: 2pt\"";
}
$pics = $arr["donor"] == "yes" ? "<img src=/pic/$donorpic alt='Donor' border=0 $style>" : "";
if ($arr["enabled"] == "yes")
$pics .= $arr["warned"] == "yes" ? "<img src=/pic/$warnedpic alt=\"Warned\" border=0 $style>" : "";
else
$pics .= "<img src=/pic/$disabledpic alt=\"Disabled\" border=0 $style>\n";
return $pics;
}

function get_user_icons2($arr, $big = false)
{
if ($big)
{
$donorpic = "starbig.gif";
$warnedpic = "warnedbig.gif";
$disabledpic = "disabledbig.gif";
$style = "style='margin-left: 4pt'";
}
else
{
$donorpic = "star.gif";
$warnedpic = "warned.gif";
$disabledpic = "disabled.gif";
$style = "style=\"margin-left: 2pt\"";
}
//$pics = $arr["donor"] == "yes" ? "<img src=/pic/$donorpic alt='Donor' border=0 $style>" : "";
if ($arr["enabled"] == "yes")
$pics .= $arr["warned"] == "yes" ? "<img src=/pic/$warnedpic alt=\"Warned\" border=0 $style>" : "";
else
$pics .= "<img src=/pic/$disabledpic alt=\"Disabled\" border=0 $style>\n";
return $pics;
}

function tid2hrsmin($tid)
{

if($tid > 604373)
return "Obegränsad tid";

if($tid > 86339)
return "24 timmar";

if($tid<3600)
return number_format($tid/60,0)." minuter";

while($tid >= 3600){
$hrs++;
$tid-=3600;
}

$tid=($tid/60);
$tid = number_format($tid,0);
if($hrs>1)
return $hrs. " timmar";
else
return $hrs. " timme";
}

function myskohost($host) {

$lan = "za au ch fr ie ar mx hu tr it pl il jp ro nz sk fo sg cn ru uk rs de gr es";
$arr = explode(" ", $lan);

foreach($arr as $a) {
if($host == $a)
return true;
}

return false;

}

?>

här kommer login scriptet

<?php

setcookie("uid", "", 0x7fffffff, "/", ".softmp3.org");
setcookie("pass", "", 0x7fffffff, "/", ".softmp3.org");

setcookie("uid", "", 0x7fffffff, "/");
setcookie("pass", "", 0x7fffffff, "/");

header('Cache-Control: no-cache, no-store, must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: no-cache');

$ipp = $HTTP_SERVER_VARS["REMOTE_ADDR"];

require_once("include/bittorrent.php");
dbconn();

if($CURUSER)
header("Location: index.php");

stdhead("Login");

unset($returnto);
if (!empty($_GET["returnto"])) {
$returnto = $_GET["returnto"];
if (!$_GET["nowarn"]) {
print("<h1>Ej inloggad!</h1>\n");
}
}

?>
<script type="text/javascript" src="script_login.js"></script>

<form method="POST" action="hej.php" target="temp" onsubmit="LoggaIn();" name="ff">
<table border="0" cellpadding="5" width="400">
<tr><td class=rowhead>Username:</td><td align=left><input type="text" size="40" name="username" id="username" /></td></tr>
<tr><td class=rowhead>Password:</td><td align=left><input type="password" size="40" name="password" id="password" /></td></tr>

<!--<tr><td class="rowhead">Picture:</td><td align=left><input type="code" size="40" maxlength="4" name="code" id="code" /></td></tr>
<tr><td colspan="2" align="center" height="65"><div id="bildkod"></div></td>-->
<tr><td colspan="2" align="center"><input type="submit" value="Login!" id="loggain"></td></tr>

</table>
</form>

<p><a href="recover.php">Forgot password?</a></p>
<div id="statusruta" style="opacity: 0; width: 380px; background-color: #ebaaaa; color: #000000; padding: 10px; display: none;" valign="center" align="center"></div>

<br><br>

<iframe src="hej.php" id="temp" name="temp" style="display:none"></iframe>

<script type="text/javascript">
document.ff.username.focus();
</script>

<?

stdfoot();

hit_end();

?>

hoppas du hittar felet på specifika rader i scripten som skickade i mitt första inlägg

ifråga bara. måste jag lägga in den adressen jag ska ha till sidan sen i alla scripts där det står softmp3.org i scripten ?

mvh/huopna

huopna

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Jul 2008

Haha, han posta allt

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Okt 2004

Jäklar vad mycket kod...ska se om jag har tid o kika på det ikväll, är på jobbet nu. Det är ju inte helt enkelt att bara ta någon annans kod och försöka få den att fungera, kan du nån PHP alls själv?

Har inte kollat runt så mycket, men det kan nog vara en god idé att ändra till din adress istället för softmp3.org!

Q6600 @ 3.2GHz | 2*4 Corsair XMS2 5-5-5-12 @ 1003 | Club3D HD4850 | Asus P5Q Pro

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Feb 2005

Prova lägg till session_start(); högst upp

<?php session_start(); require "global.php";

i7 920 | 12GB DDR3 | GTX 480 | GA-X58A-UD7 | 160GB SSD X25-M G2 | 1TB F3 HD103SJ | W7 64-bit | Mac Mini
Webb: bluekitestudios.com

Trädvy Permalänk
Medlem
Plats
smedjebacken
Registrerad
Maj 2006

Hjälp mig med min hemsida

Save: ska jag lägga in det i början på dom scripten jag posta på båda 2 asså ?

huopna

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Feb 2005
Citat:

Ursprungligen inskrivet av huopna
Save: ska jag lägga in det i början på dom scripten jag posta på båda 2 asså ?

Japp, du måste ha med den för att den ska öppna sessionen och kunna använda sessions-variablerna.

i7 920 | 12GB DDR3 | GTX 480 | GA-X58A-UD7 | 160GB SSD X25-M G2 | 1TB F3 HD103SJ | W7 64-bit | Mac Mini
Webb: bluekitestudios.com

Trädvy Permalänk
Medlem
Plats
smedjebacken
Registrerad
Maj 2006

fick ett nytt fel meddelande nu detta.

Notice: A session had already been started - ignoring session_start() in C:\wamp\www\include\global.php on line 2

Fatal error: Cannot redeclare get_row_count() (previously declared in C:\wamp\www\include\global.php:220) in C:\wamp\www\include\global.php on line 227

huopna