Jump to content

upload music form


ccrevcypsys

Recommended Posts

Every time i go to upload a song. It tells my database that their are three new songs with no files or anything. someone please help.

 

Here is the html page:

<form name="registerForm" method="post" action="{VAL_ACTION}" enctype="multipart/form-data">
<table class="mainTable" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td colspan="2" class="tdTitle">
AddSong
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Artist:
</strong>
</td>
<td>
<input name="customer_id" class="textbox" value="{TXT_USERNAME}" maxlength="255" type="text" />
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Song Name:
</strong>
</td>
<td>
  <input name="name" class="textbox" value="" maxlength="255" type="text">
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Release Date
</strong>
</td>
<td>
  <input id="releaseDate" name="releaseDate" class="textbox" value="" maxlength="255" type="text">
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Type:
</strong>
</td>
<td>
<select name="Type" class="textbox" onchange="if(this.value=='Album'){document.getElementById('id_song').style.display='none';document.getElementById('id_album').style.display='';}else{document.getElementById('id_song').style.display='';document.getElementById('id_album').style.display='none';}">
  <option value="Song">
Song
  </option>
  <option value="Album">
Album
  </option>
</select>
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Album:
</strong>
</td>
<td>
  <input name="albumName" class="textbox" value="" maxlength="255" type="text">
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Song No:
</strong>
  <br>
(If left blank this will be auto generated.)
</td>
<td>
  <input name="productCode" class="textbox" value="" maxlength="255" type="text">
</td>
</tr>
<tr>
<td colspan="2" class="tdRichText">
<span class="tdText">
<strong>
Description:
</strong>
</span>
</td>
</tr>
<tr>
<td colspan="2" class="tdRichText">
<div>
  <input id="FCKeditor" name="FCKeditor" value="" type="hidden">
  <input id="FCKeditor___Config" value="" type="hidden">
<iframe id="FCKeditor___Frame" src="/admin/includes/rte/editor/fckeditor.html?InstanceName=FCKeditor&Toolbar=Default" frameborder="no" height="200" scrolling="no" width="100%">
</iframe>
</div>
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Category:
</strong>
</td>
<td>
<select name="cat_id" class="textbox">
  <option value="42">
Ambience
  </option>
  <option value="41">
Jazz
  </option>
  <option value="40">
Soul
  </option>
  <option value="39">
RnB
  </option>
  <option value="38">
Reggae
  </option>
  <option value="37">
Rap
  </option>
  <option value="36">
Punk
  </option>
  <option value="35">
Psychedelic
  </option>
  <option value="34">
Progressive
  </option>
  <option value="33">
Other
  </option>
  <option value="31">
Instrumental
  </option>
  <option value="30">
House
  </option>
  <option value="29">
Hip Hop
  </option>
  <option value="28">
Funk
  </option>
  <option value="27">
Folk
  </option>
  <option value="26">
Experimental
  </option>
  <option value="25">
Emo
  </option>
  <option value="24">
Electronic
  </option>
  <option value="23">
Dance
  </option>
  <option value="22">
Country
  </option>
  <option value="21">
Comedy
  </option>
  <option value="20">
Club
  </option>
  <option value="19">
Classical
  </option>
  <option value="18">
Acid Rock
  </option>
  <option value="17">
Heavy Metal
  </option>
  <option value="16">
Soft Rock
  </option>
  <option value="15">
Classic Rock
  </option>
  <option value="14">
Christian Rock
  </option>
  <option value="13">
Christian
  </option>
  <option value="12">
Childrens
  </option>
  <option value="11">
Blues
  </option>
  <option value="10">
Bluegrass
  </option>
  <option value="9">
Beats
  </option>
  <option value="8">
Audio Guides
  </option>
  <option value="7">
Audio Books
  </option>
  <option value="5">
Alternative
  </option>
  <option value="4">
Acoustic
  </option>
  <option value="3">
Rock
  </option>
  <option value="2">
Pop
  </option>
</select>
</td>
</tr>
<tr>
<td class="tdText" align="left" valign="top" width="25%">
<strong>
Image:
</strong>
  <br>
(Optional and thumbnails will automatically be made IF the format chosen is compatible.)
</td>
<td valign="top">
<div id="selectedImage">
</div>
<div id="imageControls">
<table border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td>
  <input name="upload" style="width: 200px;" class="submit" id="upload" onclick="openPopUp('admin/filemanager/upload.php?custom=1','filemanager',450,250)" value="Upload New Image" type="button">
