Question
Song Organizer ( ! ) Notice: Undefined variable: SongToAdd in C:wamp64wwwlp6SongOrganizer.php on line 55 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}(
Song Organizer ( ! ) Notice: Undefined variable: SongToAdd in C:\wamp64\www\lp6\SongOrganizer.php on line 55 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Notice: Undefined variable: ExistingSongs in C:\wamp64\www\lp6\SongOrganizer.php on line 55 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Warning: in_array() expects parameter 2 to be array, null given in C:\wamp64\www\lp6\SongOrganizer.php on line 55 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 2 0.0320 407008 in_array ( ) ...\SongOrganizer.php:55 ( ! ) Warning: fopen(SongOrganizer/songs.txt): failed to open stream: No such file or directory in C:\wamp64\www\lp6\SongOrganizer.php on line 60 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 2 0.0460 407008 fopen ( ) ...\SongOrganizer.php:60 ( ! ) Notice: Undefined variable: SongFile in C:\wamp64\www\lp6\SongOrganizer.php on line 61 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Notice: Undefined variable: SongFile in C:\wamp64\www\lp6\SongOrganizer.php on line 64 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Notice: Undefined variable: SongToAdd in C:\wamp64\www\lp6\SongOrganizer.php on line 64 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Warning: fwrite() expects parameter 1 to be resource, null given in C:\wamp64\www\lp6\SongOrganizer.php on line 64 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 2 0.1018 407232 fwrite ( ) ...\SongOrganizer.php:64 ( ! ) Notice: Undefined variable: SongFile in C:\wamp64\www\lp6\SongOrganizer.php on line 65 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 ( ! ) Warning: fclose() expects parameter 1 to be resource, null given in C:\wamp64\www\lp6\SongOrganizer.php on line 65 Call Stack # Time Memory Function Location 1 0.0082 406392 {main}( ) ...\SongOrganizer.php:0 2 0.1321 407232 fclose ( ) ...\SongOrganizer.php:65 Your song has been added to the list.
These are the errors I am receiving.
Song Organizer
if (isset($_GET['action'])) { if ((file_exists("SongOrganizer/songs.txt")) && (filesize("SongOrganizer/songs.txt")!= 0)) { $SongArray = file("SongOrganizer/songs.txt");
switch ($_GET['action']) { case 'Remove Duplicates': $SongArray = array_unique($SongArray); $SongArray = array_values($SongArray); break; case 'Sort Ascending': sort($SongArray); break; case 'Shuffle': shuffle($SongArray); break; }// End of the switch statement if (count($SongArray)>0) { $NewSongs = implode($SongArray); $SongStore = fopen("SongOrganizer/Songs.txt","wb"); if ($SongStore === false) echo "There was an error updating the song file "; else { fwrite($SongStore, $NewSongs); fclose($SongStore); } } else unlink("SongOrganizer/songs.txt"); } } if (isset($_POST['submit'])) { $SongToAdd = stripslashes($_POST['SongName']). " "; $ExistingSongs = array(); if (file_exists("SongOrganizer/songs.txt") && filesize("SongOrganizer/songs.txt") > 0) { $ExistingSongs = file("SongOrganizer/songs.txt"); } } if (in_array($SongToAdd, $ExistingSongs)) { echo "
The song you entered already exists!
"; echo "Your song was not added to the list.
There are no songs in the list.
"; else { $SongArray = file("SongOrganizer/songs.txt"); echo "" . htmlentities($Song). " | "; echo " |
Sort Song List
Remove Duplicate Songs
Randomize Song list