Profile Music Uploader

Started on the old forum in September 2009 · view the original in the archive · old links redirect here

25 replies · 1,389 views · started 17 years ago · 2 min read

9 participants
riderz Lead · 975 posts #1

Who can help me convert this avatar uploader to an midi wav uploader for profile what i basicly want is u can go to the uploader and upload ur midi or wav file then it will automaticly be added into ur profile and will play the tunes

and just add a function to remove the music here are the avatar uploader i have

lists.php

///////////////Upload avatar///////////////

else if($action=="upavat")
{
 echo "<head><title>$site_name</title>";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
      echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
      <meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
      <meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
      <meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";

      echo "<body>";
        addonline(getuid_sid($sid),"Uploading avatar image","lists.php?action=$action");
        $whonick = getnick_uid($who);
           echo "<p><u>Choose the pic:</u><br/>
        <form enctype=\"multipart/form-data\" action=\"genproc.php?action=upavat&sid=$sid\" method=\"post\">
        Image(JPG/JPEG image only):<br/>Size limit: 512KB<br/>Image will be resized to fit its width to 128 pixels.
        <input type=\"file\" name=\"attach\"/><br/>
        <input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/></form></p>";
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo "</body>";
}

genproc.php

/////////////////Upload avatar////////////////////////

else if($action=="upavat"){

addonline(getuid_sid($sid),"Uploading avatar image","");

$size = $_FILES['attach']['size']/1024;

$origname = $_FILES['attach']['name'];

$res = false;

$ext = explode(".", strrev($origname));

switch(strtolower($ext[0])){

        case "gpj":

    $res = true;

    break;

    case "gepj":

    $res = true;

    break;

}

$tm = time();

$uploaddir = "./avatars";

if($size>512){

    echo "File is larger than 512KB";

}

else if ($res!=true){

    echo "File type not supported! Please attach only a JPG/JPEG.";

}

else{

    $name = getuid_sid($sid);

    $uploadfile = $name.".".$ext;

    $uppath=$uploaddir."/".$uploadfile;

    move_uploaded_file($_FILES['attach']['tmp_name'], $uppath);

    $filewa=$uppath;

    list($width, $height, $type, $attr) = getimagesize($filewa);

    $newname=$uploaddir."/".$name."u.jpg";

    $newheight = ($height*128)/$width;

    $newimg=imagecreatetruecolor(128, $newheight);

    $largeimg=imagecreatefromjpeg($filewa);

    imagecopyresampled($newimg, $largeimg, 0, 0, 0, 0, 128, $newheight, $width, $height);

    imagejpeg($newimg, $newname);

    imagedestroy($newimg);

    imagedestroy($largeimg);

    $file1=$name."u.jpg";

    unlink($filewa);

        $res1 = mysql_query("UPDATE ibwf_users SET avatar='./avatars/$file1' WHERE id='".$name."'");

}

if($res1){

    echo "Your file $origname was successfully uploaded and set to your profile!";

}

else {

    echo "File couldn't be processed! Check error messages and report to a moderator or admin if applicable.";

}

         echo "<br/><br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo "</body>";

}

usage

echo "<a href=\"lists.php?action=upavat&sid=$sid\">»Upload Avatar</a><br/>";

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #3

i know that one but can u guys help me change the avatar uploader to support midi and wav files to upload into a music folder


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

opticalpigion Lead · 593 posts #4

riderz wrote: i know that one but can u guys help me change the avatar uploader to support midi and wav files to upload into a music folder

so, ? whats the problem ? allow midi and wav extention.

capofret Developer · 225 posts #5

just change the case to midi or wav, instead of jpeg or jpg

then embed the file

LDSWAPWORLD site closed. im busy with other things in life like facebook , send me PM so i can add you 🙂 www.pinoySG.com

don't ask for help if you're not even helping yourself! i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.

External image (may be gone)

srecnica Developer · 174 posts #6

opticalpigion wrote:

<embed src="file location" loop="false" hidden="true" autostart="true">
</embed>
[B]Parse error[/B]:  parse error, unexpected '<' in [B]C:\Program Files\xampp\htdocs\happy1\xhtml\index.php[/B] on line [B]5673[/B]

