PHP code with database issue.

Discussion in 'HTML & Website Design' started by CodeE, Jul 25, 2008.

  1. #1
    This is a MySpace friend adder site script that i purchased off of DP in May, I am having a problem getting the image to retrieve itself from MySpace.

    This is the code from the "update" page where you login.


    ************************************************
    $page=file_get_contents(PROFILE_VIEW . $id);
    
    ereg('<span class="nametext">(.*)</span><br />', $page, $resultDname);
    $dname=$resultDname[1];
    
    $u="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$id";
    
    $t = join("",file("$u"));
    
    $r = '/ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" .*?"><img border="0" alt="" src="(.*?)"/';
    
    $t = ereg_replace("\n", "", $t);
    
    preg_match_all($r, $t, $m);
    
    preg_match("/<a(.*) id=\"ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage\" href=\"(.*)\"><img(.*) src=\"(.*?)\" (.*)\/>/",$page,$match);
    
    $img=$match[4];
    
    			preg_match("/<span class=\"nametext\".*>?<\/span>/is",$page,$match_name);
    
    			$subname    = substr($match_name[0],0,200);
    			$name       = strip_tags($subname,"<span>");
    			$name = trim($name);
                            $subname    = substr($name,0,200);
                            $name       = strip_tags($subname,"</span>");
                            $name = trim($name);
    			$len_name   = strlen($name);
    			$name_final = substr($name,23,($len_name-30));
    
    
    $query = "UPDATE fc_users SET image='$img', dname='$name_final' WHERE fid='$id'";
    
    mysql_query($query);
    ******************************************[/COLOR]
    
    This is a current code taken from the MySpace Default image area:
    
    [COLOR="Blue"]*******************************************
    <a id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" href="http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewAlbums&amp;friendID=398339604">
    
    <img border="0" alt="" src="http://a625.ac-images.myspacecdn.com/images01/88/m_8b9bcb8af679339ef24320d94c649df0.jpg" /></a>
    *****************************************[/COLOR]
    
    I will be happy to provide more code if needed.  Can anyone help or steer me in the right direction?  :o
    PHP:
     
    CodeE, Jul 25, 2008 IP