Raised This Month: $ Target: $400
 0% 

Problem with show_motd Web


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 12-02-2009 , 17:01   Re: Problem with show_motd Web
Reply With Quote #1

And is not there a way to avoid the doctype problem? like an iframe or something like that?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-02-2009 , 17:10   Re: Problem with show_motd Web
Reply With Quote #2

You can use sockets to retrieve the html markup of the site and then display that in the motd.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-02-2009 , 18:24   Re: Problem with show_motd Web
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
Did you even tried that yourself.
Yep, tested it. That's how I found out.

Quote:
Originally Posted by Exolent[jNr] View Post
You can use sockets to retrieve the html markup of the site and then display that in the motd.
With this we are then limited by the character limit.

If they have a webserver they could parse the html in php and output it without the doctype declaration.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-02-2009 , 22:10   Re: Problem with show_motd Web
Reply With Quote #4

website.php
PHP Code:
<?php
    
function GetWebsiteContents$website ) {
        
$temp_filename "curl_website_download.txt";
        
$file_handle fopen$temp_filename"w" );
        
        
$curl_handle curl_init$website );

        
curl_setopt$curl_handleCURLOPT_FILE$file_handle );
        
curl_setopt$curl_handleCURLOPT_HEADER);

        
curl_exec$curl_handle );
        
curl_close$curl_handle );
        
        
fclose$file_handle );
        
        
$contents file_get_contents$temp_filename );
        
        
unlink$temp_filename );
        
        return 
$contents;
    }
    
    
$contents GetWebsiteContents$_GET"website" ] );
    
    
$doc_start stripos$contents"<!DOCTYPE" );
    if( 
$doc_start != false ) {
        
$doc_stop stripos$contents">"$doc_start );
        
        
$contents substr$contents0$doc_start ) . substr$contents$doc_stop );
    }
    
    echo 
$contents;
?>
Code:
#include < amxmodx > #include < amxmisc > public plugin_init( ) {     register_plugin( "Website Viewer", "0.0.1", "Exolent" );     register_concmd( "website", "CmdWebsite" ); } public CmdWebsite( iPlayer ) {     new szWebsite[ 192 ];     read_args( szWebsite, 191 );     remove_quotes( szWebsite );     StringURLEncode( szWebsite, szWebsite, 191 );         new szURL[ 256 ];     foramtex( szURL, 255, "http://www.yourwebsite.com/website.php?website=%s", szWebsite );         show_motd( iPlayer, szURL, "OhHai!" );         return PLUGIN_HANDLED; } stock StringURLEncode( const szInput[ ], szOutput[ ], const iLen ) {     static const HEXCHARS[ 16 ] = {         0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,         0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F     };         new iPos, cChar, iFLen;     while( ( cChar = szInput[ iPos ] ) && iFLen < iLen )     {         if( cChar == 0x20 )         {             szOutput[ iFLen++ ] = 0x2B;         }         else if( !( 0x41 <= cChar <= 0x5A )         && !( 0x61 <= cChar <= 0x7A )         && !( 0x30 <= cChar <= 0x39 ) )         {             if( ( iFLen + 3 ) > iLen )             {                 break;             }             else if( cChar > 0xFF )             {                 cChar = 0x2A;             }                         szOutput[ iFLen++ ] = 0x25;             szOutput[ iFLen++ ] = HEXCHARS[ cChar / 16 ];             szOutput[ iFLen++ ] = HEXCHARS[ cChar % 16 ];         }         else         {             szOutput[ iFLen++ ] = cChar;         }                 iPos++;     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode