HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/public_html/archive/5a_orig/sl_edit.php
<?php
error_reporting(0);
if (phpversion() >= "4.2.0") {
extract($HTTP_POST_VARS);
extract($HTTP_GET_VARS); 
}

require("_header.php");

//////////////////////////////////////////////////////////////////////////////////////
function login() {
    echo "<form action=\"sl_edit.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"stage\" value=\"1\">\n";
    echo "<P><table border=0>\n";
    echo "<tr><td class=\"text\" align=\"right\"><b>Username:</b></td><td class=\"text\"><input type=\"text\" name=\"username\" size=20 maxlength=10></td></tr>\n";
    echo "<tr><td class=\"text\" align=\"right\"><b>Password:</b></td><td class=\"text\"><input type=\"password\" name=\"password\" size=20 maxlength=10></td></tr>\n";
    echo "</table>\n";
    echo "<input type=\"submit\" value=\"Login\">\n";
    echo "</form>\n";
}
//////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////
function prompt_for_file() {
    echo "<center><P><img src=\"images/t_calendar.gif\">\n";
    echo "<form action=\"sl_edit.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"stage\" value=\"2\">\n";
    echo "<P><b>Please select the song list you'd like to edit:</b>\n";
    echo "<P><table border=0>\n";
    echo "<tr><td class=\"text\"><input type=\"radio\" name=\"filetoedit\" value=\"dan30.php\"> DJ 5th Ace - Top 30</td></tr>\n";
    echo "<tr><td class=\"text\"><input type=\"radio\" name=\"filetoedit\" value=\"kev30.php\"> DJ Big Husk - Top 30</td></tr>\n";
    echo "<tr><td class=\"text\"><input type=\"radio\" name=\"filetoedit\" value=\"joe30.php\"> DJ Underdog - Top 30</td></tr>\n";
    echo "<tr><td class=\"text\"><input type=\"radio\" name=\"filetoedit\" value=\"wedding10.php\"> Wedding Top 10</td></tr>\n";
    echo "<tr><td class=\"text\"><input type=\"radio\" name=\"filetoedit\" value=\"barscene10.php\"> Bar Scene Top 10</td></tr>\n";
    echo "</table>\n";
    echo "<input type=\"submit\" value=\"Submit\"></form>\n";
    echo "<br><br><br><br>\n";
}
//////////////////////////////////////////////////////////////////////////////////////


if ($stage == 1) {
   if ($username == "dkoch" && $password == "flowers41") {
      prompt_for_file();
   } else {
      echo "<center><P><img src=\"images/t_songs.gif\">\n";
      echo "<P><b>Username and/or Password is incorrect, please try again:</b>\n";
      login();
   }
}

else if ($stage == 2) {
   echo "<center><P><img src=\"images/t_songs.gif\">\n";
   echo "<P><b>Make the changes to your list below.</b>\n";
   echo "<P><b><u>RULES TO FOLLOW</u></b>\n";
   echo "<br><b>1 - Do Not Type a Colon [:] in any text field!!</b>\n";
   echo "<br><b>2 - Do Not Type Quotation Marks [\"] in any text field!! (Apostrophes ['] are okay)</b>\n";
   echo "<form action=\"sl_edit.php\" method=\"post\">\n";
   echo "<input type=\"hidden\" name=\"stage\" value=\"3\">\n";
   echo "<table border=0>\n";

   $datapath = "cgi-bin/songlists/$filetoedit";
   $list = file($datapath);
   $list_length = count($list);
   
   for ($i=0; $i < $list_length; $i++) {
       $song = explode(":", $list[$i]);
       $data1 = stripslashes(trim($song[0]));
       $data2 = stripslashes(trim($song[1]));
   
   echo "<tr><td class=\"text\" valign=\"top\"><font color=#CC0000><b>" . ($list_length - $i) . 
        "</b></font></td><td class=\"text\" valign=\"top\"><P>Song Title: <input size=50 type=text name=\"sl" . ($list_length - $i) . "\" value=\"$data1\">" . 
        "<br>Description: <input size=50 type=text name=\"desc" . ($list_length - $i) . "\" value=\"$data2\"></td></tr>\n";
   }   
   
   echo "</table><P><input type=\"hidden\" name=\"filetoedit\" value=\"$filetoedit\">\n";
   echo "<input type=\"hidden\" name=\"length\" value=\"$list_length\">\n";
   echo "<input type=\"submit\" value=\"Submit\"></form>\n";
   echo "<br>\n";
}

else if ($stage == 3) {
   $datapath = "cgi-bin/songlists/$filetoedit";
   $fp = fopen($datapath, "w");

   for ($k=0; $k < $length; $k++) {
       $slvar = "sl" . ($length - $k);
       $descvar = "desc" . ($length - $k);
       $data1 = stripslashes(trim($HTTP_POST_VARS[$slvar]));
       $data2 = stripslashes(trim($HTTP_POST_VARS[$descvar]));
       $newline = $data1 . ":" . $data2 . "\n";
       fwrite($fp, $newline);
   }
   
   fclose($fp);
   echo "<center><P><img src=\"images/t_songs.gif\">\n";
   echo "<P><b>Changes Successful!</b>\n";
}

else {  						// executed when user first enters the system
   echo "<center><P><img src=\"images/t_songs.gif\">\n";
   login();
}


require("_footer.php");
?>