I do not understand this code ... should not put the echo? shows me this error when I put ...I put this code in action wievuser profile..but it shows we parse error ... how and where to put this code?

riderz Lead · 975 posts #7

sumthing like this!!!

 echo"<embed src=\"music\" loop=\"false\" hidden=\"true\" autostart=\"true\"></embed>"; 

lists.php

///////////////Upload avatar///////////////

else if($action=="upbgs")
{
 echo "<head><title>$site_name</title>";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
      echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
      <meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
      <meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
      <meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";

      echo "<body>";
        addonline(getuid_sid($sid),"Uploading BGS","lists.php?action=$action");
        $whonick = getnick_uid($who);
           echo "<p><u>Choose the File:</u><br/>
        <form enctype=\"multipart/form-data\" action=\"genproc.php?action=upbgs&sid=$sid\" method=\"post\">
        Audio(MIDI/WAV  only):<br/>Size limit: 512KB<br/>I
        <input type=\"file\" name=\"attach\"/><br/>
        <input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/></form></p>";
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo "</body>";
}

genproc.php

anyone who can get this part fixed up it would be gr8 the place where the images are declare must change to midi and wav file

sql

ibwf_users   bgs varchat (100)

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #9

ive tried sumthing else now i just need the code to play music in the background

sql

-- -- Table structure for table ibwf_music

CREATE TABLE ibwf_music ( id int(10) NOT NULL auto_increment, musiclink varchar(150) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEY musiclink (musiclink) ) TYPE=MyISAM AUTO_INCREMENT=5 ;

-- -- Dumping data for table ibwf_music

lists.php

//////////////////////////////////////////////////////Music

else if($action=="music")
{
    addonline(getuid_sid($sid),"Music List","");
    $pstyle = gettheme($sid);
      echo xhtmlhead("Music List",$pstyle);

    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_music"));
    $num_items = $noi[0]; //changable
    $items_per_page= 2;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql

        $sql = "SELECT id, musiclink FROM ibwf_music ORDER BY id DESC LIMIT $limit_start, $items_per_page";

    echo "<p>";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
   {
        echo "<bgsound src=\"$item[1]\" alt=\"music\"/><br/>";
        echo "<a href=\"genproc.php?action=upmusic&musicid=$item[0]\">SELECT</a><br/>";
        echo "<br/>";
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"lists.php?action=music&page=$ppage&view=$view\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"lists.php?action=music&page=$npage&view=$view\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "<form action=\"lists.php\" method=\"get\">";
        $rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/><br/>";
        $rets .= "<input type=\"submit\" value=\"GO\"/>";
        $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";

        $rets .= "</form>";

        echo $rets;
    }
    echo "</p>";
  ////// UNTILL HERE >>
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=cpanel\">";
echo "CPanel</a><br/>";
    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main\"><img src=\"http://coding-talk.com/images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
 exit();
    }

genproc.php

///////////////////////////////////////////////////////////////////Select music
else if($action=="upmusic")
{
    addonline(getuid_sid($sid),"Updating music","");
    $musicid = $_GET["musicid"];
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $musiclink = mysql_fetch_array(mysql_query("SELECT musiclink FROM ibwf_music WHERE id='".$musicid."'"));
  $res = mysql_query("UPDATE ibwf_users SET music='".$musiclink[0]."' WHERE id='".$uid."'");
  if($res)
        {
            echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"o\"/>music Selected<br/>";
        }else{
          echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
        echo "<br/>";

         $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main\"><img src=\"http://coding-talk.com/images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
 exit();
    }

ive tried this in viewuser

  $musiclink = getmusic($who);
  if ($musiclink=="")
  {
  echo "<br/><bgsound src=\"music/$musiclink\" alt=\"music\"/>";
  }else{
  echo "<br/><bgsound src=\"$musiclink\" alt=\"music\"/>";
  }
echo"<br/>";

core.php

/////////////////////////////////////////getmusic

function getmusic($uid)
{
  $music = mysql_fetch_array(mysql_query("SELECT music FROM ibwf_users WHERE id='".$uid."'"));
  return $music[0];
}

ok now i have a lil prob how can i make it to play the music in profile i tried to add the avatar code but did not work


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

srecnica Developer · 174 posts #10

$musiclink = getmusic($who); if ($musiclink=="") { echo " <img src="images/music.jpg" alt="music"/>"; }else{ echo " <img src="$musiclink" alt="music"/>"; } echo" ";

and this will be to hear music? without embed code?

riderz Lead · 975 posts #11

well ive tried the embed code

echo "<embed name=\"$music\"src=\"/music/$musiclink\"loop=\"false\"hidden=\"true\"autostart=\"true\"></embed>";

but it show the music in the folder in every person profile


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

WhiteWarrior Principal · 1,419 posts #12

Search, This Has Been Added Here Before, Im Sure, Anyway.. Edit this to suit your site... it will play the tracks..

<embed src="yourmusicfile.mid" autostart="true" loop="true"> </embed> <noembed> <bgsound src="yourmusicfile.mid" loop="infinite"> </noembed>

Remember, If you want diff music for each person you will need get the link from the database so it can grab it from the folder.. its easy really, just think about how it will work. but also think about, every time someone clicks a profile its going to play music yeah but what the viewer don't know that when ever he.she clicks the profile he will be charged for the music to download to beable to play.. poor user if they use a phone, imagine the phone bill they will get just for visiting your site. Think about things before you decide to go ahead, a costly site = no members.. a normal gprs phone will charge a bomb to download a image let alone a midi song. your choice. good luck 🙂

srecnica Developer · 174 posts #13

no music .....not heard .. musiclink inserted in the database .. all good works but not heard .. I've done in the admincp and adminproc to connect musiclink with the database and it is ok, but the music to be heard not in the profile

riderz Lead · 975 posts #16

wapmetal u also have something to say but why never u help ppl with the codings once just give some codes to help us please


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

srecnica Developer · 174 posts #17

This code is good and works but I have a problem because we only work in the Opera browser on the computer and Mozilla does not work .. and not to autostart true I have to click to start the song

echo "<embed name="$music"src="/music/$musiclink"loop="false"hidden="true"autostart="true"></embed>";

and when I put this code

echo " <bgsound src="music/$musiclink" loop="1"/>";

then we do not work ... signs can only be seen if the player with embed code, but how to set autostart?? ...If I put autostart = false as me and autoestart = true ...and should when autostart = true to the song begins as soon as the load page .. and when autostart = false to begin when you click on the song. and to me the same .. I have to click to start music

capofret Developer · 225 posts #18

the correct code depends on which browser u want it to be played. opera, firefox, internet explorer each has code that it only accepts. mobile browser built in also has its own code. So dont be surprised if it doesnt play. I think some browsers dont allow background music to be played automatically and some require plug in.

LDSWAPWORLD site closed. im busy with other things in life like facebook , send me PM so i can add you 🙂 www.pinoySG.com

don't ask for help if you're not even helping yourself! i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.

External image (may be gone)

capofret Developer · 225 posts #19

riderz wrote: wapmetal u also have something to say but why never u help ppl with the codings once just give some codes to help us please

yeah he always comments that its easy to do but he never gave the code for it to begin with.

his comments are not even helpful. he only makes himself as if he knew everything. look at all his posts.😒

LDSWAPWORLD site closed. im busy with other things in life like facebook , send me PM so i can add you 🙂 www.pinoySG.com

don't ask for help if you're not even helping yourself! i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.

External image (may be gone)

riderz Lead · 975 posts #20

capofret wrote: yeah he always comments that its easy to do but he never gave the code for it to begin with.

his comments are not even helpful. he only makes himself as if he knew everything. look at all his posts.😒

capofret im looking always at his comment he NEVER help he always say ah its easy to do so wara wara etc etc but i never saw him ever help just braging so i dnt know why he is on this coding site coding-talk are here to HELP ppl code not just braging


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close