Jump to content

xadz

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by xadz

  1. Right, so this is my code now. <?php // Mochiads RSS Game Grabber // grabgames.php set_time_limit(99000); ini_set("memory_limit","-1"); $category['Action']="1"; $category['Adventure']="2"; $category['Board Game']="3"; $category['Casino']="4"; $category['Customize'] = "5"; $category['Dress-Up']="6"; $category['Driving']="7"; $category['Fighting']="8"; $category['Other']="9"; $category['Puzzles']="10"; $category['Shooting']="11"; $category['Sports']="12"; $defaultcategory="no"; include_once("../includes/config.php"); if(empty($mochifeedurl)){ echo "The Mochiads RSS Feed is not listed in your config.php file.<br/><br/>Please login to your <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> account and grab your customerid number. Then go to you admin panel to input it:<br/><br/> If you haven't signed up for a <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> account, head over to <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> and signup for a publisher account.<br/>"; return; } $feedurl=$mochifeedurl; // Now that we selected a feed, its time to grab it! $feed = $feedurl; $feed =implode('',$feedurl);//implode feed $curl = curl_init($feed); //get curl $data = curl_exec($curl);//execute curl curl_close($curl);//close curl preg_match_all ("/<entry>([^`]*?)<\/entry>/", $data, $matches); foreach ($matches[0] as $match) { // First Get The Game Title preg_match ("/<title>([^`]*?)<\/title>/", $match, $temp); $title = ucwords(strtolower(stripslashes($temp[1]))); preg_match ("/<media:description>([^`]*?)<\/media:description>/", $match, $temp); $description = stripslashes($temp[1]); preg_match ("/<media:keywords>([^`]*?)<\/media:keywords>/", $match, $temp); $tags = stripslashes($temp[1]); preg_match ("/<media:thumbnail([^`]*?)url=\"([^`]*?)\"/", $match, $temp); $image = stripslashes($temp[2]); preg_match ("/<media:player([^`]*?)url=\"([^`]*?)\"/", $match, $temp); $filename = stripslashes($temp[2]); preg_match ("/<category term=\"([^`]*?)\"/", $match, $temp); $categoryname = stripslashes($temp[1]); if($category[''.$categoryname.'']=="no") $cat=""; elseif(!empty($category[''.$categoryname.''])) $cat=$category[''.$categoryname.'']; else $cat=$defaultcategory; preg_match ("/<id>urn:uuid:([^`]*?)<\/id>/", $match, $temp); $mochi = stripslashes($temp[1]); echo "$title<br/>$image<br/>$filename<br/>$description<br/>$tags<br/>$categoryname<br/>$cat<br/>$mochi<br/><br/>"; if(!empty($title) && !empty($image) && !empty($filename) && !empty($mochi) && !empty($cat)){ // Check to see if url is already in system. $query2 = "SELECT gameid from games WHERE mochi = '$mochi'"; $result2 = mysql_query($query2); if (mysql_num_rows($result2)>0) { }else{ $alphanum = "APBHCPDEFGHIJKLILNKMDRNOPPERQRSTUVWXYZ123456789"; // generate a random 3 character code to play in front of a duplicate file name that // has been transferred. $rand = substr(str_shuffle($alphanum), 0, 3); $filedirectory = "../games/files/"; if ($auto_chmod ==1) chmod("$filedirectory",0777); $name = $filename; while(strstr($name,"/")){ $name = substr($name,strpos($name,"/")+1,999); } $newname = $filedirectory.$name; // End -- Get the file name. (Dont Edit) // Make sure that filename isn't already in the directory ... if it is, rename it if (file_exists($newname)) { $name = $rand.'_'.$name; $newname = $filedirectory.$name; } // End the renaming if ($transfer_type == 1){ copy($filename, $newname); }else{ $ch = curl_init ($filename); $fp = fopen ($newname, "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); curl_close ($ch); fclose ($fp); } if ($auto_chmod ==1) chmod("$filedirectory",0755); $alphanum = "APBHCPDEFGHIJKLILNKMDRNOPPERQRSTUVWXYZ123456789"; // generate a random 3 character code to play in front of a duplicate file name that // has been transferred. $rand = substr(str_shuffle($alphanum), 0, 3); $imagedirectory = "../games/images/"; if ($auto_chmod ==1) chmod("$imagedirectory",0777); $name2 = $image; while(strstr($name2,"/")){ $name2 = substr($name2,strpos($name2,"/")+1,999); } $newname2 = $imagedirectory.$name2; // End -- Get the file name. (Dont Edit) // Make sure that filename isn't already in the directory ... if it is, rename it if (file_exists($newname2)) { $name2 = $rand.'_'.$name2; $newname2 = $imagedirectory.$name2; } // End the renaming if ($transfer_type == 1){ copy($image, $newname2); }else{ $ch = curl_init ($image); $fp = fopen ($newname2, "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); curl_close ($ch); fclose ($fp); } if ($auto_chmod ==1) chmod("$imagedirectory",0755); $now = time(); $title=addslashes($title); $description=addslashes($description); $update_item = mysql_query("INSERT INTO games set gametitle = '$title', gamedesc = '$description', gamefile = '$name', gameicon = '$name2', gamekeywords='$tags', gamestatus = '1', category = '$cat', mochi='$mochi', dateadded = '$now'"); echo "Just Added <b>$title</b><br/>"; } } } ?> And this is the error message I get, Warning: implode() [function.implode]: Invalid arguments passed in /home/howlingd/public_html/mochi/grabgames.php on line 40
  2. This still remains unsolved.
  3. That displays the feed now, but it doesn't seem to be inserting the games.
  4. I'm not entirley sure, my host said the issue would be the fact the allow_url_fopen was turned off, and I could rectify it by editing it to use cURL, which is why I'm here.
  5. Ah, sorry. <?php /* script: config.php */ include("dbinfo.php"); $securitykey="*****IM NOT TELLING THIS :|*****"; $ttocs = ((10 + 12 + 79 - 1)/50 + 3).".0"; // Default Avatar $default_avatar = "noavatar.jpg"; $defaulticon = $base_url."images/nothumb.gif"; if(file_exists("./cache/config.php")) include("./cache/config.php"); else{ // Pulls all the Site Config data from the database $query = "select * from siteconfig"; $result = mysql_query($query); if (!$result) return; if(mysql_num_rows($result)) { while($row = mysql_fetch_array($result)) { $site_title = $row['sitetitle']; $site_desc = $row['sitedescription']; $site_keywords = $row['sitekeywords']; $base_url = $row['baseurl']; $contact_email = $row['contactemail']; $max_results = $row['maxresults']; $max_frontpage_results = $row['maxfrontpage']; $max_newest_games = $row['maxnewestgames']; $max_most_played_games = $row['maxmostplayedgames']; $linktrading = $row['linktrading']; $notify_of_trade = $row['tradenotification']; $confirmation_of_trades = $row['tradeconfirmation']; $tell_a_friend = $row['tellafriend']; $email_confirmation = $row['emailconfirmation']; $game_points = $row['pointsforgames']; $comment_points = $row['pointsforcomments']; $member_login = $row['memberlogin']; $allow_comments = $row['comments']; $max_comments = $row['maxcomments']; $who_can_comment = $row['whocancomment']; $max_top_players = $row['maxtopplayers']; $sort_top_players = $row['sorttopplayers']; $ban_text = $row['bantext']; $rewrite = $row['rewrite']; $max_messages = $row['maxmessages']; $adminuserid = $row['adminuserid']; $imageverification = $row['imageverification']; $maxgameheight = $row['maxfileheight']; $maxgamewidth = $row['maxfilewidth']; $guestcredits = $row['guestcredits']; $limitplays = $row['limitplays']; $notes = $row['notes']; $privatemessaging = $row['privatemessaging']; $maxtoplinks = $row['maxtoplinks']; $sorttoplinks = $row['sorttoplinks']; $sortlinks = $row['sortlinks']; $realurl = $row['realurl']; $trackclicks = $row['trackclicks']; $sitestatus = $row['sitestatus']; $offlinemessage = $row['offlinemessage']; $delay = $row['inbetween']; $delaytime = $row['inbetweendelay']; $blogcode = $row['blogcode']; //Start GAME TIME MOD by BigDogAdmin $gamelimit = $row['gamelimit']; //End GAME TIME MOD by BigDogAdmin $hotlink = $row['hotlink']; $mostpopularlist = $row['mostpopularlist']; $newestlist = $row['newestlist']; $topmemberslist = $row['topmemberslist']; $referrals = $row['referrals']; $referralpoints = $row['referralpoints']; $removereported = $row['removereported']; $submissions = $row['submissions']; $submit_member = $row['submitmember']; $template_directory = $row['templatedirectory']; $mochi_id = $row['mochicustid']; $mochinumbergames = $row['mochinumbergames']; $nightly=$row['nightly']; $friends_feature=$row['friends']; $friendrequestemail=$row['friendrequestemail']; $comment_spam_filter=$row['spamfilter']; $sedir=$row['sedir']; $full_game_url = $row['fullgamedir']; $preview_game=$row['previewgame']; $preview_play_game_dir=$row['previewgamedir']; $full_height=$row['fullheight']; $full_width=$row['fullwidth']; $log_user=$row['loguser']; $auto_chmod=$row['autochmod']; $transfer_type=$row['transfertype']; $gameplaylog=$row['gameplaylog']; $gameplaylogdays=$row['gameplaylogdays']; } } } $mochi_id=str_replace(" ","",$mochi_id); $mochifeedurl = "http://www.mochiads.com/feeds/games/$mochi_id/all/all?limit=$mochinumbergames"; if(!empty($base_url)) $_SESSION['base_url']=$base_url; if(!empty($temlpate_directory)) $_SESSION['template_directory']=$template_directory; ?>
  6. It'd be interesting if you could post your findings, as I too, and I'm sure others are also confused.
  7. Nope, that's the entire file.
  8. The money is still up for grabs!
  9. Could somebody PLEASE alter this script to not use allow_url_fopen (which is blocked on my host, 3ix) to use cURL (which they reccomend). I have absaloutley NO idea whatsoever, any help would be enormously appreciated. The code is below. <?php // Mochiads RSS Game Grabber // Developed by Scott Lewis at www.worksafegames.com // To work with phpArcadeScript v3.0 set_time_limit(8000); $category['Action']="1"; $category['Adventure']="33"; $category['Board Game']="34"; $category['Casino']="28"; $category['Dress-Up']="40"; $category['Driving']="41"; $category['Fighting']="42"; $category['Other']="7"; $category['Puzzles']="4"; $category['Shooting']="38"; $category['Sports']="2"; $defaultcategory="no"; include_once("../includes/config.php"); if(empty($mochifeedurl)){ echo "The Mochiads RSS Feed is not listed in your config.php file.<br/><br/>Please login to your <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> account and grab your customerid number. Then go to you admin panel to input it:<br/><br/> If you haven't signed up for a <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> account, head over to <a href=\"https://www.mochiads.com/r/06b1921204bda96b\">Mochiads</a> and signup for a publisher account.<br/>"; return; } $feedurl=$mochifeedurl; // Now that we selected a feed, its time to grab it! $feed = $feedurl; $data = implode("", file($feed)); preg_match_all ("/<entry>([^`]*?)<\/entry>/", $data, $matches); foreach ($matches[0] as $match) { // First Get The Game Title preg_match ("/<title>([^`]*?)<\/title>/", $match, $temp); $title = ucwords(strtolower(stripslashes($temp[1]))); preg_match ("/<media:description>([^`]*?)<\/media:description>/", $match, $temp); $description = stripslashes($temp[1]); preg_match ("/<media:keywords>([^`]*?)<\/media:keywords>/", $match, $temp); $tags = stripslashes($temp[1]); preg_match ("/<media:thumbnail([^`]*?)url=\"([^`]*?)\"/", $match, $temp); $image = stripslashes($temp[2]); preg_match ("/<media:player([^`]*?)url=\"([^`]*?)\"/", $match, $temp); $filename = stripslashes($temp[2]); preg_match ("/<category term=\"([^`]*?)\"/", $match, $temp); $categoryname = stripslashes($temp[1]); if($category[''.$categoryname.'']=="no") $cat=""; elseif(!empty($category[''.$categoryname.''])) $cat=$category[''.$categoryname.'']; else $cat=$defaultcategory; preg_match ("/<id>urn:uuid:([^`]*?)<\/id>/", $match, $temp); $mochi = stripslashes($temp[1]); echo "$title<br/>$image<br/>$filename<br/>$description<br/>$tags<br/>$categoryname<br/>$cat<br/>$mochi<br/><br/>"; if(!empty($title) && !empty($image) && !empty($filename) && !empty($mochi) && !empty($cat)){ // Check to see if url is already in system. $query2 = "SELECT gameid from games WHERE mochi = '$mochi'"; $result2 = mysql_query($query2); if (mysql_num_rows($result2)>0) { }else{ $alphanum = "APBHCPDEFGHIJKLILNKMDRNOPPERQRSTUVWXYZ123456789"; // generate a random 3 character code to play in front of a duplicate file name that // has been transferred. $rand = substr(str_shuffle($alphanum), 0, 3); $filedirectory = "../games/files/"; if ($auto_chmod ==1) chmod("$filedirectory",0777); $name = $filename; while(strstr($name,"/")){ $name = substr($name,strpos($name,"/")+1,999); } $newname = $filedirectory.$name; // End -- Get the file name. (Dont Edit) // Make sure that filename isn't already in the directory ... if it is, rename it if (file_exists($newname)) { $name = $rand.'_'.$name; $newname = $filedirectory.$name; } // End the renaming if ($transfer_type == 1){ copy($filename, $newname); }else{ $ch = curl_init ($filename); $fp = fopen ($newname, "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); curl_close ($ch); fclose ($fp); } if ($auto_chmod ==1) chmod("$filedirectory",0755); $alphanum = "APBHCPDEFGHIJKLILNKMDRNOPPERQRSTUVWXYZ123456789"; // generate a random 3 character code to play in front of a duplicate file name that // has been transferred. $rand = substr(str_shuffle($alphanum), 0, 3); $imagedirectory = "../games/images/"; if ($auto_chmod ==1) chmod("$imagedirectory",0777); $name2 = $image; while(strstr($name2,"/")){ $name2 = substr($name2,strpos($name2,"/")+1,999); } $newname2 = $imagedirectory.$name2; // End -- Get the file name. (Dont Edit) // Make sure that filename isn't already in the directory ... if it is, rename it if (file_exists($newname2)) { $name2 = $rand.'_'.$name2; $newname2 = $imagedirectory.$name2; } // End the renaming if ($transfer_type == 1){ copy($image, $newname2); }else{ $ch = curl_init ($image); $fp = fopen ($newname2, "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); curl_close ($ch); fclose ($fp); } if ($auto_chmod ==1) chmod("$imagedirectory",0755); $now = time(); $title=addslashes($title); $description=addslashes($description); $update_item = mysql_query("INSERT INTO games set gametitle = '$title', gamedesc = '$description', gamefile = '$name', gameicon = '$name2', gamekeywords='$tags', gamestatus = '1', category = '$cat', mochi='$mochi', dateadded = '$now'"); echo "Just Added <b>$title</b><br/>"; } } } ?> I'll probably make a small monetary donation via paypal to anybody who does it by tonight.
×
×
  • 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.