</td>
</tr>
<tr>
<td>
  <input name="browse" style="width: 200px;" class="submit" id="browse" onclick="openPopUp('admin/filemanager/browse.php?custom=1','filemanager',450,500)" value="Browse Existing Images" type="button">
</td>
</tr>
</tbody>
</table>
</div>
  <input name="imageName" id="imageName" value="" type="hidden">
</td>
</tr>
<tr>
<td class="tdText" width="25%">
<strong>
Price:
</strong>
(ex. 0.99 = 99 cents)
</td>
<td>
  <input name="price" value="" class="textbox" size="10" type="text">
</td>
</tr>
<tr>
<td class="tdText">
<strong>
Tax Class:
</strong>
</td>
<td class="tdText">
<select name="taxType">
  <option value="1">
Standard Tax (6.5000%)
  </option>
  <option value="2">
(0.0000%)
  </option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<div id="id_song">
<table>
<tbody>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir" id="digitalDir" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample" id="digitalSample" value="" maxlength="255" type="file">
</td>
</tr>
</tbody>
</table>
</div>
<div style="display: none;" id="id_album">
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
1
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir1" id="digitalDir1" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample1" id="digitalSample1" value="" maxlength="255" type="file">
  <input name="songtitle1" id="songtitle1" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
2
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir2" id="digitalDir2" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample2" id="digitalSample2" value="" maxlength="255" type="file">
  <input name="songtitle2" id="songtitle2" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
3
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir3" id="digitalDir3" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample3" id="digitalSample3" value="" maxlength="255" type="file">
  <input name="songtitle3" id="songtitle3" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
4
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir4" id="digitalDir4" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample4" id="digitalSample4" value="" maxlength="255" type="file">
  <input name="songtitle4" id="songtitle4" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
5
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir5" id="digitalDir5" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample5" id="digitalSample5" value="" maxlength="255" type="file">
  <input name="songtitle5" id="songtitle5" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
6
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir6" id="digitalDir6" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample6" id="digitalSample6" value="" maxlength="255" type="file">
  <input name="songtitle6" id="songtitle6" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
7
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir7" id="digitalDir7" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample7" id="digitalSample7" value="" maxlength="255" type="file">
  <input name="songtitle7" id="songtitle7" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
8
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir8" id="digitalDir8" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample8" id="digitalSample8" value="" maxlength="255" type="file">
  <input name="songtitle8" id="songtitle8" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
9
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir9" id="digitalDir9" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample9" id="digitalSample9" value="" maxlength="255" type="file">
  <input name="songtitle9" id="songtitle9" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
10
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir10" id="digitalDir10" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample10" id="digitalSample10" value="" maxlength="255" type="file">
  <input name="songtitle10" id="songtitle10" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
11
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir11" id="digitalDir11" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample11" id="digitalSample11" value="" maxlength="255" type="file">
  <input name="songtitle11" id="songtitle11" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
12
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir12" id="digitalDir12" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample12" id="digitalSample12" value="" maxlength="255" type="file">
  <input name="songtitle12" id="songtitle12" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
13
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir13" id="digitalDir13" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample13" id="digitalSample13" value="" maxlength="255" type="file">
  <input name="songtitle13" id="songtitle13" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
14
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir14" id="digitalDir14" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample14" id="digitalSample14" value="" maxlength="255" type="file">
  <input name="songtitle14" id="songtitle14" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
15
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir15" id="digitalDir15" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample15" id="digitalSample15" value="" maxlength="255" type="file">
  <input name="songtitle15" id="songtitle15" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
16
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir16" id="digitalDir16" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample16" id="digitalSample16" value="" maxlength="255" type="file">
  <input name="songtitle16" id="songtitle16" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
17
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir17" id="digitalDir17" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample17" id="digitalSample17" value="" maxlength="255" type="file">
  <input name="songtitle17" id="songtitle17" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
18
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir18" id="digitalDir18" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample18" id="digitalSample18" value="" maxlength="255" type="file">
  <input name="songtitle18" id="songtitle18" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
19
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir19" id="digitalDir19" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
</td>
<td class="tdText">
  <input name="digitalSample19" id="digitalSample19" value="" maxlength="255" type="file">
  <input name="songtitle19" id="songtitle19" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="2" class="tdText">
<b>
20
</b>
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song:
</strong>
</td>
<td class="tdText">
  <input name="digital" value="1" type="hidden">
  <input name="digitalDir20" id="digitalDir20" value="" maxlength="255" type="file">
</td>
</tr>
<tr>
<td class="tdText" valign="top">
<strong>
Upload Song: Sample
</strong>
<br /> This Is just a 30 sec. Sample that people can listen to before they buy.
</td>
<td class="tdText">
  <input name="digitalSample20" id="digitalSample20" value="" maxlength="255" type="file">
  <input name="songtitle20" id="songtitle20" value="" maxlength="255" type="text">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<tr>
<td class="tdText">
<strong>
Include in latest songs in homepage?
</strong>
</td>
<td class="tdText">
<select name="showFeatured" class="textbox">
  <option value="1">
Yes
  </option>
  <option value="0">
No
  </option>
</select>
</td>
</tr>
<tr>
<td width="25%"> 

</td>
<td>
  <input name="oldCatId" value="" type="hidden">
  <input name="productId" value="" type="hidden">
  <input name="Submit" class="submit" value="Add Song" type="submit">
</td>
</tr>
</tbody>
</table>
</form>

Here is the .php page.

$music_upload->assign("TXT_USERNAME",$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName']);
}
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY name ASC";
$results = $db->select($query);
// generate product code
if(empty($_POST['productCode'])){

	$chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",
			"O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",
			"4","5","6","7","8","9","0");
	$max_chars = count($chars) - 1;
	srand((double)microtime()*1000000);
		for($i = 0; $i < 5; $i++){
			$randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];
		}
	$record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']);

} else {
	$record["productCode"] = $db->mySQLSafe($_POST['productCode']);	
}

$record["name"] = $db->mySQLSafe($_POST['name']);		
$record["cat_id"] = $db->mySQLSafe($_POST['cat_id']);	
$record["description"] = $db->mySQLSafe($_POST['FCKeditor']);
$record["albumName"] = $db->mySQLSafe($_POST['albumName']);
$record["lPoints"] = $db->mySQLSafe($_POST['lPoints']);
$record["image"] = $db->mySQLSafe($_POST['imageName']);
$record["price"] = $db->mySQLSafe($_POST['price']);  
$record["sale_price"] = $db->mySQLSafe($_POST['sale_price']);
$record["stock_level"] = $db->mySQLSafe($_POST['stock_level']); 
$record["useStockLevel"] = $db->mySQLSafe($_POST['useStockLevel']);
$record["digital"] = $db->mySQLSafe($_POST['digital']);
$record["digitalDir"] = $db->mySQLSafe($_POST['digitalDir']);
$record["prodWeight"] = $db->mySQLSafe($_POST['prodWeight']);
$record["taxType"] = $db->mySQLSafe($_POST['taxType']); 
$record["showFeatured"] = $db->mySQLSafe($_POST['showFeatured']); 
$record["release_date"] = $db->mySQLSafe($_POST['releaseDate']);
        $record["type"] = $db->mySQLSafe($_POST['Type']);
        $record["gender"] = $db->mySQLSafe($_POST['gender']);
