Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

"; } else { $Songfile = fopen("SongOrganizer/songs.txt" , "ab"); if ($SongFile === false) echo "There was an error saving your message! "; else { fwrite($SongFile, $SongToAdd); fclose($SongFile); echo "Your song has been added to the list. "; } } if ((!file_exists("SongOrganizer/songs.txt")) || (filesize("SongOrganizer/songs.txt")== 0)) echo "

There are no songs in the list.

"; else { $SongArray = file("SongOrganizer/songs.txt"); echo " "; foreach ($SongArray as $Song) { echo " "; echo " "; } echo "
" . htmlentities($Song). ""; echo "
"; } ?>

Sort Song List
Remove Duplicate Songs
Randomize Song list

Add a new song

Song Name:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions