# of uploads, need some assist

I have this feature setup for loading a number of songs, however I would like to change the code so it only allows user to upload 4 songs then, see, you have reached the limit.

How Would you suggest adding code fi to this php code below?



<?php

	
	$k = 4;
	//$n=5;
	for ($i=0, $n=count( $this->songs ); $i < $n; $i++)
	//for ($i=0, $n=count( $this->songs ); $i < $n; $i++)
	{
		$song = &$this->songs[$i];
		$checked 	= JHTML::_('grid.id',   $i, $song->id );
		$link_edit = JRoute::_( 'index.php?song&userid='.$this->album->user_id.'&layout=form&id=' . $song->id .'&from=album');
	
		?>
		<tr class="<?php echo "row$k"; ?>">
		
			<td>
				<?php echo $checked; ?>
			</td>
            <td>
        			<input class="text_area" type="text" name="disc_num_<?php echo $song->id;?>" id="disc_num_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->disc_num;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="num_<?php echo $song->id;?>" id="num_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->num;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="position_<?php echo $song->id;?>" id="position_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->position;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="song_<?php echo $song->id;?>" id="song_<?php echo $song->id;?>" size="20" maxlength="255" value="<?php echo $song->name;?>" />
			</td>

            <td>
				<a href="<? echo $link_edit; ?>"><img src="components/com_muscol/assets/images/page_white_edit.png" title="<? echo JText::_( 'Edit this song' ); ?>" alt="<? echo JText::_( 'Edit this song' ); ?>" /></a>
			</td>
        

		</tr>
		<?php
		$k = 1 - $k;
		

	}
	?>





This is something you would typically use a SESSION variable for.

If you want to stop your users creating multiple sessions, then you have to ask them to log in and record the number of uploads in something like a database or text file.

But then they can create multiple accounts … and so on.