$record["customer_id"] = $db->mySQLSafe($_POST['artist']);
// if image is a JPG check thumbnail doesn't exist and if not make one
$imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName']));
if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){

	if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'])){
		@chmod($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'], 0775);
		unlink($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']);
	}

	$thumb=new thumbnail($GLOBALS['rootDir']."/images/uploads/".$_POST['imageName']);
	$thumb->size_auto($config['gdthumbSize']);
	$thumb->jpeg_quality($config['gdquality']);
	$thumb->save($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']);
}

if(trim($_POST["Type"])!='Song'){
for($i=1;$i<=20;$i++){
	if(is_array($_FILES['digitalDir'.$i])){
		$date_str=date('Ymdhis');
		$songeFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalDir'.$i]['name']));
		$songSample_format = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalSample'.$i]['name']));
		if($songeFormat=='MP3'){
			copy($_FILES['digitalDir'.$i]['tmp_name'],"songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir'.$i]['name'])));
			$song_files["digitalDir".$i] = $db->mySQLSafe("songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir'.$i]['name'])));
			if($_FILES['digitalSample'.$i]['name']!=''){
				copy($_FILES['digitalSample'.$i]['tmp_name'],"songs/samples/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalSample'.$i]['name'])));
				$song_files["digital_sample".$i] = $db->mySQLSafe("songs/samples/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalSample'.$i]['name'])));
				$song_files["title".$i] = $db->mySQLSafe($_POST['songtitle'.$i]);
			}
		}
	}
}

}else{
if(is_array($_FILES['digitalDir'])){
	$date_str=date('Ymdhis');
	$songeFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalDir']['name']));
	$songSample_format = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalSample']['name']));
	if($songeFormat=='MP3'){
	copy($_FILES['digitalDir']['tmp_name'],"songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name'])));
	$record["digitalDir"] = $db->mySQLSafe("songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name'])));
	if(is_array($_FILES['digitalSample'])){
		copy($_FILES['digitalSample']['tmp_name'],"songs/samples/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalSample']['name'])));
                	$record["digital_sample"] = $db->mySQLSafe("songs/samples/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalSample']['name'])));
	}}
}
}
if(isset($_POST['productId']) && $_POST['productId']>0) {

	$where = "productId=".$db->mySQLSafe($_POST['productId']);
	$update = $db->update($glob['dbprefix']."CubeCart_inventory", $record, $where);
	unset($record, $where);
	//delete old files
	$db->misc("delete from cc_album_files where albumid=".$_POST['productId']);
	if(trim($_POST['Type'])=='Album'){
		for($i=1;$i<=20;$i++){
			if($song_files['digitalDir'.$i]!='')
			$db->misc("insert into cc_album_files (albumid,path,title) values(".$_POST['productId'].",".$song_files['digitalDir'.$i].",".$song_files['title'.$i].")");
			if($song_files['digital_sample'.$i]!='')
			$db->misc("insert into cc_album_files (albumid,path,title,sample) values(".$_POST['productId'].",".$song_files['digital_sample'.$i].",".$song_files['title'.$i].",1)");

		}
	}

	// update category count
	if($_POST['oldCatId']!==$_POST['cat_id']){

			// set old category -1 IF IT WAS IN THERE BEFORE
			$numOldCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['oldCatId'])." AND productId = ".$db->mySQLSafe($_POST['productId']));

			if($numOldCat>0){
				$db->categoryNos($_POST['oldCatId'], "-");
			}

			// set new category +1 IF IT WAS NOT IN THERE BEFORE
			$numNewCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['cat_id'])." AND productId = ".$db->mySQLSafe($_POST['productId']));

			if($numNewCat == 0) {
				$db->categoryNos($_POST['cat_id'], "+");
			}


			// delete old idx
			$where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['oldCatId']);  
			$deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where);
			unset($record);

			// delete new index if it was added as an extra before
			$where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['cat_id']);  
			$deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where);
			unset($record);

			// add new idx
			$record['productId'] = $db->mySQLSafe($_POST['productId']);
			$record['cat_id'] = $db->mySQLSafe($_POST['cat_id']);  
			$insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record);
			unset($record);

	}

	if($update == TRUE){
		$msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['update_successful']."</p>";
	} else {
		$msg = "<p class='warnText'>".$lang['admin']['products']['update_fail']."</p>";
	}

} else {

	$insert = $db->insert($glob['dbprefix']."CubeCart_inventory", $record);

	$record['cat_id'] = $db->mySQLSafe($_POST['cat_id']);
	$prodid=$record['productId'] = $db->insertid();  
	////////////////////////////////////////points system/////////////////////////////////////
	$insert = $db->misc("insert into cc_points set songid='".$record['productId']."'");
	if(trim($_POST['Type'])!='Song'){
		for($i=1;$i<=20;$i++){
			if($song_files['digitalDir'.$i]!='')
			$db->misc("insert into cc_album_files (albumid,path,title) values(".$record['productId'].",".$song_files['digitalDir'.$i].",".$song_files['title'.$i].")");
			if($song_files['digital_sample'.$i]!='')
			$db->misc("insert into cc_album_files (albumid,path,title,sample) values(".$record['productId'].",".$song_files['digital_sample'.$i].",".$song_files['title'.$i].",1)");
		}
	}
	unset($record);
	$record['cat_id'] = $db->mySQLSafe($_POST['cat_id']);
                $record['productId'] = $prodid;
	//////////////////////////////////////////////////////////////////////////////////////////
	$insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record);
	unset($record);

	if($insert == TRUE){

		$msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['add_success']."</p>";

		// notch up amount of products in category
		$db->categoryNos($_POST['cat_id'], "+");

	} else {
		$msg = "<p class='warnText'>".$lang['admin']['products']['add_fail']."</p>";
	}
}

$music_upload->assign("VAL_ACTION","cart.php?act=musicUpload");

Link to comment
https://forums.phpfreaks.com/topic/64286-upload-music-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.