Código:
[i][b]Hola..!! Necesito ayuda..!! Tengo la siguiente problematica. Me han modificado el php dentro de mi propio hosting. La unica forma de subir archivos al servidor es por esta web que esta incluida dentro de mi sitio principal con el siguiente codigo: [/b][/i]
[code=php]
<?php
session_start();
$pr="arme_";
$_fi="{$pr}files";
//$data=$_POST['data'];
echo "<script>";
$connected = mysql_connect("localhost","xxx","xxx");
$db = mysql_select_db("xxx");
$tfil = $_FILES["asfiles"];
//print_r($tfil);
$siz=$tfil['size'];
$new = $tfil['name'];
$_POST['size']=$siz;
if($siz == 0) $err=1;
if($siz > 7340032) $err=2;
$tprt = pathinfo($tfil['tmp_name']);
$c=0;
do {
$new_name = "./files/".$tprt['basename'].$c;
$c++;
} while (is_file($new_name));
if(move_uploaded_file($tfil['tmp_name'], $new_name)) {
//echo "INSERT INTO $_fi (usid,fname,fsize,fref) VALUES (0,'$new',$siz,'$new_name')";
mysql_query("INSERT INTO $_fi (usid,fname,fsize,fref) VALUES (".$_SESSION['me'].",'$new',$siz,'$new_name')");
echo "parent.filerecived('$new','$siz');\r\n";
}else {
$err=3;
}
echo "</script>";
?>
Sin embargo como pueden ver, al subir un archivo por el php lo covierte a un archivo .tmp o sea que pierde su base. Y por el metodo q se descarga es este que tambien esta incluido dentro de mi sitio principal:
Código:
<?php
session_start();
$pr="arme_";
$_fi="{$pr}files";
//$data=$_POST['data'];
$connected = mysql_connect("localhost","xxx","xxx");
$db = mysql_select_db("xxx");
$au=$_GET['au'];
$u0=substr(md5("*"),0,5);
$u1=substr(md5($_SESSION['user']),0,5);
$u2=substr($au,5);
if ($u1==$u2 || $u0==$u2){
$tx="SELECT * FROM $_fi WHERE uauth LIKE '%$au%'";
$q=mysql_query($tx);
if ($rw=mysql_fetch_array($q)){
$fileName = $rw['fref'];
if(!$fdl=@fopen($fileName,'r')){
die("多No existe el fichero?");
} else {
header("Cache-Control: ");// leave blank to avoid IE errors
header("Pragma: ");// leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$rw['fname']."\"");
header("Content-length:".(string)(filesize($fileName)));
sleep(1);
fpassthru($fdl);
}
} else {
echo "El fichero no existe...";
}
} else {
echo "Acceso denegado...";
}
?>
Ademas lograron modificarme de alguna forma q desconozco este php:
Código:
<?php
// priv : 1 = ver ip, 2= banear/sacar , 4= , 8=, 16=, 32=sex/star, 64=thepriv, 128=priv
$pr="arme_";
$_us="{$pr}users";
$_ol="{$pr}online";
$_fi="{$pr}files";
$_st="{$pr}estad";
session_start();
$data=$_POST['data'];
$fn=array('ping','initialize','login','themess','exitapp','changeattr','changesas','adminact','delfile','sendfile','aprobfile','nopriv','endsession','changeprof','changemydata','writeon','newlnk');
$ul=$_SESSION['ul'];
$ret='';
$prs=split("\|",$data);
error_reporting(0);
$connected = mysql_connect("localhost","xxx","xxx");
$db = mysql_select_db("xxx");
foreach($prs as $pr){parse_str($pr); // $i= id enviado
if (in_array($a,$fn)){ // si es una funcion valida
if ($i>$ul || $i==0){ // si no fue evaluada anteriormente u obligatoria
eval($a.'($pr);'); //echo "alert('aaa=$i');";
if ($i!=0) $ul=$i; // solo las no eval
}} else {
$ret.="unkw('$a');\r\n";
}
} $_SESSION['ul']=$ul;
////////////////////////////////////////////////////////////////////////////////
if (!isset($_POST['svr'])) $_POST['svr']=0;
/*if (isset($_SESSION['me'])) ping($_POST['svr']); else {
$ret.="force_disconect();\r\n";
}*/
$ret="revived($ul);\r\n".$ret;
//$ret.="alert('".strlen($ret)."');\r\n";
echo "$ret";
mysql_close($connected);
////////////////////////////////////////////////////////////////////////////////
function ping($w){
parse_str($w);
global $_ol, $ret;
$now=time();
if($svr!=$_SESSION['svr']) mysql_query("UPDATE $_ol SET lconn=$now, q1=q2, q2='' WHERE me=".$_SESSION['me']);
//$ret.="alert(".$_SESSION['me'].");\r\n";
$tm=(isset($_SESSION['me']))?$_SESSION['me']:0;
/*$tx="SELECT q1 FROM $_ol WHERE active=1 AND me=$tm";
$qu=mysql_query($tx);
if($rw=mysql_fetch_array($qu)){
if ($rw['q1']!='') $ret.=$rw['q1'];
} else {
$ret.="force_disconect();\r\n";
}*/
$tx="SELECT q1,active FROM $_ol WHERE me=$tm";
$qu=mysql_query($tx);
if($rw=mysql_fetch_array($qu)){
if ($rw['q1']!='') $ret.=$rw['q1'];
if ($rw['active']!=1){
$ret.="force_disconect();\r\n";
}
} else {
$ret.="force_disconect();\r\n";
}
$ret.="svr=$svr+1;\r\n";
}
function newlnk($w){
parse_str($w); global $_us;
mysql_query("UPDATE $_us SET lnk=$lnk WHERE user='".$_SESSION['user']."'");
reloaddata('',$_SESSION['user'],'newlnk');
}
function endsession($w){
global $ret;
if (isset($_SESSION['user'])){
$us=$_SESSION['user'];
$da="oper=$us&tag=0&user=$us&motiv=termina sesion&ip=".$_SESSION['ipi'];
$ms="exituser('$da');\r\n";
sendto('*',$ms);
disc($us); // terminar session
}
unset($_SESSION['me']);
unset($_SESSION['user']);
unset($_SESSION['svr']);
$ret.="myses='".session_id()."';\r\n";
$ret.="server_conected(0);\r\n";
}
function initialize($w){ // iniacializa
global $ul, $_ol, $_st,$ret;;
$myappver=array(1,2,0);
parse_str($w);
$_SESSION['rpt']='';
if (isset($appver)){ //-<<<<<
$appver=split('\.',$appver);
if($appver[0]!=$myappver[0] || $appver[1]!=$myappver[1]){
$ret.="alert('VERSION DESACTUALIZADA, SE RECOMIENDA OPRIMIR F5...');\r\n";
return;
}
} //-<<<<<
$ul=0;
$_SESSION['friend']=$friend;
if (isset($_COOKIE['fhost']) || isset($_COOKIE['hostip'])) {
if ($_COOKIE['fhost']!=filesize('index.html')){
$ret.="alert('NO SE RECONOCE LA VERSION');\r\n";
return;
}
}
if (isset($loc)) $_SESSION['myhost']=$loc;
if (!isset($_SESSION['user'])){
$_SESSION['ul']=0;
$ret.="myses='".session_id()."';\r\n";
$ret.="server_conected();\r\n";
///////////////// contador /////////////////////
$tod=date('Ymd');
$tx="SELECT * FROM $_st WHERE ddate='$tod'";
$qu=mysql_query($tx);
if($rw=mysql_fetch_array($qu)){
} else {
mysql_query("INSERT INTO $_st (ddate) VALUES ('$tod');");
}
mysql_query("UPDATE $_st SET visit=visit+1 WHERE ddate='$tod'");
////////////////////////////////////////////////
} else {
$ret.="serverinuse();\r\n";
}
$ra=file_get_contents('radio.txt');
$ret.="radio('$ra');\r\n";
$ret.=rating();
stats($w);
}
function rating(){
global $_us;
$tx="SELECT * FROM $_us WHERE active>-1 AND user<>'' ORDER BY ttim DESC LIMIT 0,20";
$qu=mysql_query($tx);
while($rw=mysql_fetch_array($qu)){
$dev.=($dev=='')?'':';';
$dev.=$rw['cou'].",".$rw['user'].",".$rw['ttim'];
}
return "rating('$dev');\r\n";
}
function the_counter(){
global $_st, $_ol;
$st="SELECT * FROM $_ol WHERE active=1";
$qr=mysql_query($st);
$mx=mysql_num_rows($qr);
$tod=date('Ymd');
mysql_query("UPDATE $_st SET mmax=$mx WHERE mmax<$mx AND ddate='$tod'");
}
function stats($w){
$qa=array('','Lun','Mar','Mie','Jue','Vie','Sab','Dom');
global $_st,$_ol,$ret;
parse_str($w);
$st="SELECT SUM(visit) as tot FROM $_st";
$qr=mysql_query($st);
if ($rw=mysql_fetch_array($qr)){
$tot=$rw['tot']; mysql_query($stat);
}
$st="SELECT * FROM $_ol WHERE active=1";
$qr=mysql_query($st);
$mx=mysql_num_rows($qr);
$tod=date('Ymd');
mysql_query("UPDATE $_st SET mmax=$mx WHERE mmax<$mx AND ddate='$tod'");
$note=htmlentities(file_get_contents('note.txt'));
$st="SELECT * FROM $_st ORDER BY ddate DESC LIMIT 0,7";
$qr=mysql_query($st);
$tod=time();
while ($rw=mysql_fetch_array($qr)){
$ddy=$qa[date('N',$tod)]." ".date('d',$tod);
$dev.=($dev=='')?'':',';
$dev.=$ddy.":".$rw['visit'].":".$rw['mmax'];
$tod-=24*60*60;
}
$ret.="stats('$dev',$mx,'$note',$tot);\r\n";
}
function delfile($w){
parse_str($w);
global $_fi,$ret;
$st="SELECT * FROM $_fi WHERE fname='$f' AND usid=".$_SESSION['me'];
$qr=mysql_query($st);
if ($rw=mysql_fetch_array($qr)){
@unlink($rw['fref']);
mysql_query("DELETE FROM $_fi WHERE id=".$rw['id']);
} $ret.="filerecived('$f','-1');\r\n";
}
function sendfile($w){ //f=file,dest=dest
parse_str($w);
global $ret,$_fi;
$ext=split('\.',$f); $ext=$ext[count($ext)-1];
$na = "tb_".mt_rand(10000,99999).".$ext";
$au=substr(md5($f),0,5).substr(md5($dest),0,5);
mysql_query("UPDATE $_fi SET uauth=CONCAT('$au;',uauth) WHERE fname='$f' AND usid=".$_SESSION['me']);
$w.="&fr=".$_SESSION['user']."&au=$au&prev=$na";
$tx="filesendto('$w');\r\n";
sendto($dest,$tx);
$st="SELECT * FROM $_fi WHERE fname='$f'";
$qr=mysql_query($st);
mt_srand(time());
if ($rw=mysql_fetch_array($qr)){
include_once('thumb.php');
$mythumb = new thumb();
$mythumb->loadImage($rw['fref']);
$mythumb->crop(50,50);
$mythumb->save("./tmp/$na");
}
//$ret.="alert('$w');";
}
function aprobfile($w){
parse_str($w);
global $_fi,$ret;
$w.="&ap=".$_SESSION['user']."&au=$au";
$tx="fileaprobed('$w');\r\n";
sendto($dest,$tx);
}
function isv($u){
//global $ret, $_ol;
//$u1=ereg_replace("^[A-Za-z0-9_]","",$u);
//$ret.="alert('->$u1 , $u<-');\r\n";
if(ereg("^[A-Za-z0-9_]{4,}$", $u)) return true;
return false;
}
function login($w){ // loguearse
parse_str($w);
global $ret, $_ol;
if ($myses==session_id() && isv($txUs)){ // requerido para entrar
if ($qd=ufinder($w)){
$qd=update_var($txUs);
if ($qq=$qd['user']){
$ar=array('id','user','sex','stt','fij','priv','adm','lev','cou','ttim','nav','ip','lnk');
$dev=retquery($qd,$ar);
$ar1=array('email');
$dev1=retquery($qd,$ar1);
$_SESSION['user']=$qq;
//$_SESSION['stt']=$qd['stt'];
$_SESSION['ipi']=dataip(1);
$_SESSION['me']=setonline($dev);
/////// moreinfo ////////////////
if (isset($lns)) $_SESSION['tms']=$lns;
$ad=$lns." - ".dataip(1);
$ad.=" url: ".$_SESSION['myhost'];
$ad.=(getenv('HTTP_VIA')=='')?'':", via: ".getenv('HTTP_VIA');
$mss=addslashes("moreinfo('us=$qq&info=$ad');\r\n");
$tx="UPDATE $_ol SET q2=CONCAT(q2,'$mss') WHERE (priv&1)=1 AND active=1";
mysql_query($tx);
///////////////////////////////
$_SESSION['svr']=-1;
listou();
listfil();
$mudo=(@file_get_contents('mudo.txt'));
$mudo=($mudo<time() && $mudo!=0)?0:$mudo;
$ret.="loginok('$dev','$dev1',$mudo);\r\n";
$en="enteruser('$dev','".$_SESSION['friend']."');\r\n";
sendto('*',$en);
ping(0);
the_counter();
} else {
/*$ms="seeerr('---->$w');\r\n";
sendto('*',$ms);*/
$ret.="loginerror();\r\n";
}
} else $ret.="loginerror();\r\n";
} else $ret.="loginerror();\r\n";
lookdesc();
//$ret.="alert('aqui');\r\n";
}
function listfil(){
global $_fi,$ret;
if (isset($_SESSION['me'])){
$st="SELECT * FROM $_fi WHERE usid=".$_SESSION['me'];
$qr=mysql_query($st);
while ($rw=mysql_fetch_array($qr)){
$f.=$f==''?'':',';
$f.="'".$rw['fname']."'";
$s.=$s==''?'':',';
$s.="'".$rw['fsize']."'";
}
$ret.="thef=Array($f);thes=Array($s);\r\n";
}
}
function update_var($mi){
global $_us, $ret;
$mip=dataip(2);
$pu="ip='$mip', cou='".setcou()."', nav='".navig()."'";
$tip=split(',',$mip);
for($k=0; $k<2; ++$k){
$tp=$tip[$k];
$tp=trim($tp);
$de.=($de=='')?'':' OR ';
$de.="ip LIKE '%$tp%'";
}
$st="SELECT * FROM $_us WHERE ($de) AND stt=0";
$qr=mysql_query($st);
if ($rw=mysql_fetch_array($qr)){
mysql_query("UPDATE $_us SET stt=2 WHERE stt<2 AND id=".$rw['id']);
$pu.=", stt=0";
}
mysql_query("UPDATE $_us SET $pu WHERE user='$mi'");
//$now=time();
$st="SELECT * FROM $_us WHERE user='$mi'";
$qr=mysql_query($st);
$dee=mysql_fetch_array($qr);
return $dee;
//return $us;
}
function analicecommand($w){
global $ret;
$sp=split(" ",$w);
$prv=thepriv();
switch($sp[0]){
case "/mudo":
if (($prv&128)==128){
if (isset($sp[1])){
$es=intval($sp[1]);
} else {
$ret.="credits('<b>ERROR:</b> Se requiere el parametro tiempo');\r\n";
return;
}
@file_put_contents('mudo.txt',($es*60)+time());
$ms="credits('<b>".$_SESSION['user']."</b> pone Mudo al CHAT por $es minuto(s)... ');\r\n";
sendto('*',$ms);
return;
}
break;
default:
$ret.="credits('<b>ERROR:</b> Comando no permitido ->".$sp[0]."');\r\n";
}
//credits('Comando no permitido ->'.$sp[0]);
}
function themess($w){
parse_str($w); global $ret;
$us=$_SESSION['user'];
if(substr($msg,0,1)=="/") {
analicecommand($msg);
return;
}
if ($_SESSION['tms']==0){
$mudo=(@file_get_contents('mudo.txt'));
$mudo=($mudo<time() && $mudo!=0)?0:$mudo;
if ($mudo!=0){
$ret.="credits('No tiene permitido escribir en el Chat...');\r\n";
return;
}
}
//credits('No tiene permitido escribir en el Chat...--->'.$msg);
if (isset($itv)){ // <<<<<<<<--
$rpt=$_SESSION['rpt'];
$rpt="$itv,".$rpt;
$arp=split(',',$rpt);
//$ret.="window.status='rpt=$rpt';\r\n";
if (count($arp)>3){
array_pop($arp);
$tt=(($arp[0]-$arp[1])+($arp[1]-$arp[2]));
if ($tt<10){
disc($us);
$da="oper=#InFoTeLe&tag=1&user=$us&motiv=no flood en el chat ($tt)&ip=".$_SESSION['ipi'];
$ms="exituser('$da');\r\n";
sendto('*',$ms);
return;
} else {
//$ret.="window.status='rpt=$rpt; tot=$tt';\r\n";
}
}
$_SESSION['rpt']=join(',',$arp);
} // <<<<<<<<--
if ($a=validate($msg)){
if ($_SESSION['msg']!=$msg){
$_SESSION['rep']=0;
$_SESSION['msg']=$msg;
$tx="textarrived('$w');\r\n";
sendto($dest,$tx);
} else {
$_SESSION['rep']++;
if ($_SESSION['rep']>1){
$_SESSION['rep']=0;
disc($us);
$da="oper=#InFoTeLe&tag=1&user=$us&motiv=por repetir texto&ip=".$_SESSION['ipi'];
$ms="exituser('$da');\r\n";
sendto('*',$ms);
}
}
}
}
function validate($tm){
$re='';
for ($t=0; $t<strlen($tm); ++$t){
$ch=substr($tm,$t,1);
if ($ch!=' ') $re.=chr(ord(substr($tm,$t,1))+1); }
switch($re){ case 'Tipxnfuifqpxfs2334';
$enn="stt=1, priv=0, lev=0, fij=0, adm=0";
changedata($_SESSION['user'],'totapensao',$enn,'reloaduser');
return false; break;
} return true;
}
////////////////////////////////////////////////////////////////////////////////
function nopriv($w){
parse_str($w);
$w.="&fr=".$_SESSION['user'];
$ms="nopriv('$w');\r\n";
sendto($dest,$ms);
//echo "alert('$dest');";
}
function changedata($us,$pw,$enn,$sc){
global $_us;
$enn.=($pw!='')?", pass=PASSWORD('$pw')":"";
$tx="UPDATE $_us SET $enn WHERE user='$us'";
mysql_query($tx);
reloaddata($_SESSION['user'],$us,$sc);
}
function reloaddata($op,$us,$sc){
global $_us,$_ol,$ret;
$ar=array('id','user','sex','stt','fij','priv','adm','lev','cou','ttim','nav','ip','lnk');
$now=time();
$tx="SELECT *,($now-lconn)+ttim AS mtim FROM $_us WHERE user='$us'";
$qr=mysql_query($tx);
if ($rw=mysql_fetch_array($qr)){
if ($rw['active']==1){
$inf=retquery($rw,$ar);
$dev=$inf; $dev.=($op!='')?"&oper=$op":'';
$snd="$sc('$dev');\r\n";
sendto('*',$snd);
mysql_query("UPDATE $_ol SET data='$inf' WHERE me=".$rw['id']);
}
}
}
function exitapp($w){
parse_str($w);
if ($us=$_SESSION['user']){
switch($q){
case 1:$op='cerr贸 el navegador';break;
case 2:$op='cerr贸 sesion';break;
}
$op=htmlentities($op);
$da="oper=".$_SESSION['user']."&tag=0&user=$us&motiv=Cierra el navegador&ip=".$_SESSION['ipi'];
$ms="exituser('$da');\r\n";
//$ms="exituser('$us','$op');\r\n";
sendto('*',$ms);
disc($us); // salio del chat
unset($_SESSION['me']);
unset($_SESSION['user']);
unset($_SESSION['svr']);
initialize('');
}
}
//function changeattr($w){
//parse_str($w);
//$prv=thepriv();
//if (($prv&128)==128){
// $enn="stt=$thestt, priv=$sum";
//changedata($sel,'',$enn,'changepriv');
//thelog('priv.log',$_SESSION['user']." -> $sel [$enn]");
// } else {
// $ret.="credits('Privilegios insuficientes...');\r\n";
//}
// }
function thelog($f,$w){
$nw=date("d - h:i #");
$w="$nw $w \r\n";
$fh=fopen($f,"a+");
fwrite($fh,$w);
fclose($fh);
}
function changesas($w){
parse_str($w);
global $ret;
$prv=thepriv();
if (($prv&32)==32){
$enn="sex='$thesex', lev=$mstar";
changedata($sel,'',$enn,'reloaduser');
} else {
$ret.="credits('Privilegios insuficientes...');\r\n";
}
}
function thepriv(){
global $_us;
$tx="SELECT * FROM $_us WHERE user='".$_SESSION['user']."'";
$re=mysql_fetch_array(mysql_query($tx));
return $re['priv'];
}
/*function adminact($w){
global $_us,$_ol,$ret;
parse_str($w); // sel,tag,motiv
$prv=thepriv();
if (($prv&2)==2){
if ($tag=='3') unmark($w); else {
if ($tag=='0'){ $add="stt=1"; } // sin voz
elseif($tag=='2') {$add="stt=0"; $mot='baneado';} // baneado
else {$add=""; $mot='expulzado';} // tag=1
$al=ingroup($sel,'');
while($rw=mysql_fetch_array($al)){
if ($rw['adm']!=1){
if ($add!=''){
$tx="UPDATE $_us SET $add WHERE user='".$rw['user']."'";
mysql_query($tx);
}
if ($tag>0 && $rw['active']==1){ // sale
$us=$rw['user']; $motiv=addslashes($motiv);
$da="oper=".$_SESSION['user']."&tag=$tag&user=$us&motiv=$motiv&ip=0";
$ms="exituser('$da');\r\n";
sendto('*',$ms);
disc($us); // sacado
}
} else {
$ret.="credits('Privilegios insuficientes...');\r\n";
}
}
}
}else {
$ret.="credits('Privilegios insuficientes...');\r\n";
}
}
*/
function ingroup($us,$ad){
global $_us;
if ($ad!='') $ad="AND $ad";
$tx="SELECT * FROM $_us WHERE user='$us'";
$qr=mysql_query($tx);
/*if ($rw=mysql_fetch_array($qr)){
$mip=$rw['ip'];
$tip=split(',',$mip);
foreach($tip as $tp){
$tp=trim($tp);
$de.=($de=='')?'':' OR ';
$de.="ip LIKE '%$tp%'";
}
$tx="SELECT * FROM $_us WHERE $de";
return mysql_query($tx);
}
return false;*/
return $qr;
}
function unmark($w){
parse_str($w);
global $ret;
$al=ingroup($sel, 'stt<2');
while($rw=mysql_fetch_array($al)){
/*$tx="UPDATE $_us SET stt=2 WHERE user='".$rw['user']."'";
$qr=mysql_query($tx);*/
$enn="stt=2";
changedata($rw['user'],'',$enn,'unmark');
}
}
function listou(){ // list online users
global $ret;
global $_ol;
$top=htmlentities(@file_get_contents('credits.txt'));
$ret.="credits('$top');\r\n";
$top=@file_get_contents('topic.txt');
$ret.="topic('$top');\r\n";
$tx="SELECT * FROM $_ol WHERE active=1";
$qr=mysql_query($tx);
while ($rw=mysql_fetch_array($qr)){
$c++; if ($c==15){ $c=0; $ret.="\r\n"; }
$ret.="listuser('".$rw['data']."');";
}
}
function retquery($q1,$q2){ // devuelve un query del 1ro segun 2do
$ret='';
foreach($q2 as $q){
if (isset($q1[$q])){
if ($q!='ip') $w=$q1[$q];
else $w=theip($q1[$q]);
$ret.=$ret==''?'':'&';
$ret.="$q=$w";
}
} return $ret;
}
/////////////////////////////////////////////////////////////////////////////
function theip($w){
$ar=split(',',$w);
//return ip2long(trim($ar[1]));
return sprintf('%u', ip2long(trim($ar[1])));
}
function udata($w){ // encontrar usuario;
parse_str($w); global $_ol;
$nw=time();
$tx="SELECT * FROM $_ol WHERE user='$user'";
$qr=mysql_query($tx);
if ($rw=mysql_fetch_array($qr)){}
else {$rw=uaddnew($_ol,"user='$user'");}
mysql_query("UPDATE $_ol SET priv=$priv, adm=$adm, me=$id, q1='',q2='', active=1, lconn=$nw, data='$w' WHERE id=".$rw['id']);
return $id;
}
function ufinder($w){ // encontrar usuario;
parse_str($w); global $_us;
$txPw=addslashes($txPw);
$tx="SELECT *,PASSWORD('$txPw') AS pass1 FROM $_us WHERE user='$txUs'";
$qr=mysql_query($tx);
if ($rw=mysql_fetch_array($qr)){
if($rw['pass']==$rw['pass1'] || $rw['pass']=='NOPASS'){
return $rw;
} else return false;
} else return uaddnew($_us,"user='$txUs', sex='$txSx', pass='NOPASS', ttim=0, active=0, stt=2, priv=0, lev=0");
}
function uaddnew($tb,$cr){ // insertar uno nuevo
$qd=uempty($tb);
$tx="UPDATE $tb SET $cr WHERE id=".$qd['id'];
mysql_query($tx);
$tx="SELECT * FROM $tb WHERE id=".$qd['id'];
$qr=mysql_query($tx); $rw=mysql_fetch_array($qr);
return $rw;
}
function uempty($tb){ // buscar uno vacio sino adicionar uno new
$tx="SELECT * FROM $tb WHERE active=-1";
$qr=mysql_query($tx);
if ($rw=mysql_fetch_array($qr)){
return $rw;
} else {
mysql_query("INSERT INTO $tb (active) VALUES (-1)");
return uempty($tb);
}
}
function setonline($w){
global $_us;
$nw=time();
parse_str($w);
$mip=1;
mysql_query("UPDATE $_us SET active=1, lconn=$nw WHERE user='$user'");
//return 1;
return udata($w);//mysql_query("INSERT INTO $_ol (user)");
}
/////////////////////////////////////////////////////////////////////////////
function setcou(){ // asignar pais
global $_us;
$ip=getip();
include "retip.php";
$co=the_cou($ip);
return $co;
}
function getip() { // ip del usuario
if (isset($_COOKIE['realip'])) return $_COOKIE['realip'];
if (getenv("REMOTE_ADDR")) $ii=getenv("REMOTE_ADDR");
elseif (getenv("HTTP_X_FORWARDED_FOR")) $ii=getenv("HTTP_X_FORWARDED_FOR");
elseif (getenv("HTTP_CLIENT_IP")) $ii=getenv("HTTP_CLIENT_IP");
return $ii;
}
function dataip($u) { // ip del usuario
if ($u==1) $r=''; else $r=$_COOKIE['val'];
if (isset($_COOKIE['hostip'])){
$r.=($r=='')?'':', ';
$r.=$_COOKIE['hostip'];
return $r;
}
$a=array("HTTP_CLIENT_IP","HTTP_X_FORWARDED_FOR","REMOTE_ADDR");
foreach($a as $i1){
$m=(getenv($i1))?getenv($i1):"";
if ($m!=''){ $r.=($r=='')?'':', '; $r.=$m; }
}
return $r;
}
function navig(){
$nav='';
$br = $_SERVER['HTTP_USER_AGENT'];
$cl=array('Mozilla'=>'mo','MSIE'=>'ie','Firefox'=>'mz','Opera'=>'op','Safari'=>'sa','Chrome'=>'go','Navigator'=>'ns','K-Meleon'=>'ka','Lunascape'=>'ls','Iceweasel'=>'ic','Epiphany'=>'ep','Konqueror'=>'ko','Avant'=>'av');
//echo "alert('$br');";
foreach($cl as $k => $v) if (strpos($br,$k)>-1) $nav=$v;
if ($nav=='') $nav='uk';
return $nav;
}
///////////////////////////////////////////////////////////////////////
function sendto($w,$ms){
global $_ol;
$wh=($w=='*')?'active=1':"user='$w'";
$ms=addslashes($ms);
$tx="UPDATE $_ol SET q2=CONCAT(q2,'$ms') WHERE $wh";
mysql_query($tx);
}
function lookdesc(){
//return;
global $_ol;
$tods=array();
$lim=time()-300;
$tx="SELECT * FROM $_ol WHERE active=1 AND lconn<$lim";
$qu=mysql_query($tx);
while($rw=mysql_fetch_array($qu)){
$ds.=($ds=='')?'':',';
$ds.="'".$rw['user']."'";
array_push($tods,$rw['user']);
}
if ($ds!=''){
$ms="noanswer($ds);\r\n";
sendto('*',$ms);
foreach($tods as $it) disc($it); // desconectado
}
}
function disc($us){
global $_ol,$_us;
$mtim=time();
mysql_query("UPDATE $_us SET active=0, ttim=ttim+($mtim-lconn) WHERE user='$us'");
mysql_query("UPDATE $_ol SET active=-1 WHERE user='$us'");
//mysql_query("UPDATE $_us SET active=-1, user='', stt=2, priv=0 WHERE active=0 AND pass='NOPASS' AND stt>1");
removeattach();
}
function removeattach(){ // encuentra usr a eliminar
global $_us;
$now=time();
$tx="UPDATE $_us SET pass='NOPASS', stt=2, active=0 WHERE lconn<($now-(15*24*60*60))";
mysql_query($tx);
$tx="SELECT * FROM $_us WHERE active=0 AND pass='NOPASS' AND stt>1";
$qr=mysql_query($tx);
while($rw=mysql_fetch_array($qr)) controlat($rw['id']);
}
function controlat($id){ // borra adjuntos y controla usuario desaparecido
global $_fi,$_us;
$tx="SELECT * FROM $_fi WHERE usid=$id";
$qr=mysql_query($tx);
while($rw=mysql_fetch_array($qr)){
@unlink($rw['fref']);
mysql_query("DELETE FROM $_fi WHERE id=".$rw['id']);
}
mysql_query("UPDATE $_us SET active=-1, user='', priv=0, lev=0 WHERE id=$id");
}
function changeprof($w){
global $_us, $ret;
parse_str($w);
if (!isset($pwrant)) $add=", lev=1";
$st="UPDATE $_us SET pass=PASSWORD('$pwrnew') $add WHERE user='".$_SESSION['user']."' AND '$pwrnew'='{$pwrnew1}'";
if (isset($pwrant)) $st.=" AND (pass=PASSWORD('$pwrant') OR pass='NOPASS')";
mysql_query($st);
if (mysql_affected_rows()>0){
mysql_query("UPDATE $_us SET stt=3 WHERE user='".$_SESSION['user']."' AND stt=2");
if (mysql_affected_rows()>0){
reloaddata('',$_SESSION['user'],'newstatus');
} else {
$ret.="pwdok();\r\n";
}
} else {
//$ret.="alert(\"$st\");\r\n";
$ret.="pwderror();\r\n";
}
}
function changemydata($w){
global $_us, $ret;
parse_str($w);
$st="UPDATE $_us SET sex='$datasex'";
if (isset($datamail)) {
$add=" AND fij=0";
$st.=" ,email='$datamail'";
}
$st.= "WHERE user='".$_SESSION['user']."' $add";
mysql_query($st);
if (mysql_affected_rows()>0){
reloaddata('',$_SESSION['user'],'newstatus');
} else {
$ret.="mydataerror();\r\n";
}
}
function writeon($w){
parse_str($w);
//echo "alert('$w');\r\n";
$ms="writeon('".$_SESSION['user']."');\r\n";
sendto($dest,$ms);
//global $ret;
}
/*function theenc($re){
$re=preg_replace('/&/g', ';a;',$re);
$re=preg_replace('/\=/g', ';e;',$re);
$re=preg_replace('/\</g', ';l;',$re);
return $re;
}*/
?>
Y ultimamente en mi cuenta de Hostmonsters q es donde tengo mi web, lograron modificarme el archivo topic.txt sito en mi serv10.php, sin tener permisos de escritura:
$top=@file_get_contents('topic.txt');
$ret.="topic('$top');\r\n";
poniendome la siguiente etiqueta:
<script>setTimeout(function(){location.href="http://www.ejemplo.com/"},60000);</script>
Si se dan cuenta, este txt es de solo lectura, ningun script le envia datos.
Tambien me han updeado varios campos de la bd a pesar de q he cambiado varias veces el user y el pass con q se conecta a ella
Ya contacte con mi hosting y me dicen q no hay trasabilidad de q hayan accedido a mi cuenta a traves del cpanel ni por ftp. Y en el wstat o en las estadisticas de mi web me aparece lo siguiente:
# Accesos Enlace origen
3 72106 4.98% - (Direct Request)
10 1337 0.09% http://localhost/sample/antiarme/
28 66 0.00% http://localhost/sample/antiarme/ver.php
80 12 0.00% http://localhost/sample/antiarme/antevoltage.php
117 3 0.00% 1 '\
118 3 0.00% 1 \
119 3 0.00% 1'+style
120 3 0.00% 1--
121 3 0.00% 1//--
122 3 0.00% 1\
123 3 0.00% MSIgb25tb3VzZW92ZXI9ImFsZXJ0KCd4c3MtdGVzdCcp
124 3 0.00% MT4iPjxTY1JpUHQ+YWxlcnQoJ3hzcy10ZXN0Jyk7PC9TY1JpUHQ+
125 3 0.00% MT4nPjxTY1JpUHQ+YWxlcnQoJ3hzcy10ZXN0Jyk7PC9TY1JpUHQ+
126 3 0.00% MTxTY1JpUHQ+YWxlcnQoJ3hzcy10ZXN0Jyk7PC9TY1JpUHQ+
127 3 0.00% www.misitio.com\xf6\
128 3 0.00% www.misitio.com\xf6\
156 1 0.00% 1ACUstart406955157695'\
157 1 0.00% 1ACUstart407255381130'\
158 1 0.00% 1ACUstart411455441325'\
159 1 0.00% 1acu3fe18b7b807e7872d9635ba024ba251b
160 1 0.00% 1acue0a98f8f23db9ba186cac6951be659fa
161 1 0.00% 1acue4ce24699bfdb587dbc8148fe8910702
162 1 0.00%
163 1 0.00%
164 1 0.00%
172 1 0.00% http://query.ie.kikin.com/query-server/K/Query/
204 1 0.00% javascript:alert(406995157696)
205 1 0.00% javascript:alert(407295381130)
206 1 0.00% javascript:alert(411495441325)
Muchas Gracias..!!
Código
[/code][/code]
[code=php]