Basic Outfit viewer 6 posts

OP Mon Jun 18, 2012 5:31 pm
User avatar
  • Gender: Female
  • Posts: 67
  • Joined: Jun, 2012
  • Karma: 10
This outfit viewer was made when I was so freaking bored one night. I made it in less then 30 minutes and surprising it works flawlessly..

this is the whole php script in one massive file. (Clean and simple)

Code
<?php

    /*Users*/
    $users = null;
   
    if($_POST["url_val"] == "")
    {
        echo "Sorry this cannot be blank";
    }else
    {
       
        $matches = "";
        $pattern = "/\bavatar([0-9].*?)=/";
       
        $room = "/\=(.*?)&/";
       
        $string = preg_replace("/room=(.*?)&/", "", $_POST["url_val"])."&";
       
        preg_match_all($pattern, $string, $matches);       
        $url = "http://www.imvu.com/catalog/products_in_scene.php?";
       
        $new_url = "";
       // echo $_POST["url_val"];
        preg_match_all($room, $string, $mas);
        $string2 = array();
       
        for($pie = 0; $pie<count($mas[0]); $pie++)
        {
            $string2[$pie] = $mas[0][$pie];
        }
       // print_r($matches)."<br />";
       
        for($i = 0; $i<count($matches[0]); $i++)
        {
            $string = str_replace("=","",$matches[0][$i]);
            $val = str_replace("avatar","",$string);
            $username = getMetaTitle(file_get_contents("http://www.imvu.com/catalog/web_mypage.php?user=". $val));
            list($junk, $junk2, $user) =split(":", $username);
            $length = strlen($val);
            $characters = 3;
            $start = $length - $characters;
            $end = substr($val , $start,$characters);
            $begin = rtrim($val, $end);
            $new_end = str_replace($end, rand(0, 500), $end);
           
            $new_url = $url."avatar$begin$new_end" . $string2[$i];
            if(!in_array(trim($user), $users, true))
            {
                if($_GET["g"] == "mobile")
                {
                    echo "User <a href='$new_url' target='_blank'>".trim($user)."</a> outfit is below.
                    <span style='float: right'><a href='http://www.imvu.com/catalog/web_mypage.php?user=$val' target='_blank'>View $user Profile</a></span><!--<span class='url'><a href='$new_url'>User ID: $val</a></span>-->
                    <iframe src='$new_url' width='100%' height='350px'>
                        Click here to view if no Iframe <span class='url'><a href='$new_url'>".trim($user)."</a></span>
                    </iframe>
            <br />";
                }else{
            echo "<span style='font-size: 15px'><span class='url'><a href='$new_url'>".trim($user)."'s</a></span> outfit is below.
                    <span style='float: right'><a href='http://www.imvu.com/catalog/web_mypage.php?user=$val'>View $user Profile</a></span><!--<span class='url'><a href='$new_url'>User ID: $val</a></span>-->
                    <iframe src='$new_url' width='100%' height='350px' allowtransparency='true'>
                        Click here to view if no Iframe <span class='url'><a href='$new_url'>".trim($user)."</a></span>
                    </iframe>
            <br />";
            }
            }
        }
       
        //print_r($matches);
    }
    function getMetaTitle($content){
        $pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui";
        if(preg_match($pattern, $content, $match))
        return $match[1];
        else
        return false;
    }
?>



That's pretty much it just access it via a post and/or get :)


and for all you C# nuts heres this same script in ASP.Net 4 MVC4 beta (CSHTML)

Code
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Data.Entity;

namespace Toyz_Portfoilo.sBin
{
    public class OutFitHelper
    {
        public static string GetWebPageTitle(string url)
        {
            // Create a request to the url
            HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;

            // If the request wasn't an HTTP request (like a file), ignore it
            if (request == null) return null;

            // Use the user's credentials
            request.UseDefaultCredentials = true;

            // Obtain a response from the server, if there was an error, return nothing
            HttpWebResponse response = null;
            try { response = request.GetResponse() as HttpWebResponse; }
            catch (WebException) { return null; }

            // Regular expression for an HTML title
            string regex = @"(?<=<title.*>)([\s\S]*)(?=</title>)";

            // If the correct HTML header exists for HTML text, continue
            if (new List<string>(response.Headers.AllKeys).Contains("Content-Type"))
                if (response.Headers["Content-Type"].StartsWith("text/html"))
                {
                    // Download the page
                    WebClient web = new WebClient();
                    web.UseDefaultCredentials = true;
                    string page = web.DownloadString(url);

                    // Extract the title
                    Regex ex = new Regex(regex, RegexOptions.IgnoreCase);
                    return ex.Match(page).Value.Trim();
                }

            // Not a valid HTML page
            return null;
        }

        public static string PageBuilder(string url)
        {
            var sb = new StringBuilder();
            var userInChat = new StringBuilder();
            var oldName = new ArrayList();
            var newName = new ArrayList();
            var newName2 = new ArrayList();
            var outfitName = new ArrayList();
            var outfitName2 = new ArrayList();
            if (url.Contains("imvu.com"))
            {
                url += "&";
                string mainURL = "http://www.imvu.com/catalog/products_in_scene.php?";

                var noRoom = Regex.Replace(url, @"room=(.*?)(&| )", string.Empty);

                foreach (Match match in Regex.Matches(noRoom, @"\bavatar(.*?)=\b"))
                {
                    oldName.Add(match.Groups[1].Value);
                    newName.Add(match.Groups[1].Value);
                }

                //return oldName.Count.ToString();

                foreach (Match match in Regex.Matches(noRoom, @"avatar([0-9].*?)=(.*?)(&| )",RegexOptions.Singleline | RegexOptions.IgnoreCase))
                {
                    outfitName.Add(match.Groups[2].Value);
                }

                //return outfitName.Count.ToString();

                foreach (var t in newName)
                {
                    var ramdom = new Random();
                    var randomNumber = ramdom.Next(101, 501);
                    newName2.Add(t.ToString().Substring(t.ToString().Length - 3) + randomNumber);
                }

                //return newName2.Count.ToString() + newName2[3];

                for (int i = 0; i < outfitName.Count; i++)
                {
                    outfitName2.Add("avatar" + newName2[i] + "=" + outfitName[i]);
                }

                //return (string) outfitName[3];

                for (int i = 0; i < outfitName2.Count; i++)
                {
                    if (!DbHelper.check_exist(string.Format("SELECT * FROM BlockSearch WHERE name = '{0}'", GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" + oldName[i]).Split(':')[2].Trim()), 1))
                    {
                        sb.Append("<a name='" +
                                  GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" + oldName[i]).Split
                                      (':')[2].Trim() +
                                  "' /><span style='font-size: 15px'><span class='url'><a href='http://www.imvu.com/catalog/web_mypage.php?user=" +
                                  oldName[i] + "'>" +
                                  GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" + oldName[i]).Split
                                      (':')[2].Trim() +
                                  "'s</a></span> outfit is below. " +
                                  "<span style='float: right'><a href='http://www.imvu.com/catalog/web_mypage.php?user=" +
                                  oldName[i] + "'>View " +
                                  GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" + oldName[i]).Split
                                      (':')[2].Trim() +
                                  "</a></span><!--<span class='url'><a href='$new_url'>User ID: $val</a></span>-->" +
                                  "<iframe src='" + mainURL + outfitName2[i] +
                                  "' width='100%' height='350px' allowtransparency='true' boreder=0>" +
                                  "Click here to view if no Iframe <span class='url'><a href='http://www.imvu.com/catalog/web_mypage.php?user=" +
                                  oldName[i] + "'>" +
                                  GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" + oldName[i]).Split
                                      (':')[2].Trim() +
                                  "</a></span></iframe></div><hr />");
                            userInChat.Append("<span style='color: blue'><a href='#" +
                                              GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" +
                                                              oldName[i]).Split(':')[2].Trim() + "'>" +
                                              GetWebPageTitle("http://www.imvu.com/catalog/web_mypage.php?user=" +
                                                              oldName[i]).Split(':')[2].Trim() + "</a></span> ");
                    }
                }

                return  "<span style='padding-top:2px'><b>Number of outfits: " + outfitName2.Count + "</b> | Current ursers are: "+ userInChat.ToString().TrimEnd(',') + "</span><hr />" + sb;
            }
            return "Sorry feild is blank or invalid";
        }
    }
}
Tue Jun 19, 2012 12:29 am
User avatar
Administrator
Legendary Family Member
  • Gender: Male
  • Posts: 6284
  • Joined: Jun, 2010
  • Advertisements: 45
  • Karma: 368
Thanks for sharing, maybe one day when we reach your level, we'll be able to do something with these.
Sun Oct 25, 2015 3:18 am
User avatar
TIM Enthusiast
Legendary Family Member
  • Gender: Female
  • Posts: 702
  • Joined: Sep, 2015
  • Advertisements: 1
  • Karma: 0
Thank you so much for sharing this with us! Hope to see more! :pumpkin: :pumpkin: :pumpkin:
Sun Oct 25, 2015 6:12 am
User avatar
  • Gender: Male
  • Posts: 72
  • Joined: May, 2013
  • Karma: 0
Very nice but I need intensive tutorials!
Sun Oct 25, 2015 11:23 am
User avatar
Site Moderator
Legendary Family Member
  • Gender: Male
  • Posts: 712
  • Joined: Mar, 2015
  • Advertisements: 2
  • Karma: 200
kingminoas wrote:
Very nice but I need intensive tutorials!


intensive tutorials about what exactly?

dont know what this does but if it's an hidden outfit viewer you need you can also use this one

~Removed~

it has been working for years and it still does :D
Mon Apr 17, 2017 8:36 pm
User avatar
  • Gender: Male
  • Posts: 84
  • Joined: Feb, 2017
  • Karma: 42
The name dbhelper does not exist in the current contex

....And this is where i get stuck
Anyone help?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT