Jump to content

Recommended Posts

Trying to get a more dynamic signature generator built for a forum based off of IPB, here is some of the code:

 

<?php
function GetUserInfo($ProfileURL){
        $pagecontent = file_get_contents($ProfileURL);
        $start = strpos($pagecontent, "class='pp-name'")+17;
        $end = strpos($pagecontent, "</font> | <a",$start);
        $pagecontent = substr($pagecontent, $start, $end-$start);
        $start = strpos($pagecontent, "<h3")+27;
        $pagecontent = substr($pagecontent, $start, strlen($pagecontent));
        $pagecontent = str_replace("<font color=\"green\">TR: ","",$pagecontent);
        $pagecontent = str_replace(" (","|",$pagecontent);
        $iArray = explode("|",$pagecontent);
        return $iArray;
    }
  			$pronumber = $_POST["pronumber"];

			//$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501");

        $userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser='$pronumber'");
        echo $userinfo[0] . "<br>";
        echo $userinfo[1];
        
?>

 

new to php, the //$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501"); line works,

 

but the uncommented line after returns garbage. what is wrong with my syntax?

 

Tim

Link to comment
https://forums.phpfreaks.com/topic/46252-signature-generator-error/
Share on other sites

Sorry, by garbage I meant that instead of parsing the profile page and spitting out

timelf123
6

(which is what should happen, and works fine if I use the commented line (w/o a variable), but as soon as I add my variable, it spits out a bunch of malformed CSS and html, unformatted/plaintext

 

 

As for posting, yes, my form action is a post

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.