php issues

Discussion in 'Software' started by covert215, May 28, 2006.

  1. covert215

    covert215 Private E-2

    I'm in the process of making a content management system for a friend. I realize this code is HORRIBLY inefficient, but at the moment I'm just working with functionality. There are 8 news articles. Each one is stored in a text file. Each article has an accompanying title and image, in its own text file. This script is supposed to shift them down. For example, if I were to post a new article, I was article 7 to become article 8 to make room for the new item. I want the titles and images to shift as well. However, it is not working. Does anyone know why?

    PHP:
    $filename1 'news1.txt';
            
    $filename2 'news2.txt';
            
    $filename3 'news3.txt';
            
    $filename4 'news4.txt';
            
    $filename5 'news5.txt';
            
    $filename6 'news6.txt';
            
    $filename7 'news7.txt';
            
    $filename8 'news8.txt';
            
            
    $filename1b 'news1title.txt';
            
    $filename2b 'news2title.txt';
            
    $filename3b 'news3title.txt';
            
    $filename4b 'news4title.txt';
            
    $filename5b 'news5title.txt';
            
    $filename6b 'news6title.txt';
            
    $filename7b 'news7title.txt';
            
    $filename8b 'news8title.txt';
            
            
    $filename1c 'news1image.txt';
            
    $filename2c 'news2image.txt';
            
    $filename3c 'news3image.txt';
            
    $filename4c 'news4image.txt';
            
    $filename5c 'news5image.txt';
            
    $filename6c 'news6image.txt';
            
    $filename7c 'news7image.txt';
            
    $filename8c 'news8image.txt';
            
            
    $fp1 fopen($filename1,"a+");
            
    $fp2 fopen($filename2,"a+");
            
    $fp3 fopen($filename3,"a+");
            
    $fp4 fopen($filename4,"a+");
            
    $fp5 fopen($filename5,"a+");
            
    $fp6 fopen($filename6,"a+");
            
    $fp7 fopen($filename7,"a+");
            
    $fp8 fopen($filename8,"a+");
            
            
    $fp1b fopen($filename1b,"a+");
            
    $fp2b fopen($filename2b,"a+");
            
    $fp3b fopen($filename3b,"a+");
            
    $fp4b fopen($filename4b,"a+");
            
    $fp5b fopen($filename5b,"a+");
            
    $fp6b fopen($filename6b,"a+");
            
    $fp7b fopen($filename7b,"a+");
            
    $fp8b fopen($filename8b,"a+");
            
            
    $fp1c fopen($filename1c,"a+");
            
    $fp2c fopen($filename2c,"a+");
            
    $fp3c fopen($filename3c,"a+");
            
    $fp4c fopen($filename4c,"a+");
            
    $fp5c fopen($filename5c,"a+");
            
    $fp6c fopen($filename6c,"a+");
            
    $fp7c fopen($filename7c,"a+");
            
    $fp8c fopen($filename8c,"a+");
            
            
    $contents1 fread($fp1filesize($filename1));
            
    $contents2 fread($fp2filesize($filename2));
            
    $contents3 fread($fp3filesize($filename3));
            
    $contents4 fread($fp4filesize($filename4));
            
    $contents5 fread($fp5filesize($filename5));
            
    $contents6 fread($fp6filesize($filename6));
            
    $contents7 fread($fp7filesize($filename7));
            
    $contents8 fread($fp8filesize($filename8));
            
            
    $title1 fread($fp1bfilesize($filename1b));
            
    $title2 fread($fp2bfilesize($filename2b));
            
    $title3 fread($fp3bfilesize($filename3b));
            
    $title4 fread($fp4bfilesize($filename4b));
            
    $title5 fread($fp5bfilesize($filename5b));
            
    $title6 fread($fp6bfilesize($filename6b));
            
    $title7 fread($fp7bfilesize($filename7b));
            
    $title8 fread($fp8bfilesize($filename8b));
            
            
    $image1 fread($fp1cfilesize($filename1c));
            
    $image2 fread($fp2cfilesize($filename2c));
            
    $image3 fread($fp3cfilesize($filename3c));
            
    $image4 fread($fp4cfilesize($filename4c));
            
    $image5 fread($fp5cfilesize($filename5c));
            
    $image6 fread($fp6cfilesize($filename6c));
            
    $image7 fread($fp7cfilesize($filename7c));
            
    $image8 fread($fp8cfilesize($filename8c));
            
            
            
    fwrite($fp8$contents7);
            
    fwrite($fp7$contents6);
            
    fwrite($fp6$contents5);
            
    fwrite($fp5$contents4);
            
    fwrite($fp4$contents3);
            
    fwrite($fp3$contents2);
            
    fwrite($fp2$contents1);
            
            
    fwrite($fp8b$contents7);
            
    fwrite($fp7b$contents6);
            
    fwrite($fp6b$contents5);
            
    fwrite($fp5b$contents4);
            
    fwrite($fp4b$contents3);
            
    fwrite($fp3b$contents2);
            
    fwrite($fp2b$contents1);
            
            
    fwrite($fp8c$contents7);
            
    fwrite($fp7c$contents6);
            
    fwrite($fp6c$contents5);
            
    fwrite($fp5c$contents4);
            
    fwrite($fp4c$contents3);
            
    fwrite($fp3c$contents2);
            
    fwrite($fp2c$contents1);
            
            
    fclose($fp1);
            
    fclose($fp2);
            
    fclose($fp3);
            
    fclose($fp4);
            
    fclose($fp5);
            
    fclose($fp6);
            
    fclose($fp7);
            
    fclose($fp8);
             
            
    fclose($fp1b);
            
    fclose($fp2b);
            
    fclose($fp3b);
            
    fclose($fp4b);
            
    fclose($fp5b);
            
    fclose($fp6b);
            
    fclose($fp7b);
            
    fclose($fp8b);
            
            
    fclose($fp1c);
            
    fclose($fp2c);
            
    fclose($fp3c);
            
    fclose($fp4c);
            
    fclose($fp5c);
            
    fclose($fp6c);
            
    fclose($fp7c);
            
    fclose($fp8c);
     
  2. Raits

    Raits Private E-2

    Why don't you use one textfile for each newsitem and then use explode to read the data?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds