Ahhhhh Having problems with TE page rotator script.

Discussion in 'HTML & Website Design' started by John Guanzon, Dec 21, 2006.

  1. #1
    Here is the code:

    
    
    <?php 
    } 
    if($action == "surf"){ 
    $user = file("g_file.dat"); 
    $nouveau_compteur=fopen("u_files/".$name."_rotate.txt", "w");  
    $lis = 0; 
    for($x=0;$x<sizeof($user);$x++) { 
    $temp = explode(";",$user[$x]); 
    $opp[$x] = "$temp[0];$temp[1];$temp[2];$temp[3];$temp[4];$temp[5];$temp[6];$temp[7];$temp[8];$temp[9];$temp[10];"; 
    //$such = substr($temp[4],$keyword); 
    if($temp[3]!="" && $temp[1]!="" && $temp[2]!="") { 
    $list[$lis] = $opp[$x]; 
    $lis++;  
    } 
    if(sizeof($list) != "0") { 
    $fip = file("u_files/".$name.".txt"); 
    for($i = 0; $i <sizeof($fip);$i++){ 
    $fp = explode("|",$fip[$i]); 
    } 
    $size="u_files/".$temp[0].".txt"; 
    $a="$size"; 
    $fpy = file($a); 
    for($m=0;$m <sizeof($a);$m++){ 
    $fw = explode("|",$fpy[$m]); 
    } 
    if ($temp[6] == "1" && $fw[0] >= "1"){ 
    $fpq = fopen ("u_files/".$name."_rotate.txt", "a+"); 
    fwrite ($fpq, $temp[3]); 
    fwrite ($fpq, " myid="); 
    fwrite ($fpq, "$temp[0]"); 
    fwrite ($fpq, " myid="); 
    fwrite ($fpq, "\n"); 
    fclose ($fpq); 
    } 
    } 
    } 
    if ($fp[1]<=$date-($sec_surf-"1")){ 
    $fq = fopen ("u_files/".$name.".txt", "w"); 
    fwrite ($fq, $fp[0]+$p_p_v); 
    fwrite ($fq, "|"); 
    fwrite ($fq, $date); 
    fclose ($fq);
    if($temp[7]!=""){
    if (file_exists("u_files/".$temp[7].".txt")){
    $ref_pt=file("u_files/".$temp[7].".txt");
    $fogi=explode("|",$ref_pt[0]);
    $ttr=fopen ("u_files/".$temp[7].".txt","w");
    fwrite($ttr,$fogi[0]+$p_p_v_r);
    fwrite($ttr,"|");
    fwrite($ttr,$fogi[1]);
    fclose($ttr);
    }
    }
    }else{ 
    $fq = fopen ("u_files/".$name.".txt", "w"); 
    fwrite ($fq, $fp[0]+"0"); 
    fwrite ($fq, "|"); 
    fwrite ($fq, $date); 
    fclose ($fq); 
    } 
    $textfile ="u_files/".$name."_rotate.txt";  
    $urls = file("$textfile"); 
    $uu = rand(0,sizeof($urls)-1);
    $no="$urls[$uu]"; 
    $random = fopen ("u_files/".$name."_rotate1.txt", "w"); 
    fwrite ($random, $no); 
    fwrite ($random, "|"); 
    fclose ($random); 
    
    $ali =file ("u_files/".$name."_rotate1.txt"); 
    for($z=0;$z<sizeof($ali)-1;$z++) {
    $last = explode(" myid=",$ali[$z]);
    //echo "$last[1]";
    $combo = file("u_files/".$last[1].".txt"); 
    $qwe=explode("|",$combo[0]);
    if ($last[1]!=$name){ 
    $lastfile = fopen ("u_files/".$last[1].".txt", "w"); 
    fwrite ($lastfile, $qwe[0]-"1"); 
    fwrite ($lastfile, "|");
    fwrite ($lastfile, $qwe[1]);
    fclose ($lastfile); 
    } 
    } 
    $ficdest=explode(" myid=",$no);  
    $myurl=$ficdest[0]; 
    ?><FRAMESET border=0 
    frameSpacing=0 rows=65,* frameBorder=YES><FRAME border=0 name=top 
    marginWidth=0 marginHeight=0 
    src="main.php?action=rotator&url=<?php echo $myurl; ?>&name=<?php echo $name; ?>" 
    noResize scrolling=no leftmargin="0" topmargin="0"><FRAME border=0 
    name=main marginWidth=0 marginHeight=0 
    src="<?php echo"$myurl";?>" 
    noResize leftmargin="0" topmargin="0"></FRAMESET></HTML> 
    <?php 
    } 
    
    
    PHP:

    It writes all the rotate files to the correct folder, but then when the code requests them from that file it says it isn't there.

    Here is the error I keep getting:


    Warning: file(u_files/.txt) [function.file]: failed to open stream: No such file or directory in /home/johnguan/public_html/traffic-exchange/main.php on line 389

    What I should be getting is the websites rotating with a timer.


    Thanks in advance to anyone who can shed light on this problem.
     
    John Guanzon, Dec 21, 2006 IP