SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What Line Should I Remove?

    I am using a PHP application called Max New Script (http://www.phpf1.com/product/news-script.html) that collects a title, date, and news content from an admin page which is displayed on a separate listing page. The admin PHP page uses a form to collect the info and the separate PHP page calls the function "<?php $newsHandler->displayNews(); ?>" to display it.

    The problem is that each listing or entry is showing my name and email address and I do not want that info displayed. Can someone tell me what to delete or comment out and where that is located?

    Here is the code for the admin.php:
    PHP Code:
    <?php
    /**
     * Max News
     * 
     * This is the Max News administration panel. 
     * For more details please read the readme.txt
     */
    ?>
    <?php 
    require_once("maxProtector.class.php"); ?>
    <?php 
    require_once("maxNews.class.php"); $newsHandler = new maxNews(); if (!isset($_POST['submit'])) { ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       <title>Tennessee Orthopaedic Clinics | Job Opportunities Admin Panel</title>
       <link href="style/style.css" rel="stylesheet" type="text/css" />
       <style type="text/css">
    <!--
    body {
        background-image: url(../i/gfx_bkg2.jpg);
        margin-top: 60px;
    }
    -->
       </style>
    </head>
    <body>
    <div id="container">
        <div id="header"><div id="header_left"></div>
        <div id="header_main">Job Opportunities - Admin panel</div><div id="header_right"></div></div>
        <div id="content">
          <?php $newsHandler->displayAddForm(); ?>     
        </div>
    </div>
    </body>
    </html> 

    <?php 
    } else {
       
    $newsHandler->insertNews();
    }
    ?>
    Here is the code for the maxNews.class.php document:
    PHP Code:
    <?php
    /**
     * Max News
     * 
     * This is the Max News business logic class. 
     * For more details please read the readme.txt
     */
    ?>
    <?php
    class maxNews{
       var 
    $newsDir 'news';
       var 
    $newsList;
       var 
    $newsCount = -1;
       
    function 
    getNewsList(){
        
       
    $this->newsList = array();
       
        
    // Open the actual directory
        
    if ($handle = @opendir($this->newsDir)) {
            
    // Read all file from the actual directory
            
    while ($file readdir($handle))  {
                if (!
    is_dir($file)) {
                   
    $this->newsList[] = $file;
              }
            }
        }    
        
        
    rsort($this->newsList);
        
        return 
    $this->newsList;
    }   

    function 
    getNewsCount(){
       if (
    $this->newsCount == -1$this->getNewsList();
       
    $this->newsCount sizeof($this->newsList);
       return 
    $this->newsCount;
    }

    function 
    displayNews(){
          
    $list $this->getNewsList();
          
          echo 
    "<table class='newsList'>";
          foreach (
    $list as $value) {
              
    $newsData file($this->newsDir.DIRECTORY_SEPARATOR.$value);
              
    $newsTitle  $newsData[0];
             
    $submitDate $newsData[1];    
             unset (
    $newsData['0']);
             unset (
    $newsData['1']);
              
             
    $newsContent "";
             foreach (
    $newsData as $value) {
                   
    $newsContent .= $value;
             }
              
              echo 
    "<tr><th align='left'>$newsTitle</th>
                        <th class='right'>
    $submitDate</th></tr>";
              echo 
    "<tr><td colspan='2'>".$newsContent."<br/></td></tr>";
          }
          echo 
    "</table>";
          if (
    sizeof($list) == 0){
             echo 
    "<center><p>No news at the moment!</p><p>&nbsp;</p></center>";
          }
    }

    function 
    displayAddForm(){
    ?>  
       <script language="javascript" type="text/javascript" src="js/tiny_mce.js"></script>
    <script language="javascript" type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_align : "center",
        theme_advanced_toolbar_location : "top",

    });
    </script>  
      <form class="iform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
        News title:<br/>
        <input type="text" name="title" size="40"/><br/><br/>
        Content:<br/>
        <textarea name="newstext" rows="15" cols="67"></textarea><br/>
        <center><input type="submit" name="submit" value="Save" /></center>
      </form> 
       
    <?php   
    }

    function 
    insertNews(){
       
    $newsTitel   = isset($_POST['title']) ? $_POST['title'] : 'Untitled';
       
    $submitDate  date('Y-m-d g:i:s A');
       
    $newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : 'No content';
       
       
    $filename date('YmdHis');
       if (!
    file_exists($this->newsDir)){
          
    mkdir($this->newsDir);
       }
       
    $f fopen($this->newsDir.DIRECTORY_SEPARATOR.$filename.".txt","w+");         
       
    fwrite($f,$newsTitel."\n");
       
    fwrite($f,$submitDate."\n");
       
    fwrite($f,$newsContent."\n");
       
    fclose($f);

       
    header('Location:index.php');   
       
    }
    }
    ?>


    Here is a link to the testing page which shows my name and email address which is what I want removed:
    http://www.tocdocs.com/job-opportunities/
    Todd Temple > T2 Design

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I'm guessing you have a file in the "news" folder with a line containing your name and email address.

    What does the code for the separate PHP page look like?

  3. #3
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The files in the news folder are .txt files and below is an example of what they look like. I didn't see my name and email listed in these files.

    .TXT FILE EXAMPLE-
    Job Posting Number 1
    2009-04-21 4:56:00 AM
    <p>This is a sample job description with all of the specific contact information. Call the main office for more details.&nbsp;</p>


    And here is the code for the separate listings page-
    PHP Code:
    <?php
    /**
     * Max News
     * 
     * This is the Max News front end. 
     * For more details please read the readme.txt
     */
    ?>

    <?php 
       
    require_once("maxNews.class.php"); 
       
    $newsHandler = new maxNews();          
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Tennessee Orthopaedic Clinics</title>
    <meta name="description" content=""/>
    <meta name="keywords" content=""/>
    <meta name="target" content=""/>
    <meta name="author" content="Todd Temple at http://www.t2graphicdesign.com"/>
    <meta name="SEO" content="Todd Temple at http://www.t2graphicdesign.com"/>
    <meta name="copyright" content=""/> 
    <meta name="distribution" content="global"/> 
    <meta name="resource-type" content="web page"/>
    <meta name="user-group" content="public"/> 
    <meta name="identifier-url" content="http://www.tocdocs.com"/> 
    <meta name="revisit-after" content="30 days"/>
    <meta name="rating" content="general"/>
    <meta http-equiv="keywords" content=""/>
    <link href="../c/styles.css" rel="stylesheet" type="text/css" />
    <link href="style/style.css" rel="stylesheet" type="text/css" />
    <link rel="SHORTCUT ICON" href="http://www.tocdocs.com/i/gfx_favicon.ico"/>
    <meta name="verify-v1" content="" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script language="JavaScript" src="../j/global.js" type="text/javascript"></script>
    <script src="../j/AC_RunActiveContent.js" type="text/javascript"></script>
    </head>
    <body>
    <div id="wrapper">
      <table width="870" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="158" height="128" align="left" valign="top"><a href="../index.html"><img src="../i/gfx_logo2.jpg" alt="Tennessee Orthopaedic Clinics" width="158" height="128" border="0" /></a></td>
        <td width="235" align="left" valign="top"><table width="650" border="0" align="left" cellpadding="0" cellspacing="0" id="navbar">
          <tr>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td width="30" valign="top" class="nav"><a href="../our-doctors.html">Our <br />
              Doctors</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td width="30" valign="top" class="nav"><a href="../our-specialties.html">Our <br />
              Specialties</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td width="30" valign="top" class="nav"><a href="../our-services.html">Our<br /> 
              Services</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top" class="nav"><a href="../appointments.html">Appointments</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top" class="nav"><a href="../patient-education.html">Patient <br />
              Education</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top" class="nav"><a href="../our-locations.html">Our <br />
    Locations</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top" class="nav"><a href="../quick-care-clinics.html">Quick Care <br />
              Clinics</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top" class="nav"><a href="../contact-us.html">Contact <br />
              Us</a></td>
            <td width="1" valign="top"><img src="../i/gfx_pipe.gif" alt="" width="1" height="63" /></td>
            <td valign="top">&nbsp;</td>
          </tr>
        </table></td>
        </tr>
      <tr>
        <td colspan="2" valign="top"><table width="841" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td colspan="2" valign="top"><table width="841" border="0" cellpadding="0" cellspacing="0" id="sub">
              <tr>
                <td height="7" valign="top"><img src="../i/gfx_sub_top.gif" alt="" width="841" height="7" /></td>
              </tr>
              <tr>
                <td height="73" valign="top"><table width="833" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr valign="top">
                    <td width="13"><img src="../i/spacer.gif" alt="" width="13" height="1" /></td>
                    <td width="806" colspan="3"><p><img src="../i/gfx_collage_jobOpportunitie.jpg" alt="ob Opportunities" width="807" height="132" /><br />
                    </p>
                      <div id="container">
        <div id="header"><div id="header_left"></div><div id="header_main">Job Opportunities</div><div id="header_right"></div></div>
        <div id="inner">
             <?php $newsHandler->displayNews(); ?>
        </div>
                      </div>
                      <p>&nbsp;</p></td>
                    <td width="13"><img src="../i/spacer.gif" alt="" width="13" height="1" /></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td width="841" height="7" valign="top"><img src="../i/gfx_sub_btm.gif" alt="" width="841" height="7" /></td>
              </tr>
            </table></td>
          </tr>
        </table>
          <p class="footer">| <a href="../index.html">HOME</a> | <a href="../our-doctors.html">OUR DOCTORS</a> | <a href="../our-specialties.html">OUR SPECIALTIES</a> | <a href="../our-services.html">PATIENT SERVICES</a> | <a href="../appointments.html">APPOINTMENTS</a> | <a href="../patient-education.html">PATIENT EDUCATION</a> | <a href="../our-locations.html">OUR LOCATIONS</a> | <a href="../quick-care-clinics.html">QUICK CARE CLINICS</a> | <a href="../contact-us.html">CONTACT US</a> |<br />
            | <a href="../about-us.html">ABOUT US</a> | <a href="http://gateway.tocdocs.com/exchange/">WEB MAIL</a> | <a href="../sports-medicine.php">SPORTS MEDICINE</a> | <a href="../toc-spine.html">TOC SPINE</a> | <a href="../toc-podiatry.html">TOC PODIATRY</a> | <a href="../work-link.html">WORK LINK</a> | <a href="../accepted-insurance.html">ACCEPTED INSURANCE</a> | <a href="#">INFO RX</a> | <a href="../links.html">LINKS</a> | <a href="../ask-an-expert.php">ASK AN EXPERT</a> | <br />
            | <a href="../disclaimer.html">DISCLAIMER</a> | <a href="../privacy-policy.html">PRIVACY POLICY</a> | <a href="admin.php">LOGIN</a> |</p>
          <p class="footer">&copy; COPYRIGHT 2008. ALL RIGHTS RESERVED BY TENNESSEE ORTHOPAEDIC CLINICS.</p><p>&nbsp;</p></td>
        </tr>
    </table>
    </div>
    </body>
    </html>
    Todd Temple > T2 Design

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Well this sure is a puzzle. I've tried to replicate the problem a few ways but no luck. Try editing the maxNews.class.php file by putting some var_dump()s into displayNews() like this
    PHP Code:
    function displayNews(){
          
    $list $this->getNewsList();
    var_dump($list);//FOR DEBUGGING ONLY
          
          
    echo "<table class='newsList'>";
          foreach (
    $list as $value) {
    var_dump($value);//FOR DEBUGGING ONLY
              
    $newsData file($this->newsDir.DIRECTORY_SEPARATOR.$value);
    var_dump($newsData);//FOR DEBUGGING ONLY
              
    $newsTitle  $newsData[0];
             
    $submitDate $newsData[1];    
             unset (
    $newsData['0']);
             unset (
    $newsData['1']);
              
             
    $newsContent "";
             foreach (
    $newsData as $value) {
                   
    $newsContent .= $value;
             }
              
              echo 
    "<tr><th align='left'>$newsTitle</th>
                        <th class='right'>
    $submitDate</th></tr>";
              echo 
    "<tr><td colspan='2'>".$newsContent."<br/></td></tr>";
          }
          echo 
    "</table>";
          if (
    sizeof($list) == 0){
             echo 
    "<center><p>No news at the moment!</p><p>&nbsp;</p></center>";
          }

    You should see something like this on the page
    array(3) { [0]=> string(9) "bogie.txt" [1]=> string(18) "20090602130206.txt" [2]=> string(18) "20090602125927.txt" } string(9) "bogie.txt" array(1) { [0]=> string(17) "corruption stinks" } string(18) "20090602130206.txt" array(3) { [0]=> string(13) "Second Test " [1]=> string(23) "2009-06-02 1:02:06 PM " [2]=> string(59) "Where or where can the problem be, javascript or A pach e " } string(18) "20090602125927.txt" array(3) { [0]=> string(12) "First Test " [1]=> string(24) "2009-06-02 12:59:27 PM " [2]=> string(23) "Wad up bro? Any ting? " }
    Then please post what you get (minus any sensitive info).

  5. #5
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    Then please post what you get.
    Here is my dumps. I noticed the .txt extension is followed by .LCK which seems to be added to files within Dreamweaver once I have the Check In/Check Out feature enabled. I have disabled it for now. I am assuming that the text with my name and email address are somehow linked to that feature.

    Code:
    array(6) { [0]=> string(22) "20090421062842.txt.LCK" [1]=> string(18) "20090421062842.txt" [2]=> string(22) "20090421052747.txt.LCK" [3]=> string(18) "20090421052747.txt" [4]=> string(22) "20090421045600.txt.LCK" [5]=> string(18) "20090421045600.txt" } string(22) "20090421062842.txt.LCK" array(1) { [0]=> string(38) } string(18) "20090421062842.txt" array(3) { [0]=> string(11) "Test Three " [1]=> string(22) "2009-04-21 6:28:42 AM " [2]=> string(48) "
    This is a sample test again.  
    
    " } string(22) "20090421052747.txt.LCK" array(1) { [0]=> string(38)  } string(18) "20090421052747.txt" array(3) { [0]=> string(21) "Job Posting Number 2 " [1]=> string(22) "2009-04-21 5:27:47 AM " [2]=> string(211) "
    This is the description for the second job opportunity. If you would like more information about this job posting, please contact Tennessee Orthopaedic Clinics at info@tocdocs.com or call (888) 555-1212.
    
    " } string(22) "20090421045600.txt.LCK" array(1) { [0]=> string(38) } string(18) "20090421045600.txt" array(3) { [0]=> string(21) "Job Posting Number 1 " [1]=> string(22) "2009-04-21 4:56:00 AM " [2]=> string(131) "
    This is a sample job description with all of the specific contact information. Call the main office for more details. 
    
    " }
    Todd Temple > T2 Design

  6. #6
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I simply rewrote the same files with a new file name and I removed the Dreamweaver feature of Check In/Check Out and it appears to be working. The name and email must be added in as a hidden item somewhere.

    Thanks for looking at it!
    Todd Temple > T2 Design

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    That explains things. Those files contain name||email as their content http://kb2.adobe.com/cps/154/tn_15447.html
    An .LCK file is a simple text file containing only the user's Check Out Name (and e-mail address, if provided).
    *Note
    These .LCK files are not visible within the Dreamweaver Site window, but can be seen outside of the Dreamweaver interface or by using a different FTP application.
    The .lck files are what DreamWeaver uses for versioning control. Not so important perhaps if you are the only one uploading/editing files and/or versioning is not important.

    The maxNews class code could be modified to not get those files, but you may want to not have them as the contents can be viewed by others even if you instruct search bots to not index them. (try a Google search for inurl:"txt.lck" to get an idea)

    So if you're going to use them, you should probably prevent access. i.e. add this to Apache's httpd.conf or .htaccess file
    Code:
    <FilesMatch "\.(lck|LCK)$">
      order allow,deny
      deny from all
    </FilesMatch>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •