Jump to content

euroiplayer

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

euroiplayer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello everyone, Can somebody help me out with this, I can't figure out how to do this. I am trying to grab data from a HTML page and parse/grabb it into XML or RSS type page. This would be the HTML for example... [code]                   <tr>                                 <td align="center" valign="top" width="150" bgcolor="FF9933" style="word-wrap: break-word">                                     <a href="http://linkhere.com/index.cfm?id=33333829">                                         name_here_1                                     </a>                                     <br>                                     <br>                                     <a href="http://linkhere.com/link">                                         <img src="http://picturelink.com/picture.jpg" border="0"></a><br>                                         <DIV style="width:80px;height:20px;"></div>                                     <br>                                     <br>                                 </td>                                 <td bgcolor="F9D6B4" align="left" valign="top" width="260" style="word-wrap: break-word">                                     <span class="blacktext10">                                         Jan 10 2007 5:42P                                     </span>                                     <br>                                     <br>                                     blah blah blah... text goes here... blah blah blah...                                 </td>                             </tr>[/code] This would be the output that data would be grabbed from HTML* and parsed into XML... [code] <?xml version="1.0" encoding="UTF-8"?> <first_child> <commentData> <userID>33333829</userID> <thumbnail>http://picturelink.com/picture.jpg</thumbnail> <postedDate>Jan 10 2007 5:42P</postedDate> <userName>name_here_1</userName> <commentText>blah blah blah... text goes here... blah blah blah...</commentText> </commentData> </first_child> [/code] If anybody could solve this for me would be great and I appreciate your help alot! Thanks.
  2. There is soo little information on cURL, and I don't know a thing about it. Does anybody know how to go on about this? Is this useful in any way of what I am trying to do? [quote] curl -A 'ELinks/0.9.2 (textmode; Linux; 80x24)' --trace-ascii /tmp/trace -L -b cookies.txt -c cookies.txt -d 'email=xxxx%40gmail.com&password=xxxxx&Submit22.x=0&Submit22.y=0' http://www.myspace.com/index.cfm?fuseaction=login.process [/quote]
  3. Yes true, but thats not what I was exactly looking for :) Anybody knows how to do this (any info would be great help)?
  4. Hello everyone, I been trying to figure this out but haven't been able to. Is it possible to get the content on somebody's [b]private[/b] myspace comments profile if you're one of their friends. I am thinking it would first login to myspace, and then read the comments of that profile. Tell me is it possible, and if so with what, php or perl..?
  5. I found a solution, here it is: $show_extensions = array( '.*' ); That will show all file extensions.
  6. Here is the source code for those of you that want to view it. [quote]http://firlas722.100webspace.net/source0284.txt Line 14: $show_extensions = array( 'php' , 'php3' , 'htm' , 'html' , 'shtm' , 'shtml' , 'jpg' , 'jpeg' , 'png' , 'gif' , 'js' ); [/quote] I would like Line 14 to view all files with all the type of extensions, not where I have to list them one by one. Thanks
  7. Hello, I need help with a line, I can't get it to show all the extensions instead of listing them one by one. This is the code where you list all the file extensions which you want to be visible: [quote][url=http://firlas722.100webspace.net/source0284.txt]http://firlas722.100webspace.net/source0284.txt[/url] Line 14: $show_extensions = array( 'php' , 'htm' , 'html' , 'shtm' , 'shtml' , 'jpg' , 'jpeg' ); [/quote] Can anybody help me with this? Thanks
  8. alpine whats wrong with asking if somebody has a pre-made script and is willing to share it? And besides, afterwards I provide them with the code I already have and Im asking if someone could help me out fix the bugs. Hope you understand the difference, take care.
  9. I've taken the SCV (Source Code Viewer) from http://www.randomchaos.com/ Code: http://www.randomchaos.com/source/?source=http%3A%2F%2Fwww.randomchaos.com%2Fsource%2Findex.php I took the code and tried to edit it as much as I can and make it work, but I am getting a couple of errors. Eorrs Im getting: [quote]Notice: Undefined index: source in /www/1111mb.com/e/u/r/euroiplaye/htdocs/source.php on line 114 Notice: Undefined index: source in /www/1111mb.com/e/u/r/euroiplaye/htdocs/source.php on line 114 Notice: Undefined index: format in /www/1111mb.com/e/u/r/euroiplaye/htdocs/source.php on line 123 Fatal error: Call to undefined function: getheader() in /www/1111mb.com/e/u/r/euroiplaye/htdocs/source.php on line 180[/quote] Here is the code: [quote] <?php        // Source     // View source on randomchaos.com     //     // Copyright 2002-2005 Scott Reynen     //     // This program is free software; you can redistribute it and/or modify     // it under the terms of the GNU General Public License as published by     // the Free Software Foundation; either version 2 of the License, or     // (at your option) any later version.     //     // This program is distributed in the hope that it will be useful,     // but WITHOUT ANY WARRANTY; without even the implied warranty of     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     // GNU General Public License for more details:     // <http://www.gnu.org/licenses/gpl.txt>     $root = '/www/1111mb.com/e/u/r/euroiplaye/htdocs/';         $color_to_class = array(         '#ff8000' => 'comment' ,         '#dd0000' => 'quote' ,         '#0000bb' => 'variable' ,         '#007700' => 'keyword'     );         function from_replace( $matches )     {             global $database_base;                 return preg_replace(             '#`([^`]*)`#' ,             '`<a href="' . $database_base . '\1/">\1</a>`' ,             $matches[0]         );         } // from_callback         function lowercase_color( $matches )     {             global $color_to_class;                 $class = $color_to_class[ strtolower( $matches[1] ) ];                 if ( $class != '' ) return 'class="' . $class . '"';             return 'style="color: ' . strtolower( $matches[1] ) . '"';         } // lowercase_color         /**     * The following function adapted from:     * http://us3.php.net/manual/en/function.highlight-string.php#56642     */         function xhtml_highlight( $str )     {             $hlt = highlight_string( stripslashes( $str ) , true );         $fon = str_replace(             array( '<font ' , '</font>' ) ,             array( '<span ' , '</span>' ) ,             $hlt         );         return preg_replace_callback(             '#style="color: (.*?)"#' , 'lowercase_color' , $fon         );             } // xhtml_highlight         $disallow = '/(accounts.|disemployed|ownsociety|bloomington-normal|expeditious|boobtubecube|fastr)/';         $files['url'] = array();     $skipDir = array(         '/www/1111mb.com/e/u/r/euroiplaye/htdocs/66' ,     );     function getFiles( $dir ) {             global $files , $skipDir;                       error_reporting( E_ERROR | E_PARSE );                 if (             ( ! in_array( $dir , $skipDir ) ) &&             ( $handle = opendir( $dir ) )         )         {                               while ( false !== ( $file = readdir( $handle ) ) )             {                             if ( preg_match( "/.(php|js|inc|css)$/" , $file ) )                     $files['url'][] = $dir . '/' . $file;                                 if (                     ($file != '.' && $file != '..' ) &&                     ( is_dir( $dir . '/' . $file ) )                 )                     getFiles( $dir.'/'.$file );                                     } // while                         closedir( $handle );                         } // if                 } // getFiles         $source = ( $_GET['source']  != '' ) ? $_GET['source'] : $_POST['source'];         /**     * Remove any query string     */         $source_parts = explode( '?' , $source );     $source = $source_parts[0];         if ( $_GET['format'] == 'txt' )     {                 if ( $source == '' )             header( 'Location: ' . $THIS_URL );                             /**         * Get requested file            */                 $fileName = '../' . preg_replace(             array(                 '#http://euroiplaye.1111mb.com/#' ,             ) , array( '' , '\1/' ) , $source         );                 /**         * Check for disallowed files         */                 if (             preg_match( $disallow , $fileName ) ||             ( substr( $source , 0 , 7 ) != 'http://' )         ) header( 'Location: ' . $THIS_URL );             if ( substr( $fileName , -1 , 1 ) == '/' )             $fileName.= 'index.php';                     if (! $source_file = @file( $fileName ) )             header( 'Location: ' . $THIS_URL );             $file_name_parts = explode( '/' , $fileName );         $simple_file_name = $file_name_parts[ count( $file_name_parts ) - 1 ];             header("Content-type: application/octet-stream");         header("Content-Disposition: attachment; filename=" . $simple_file_name );         header("Pragma: no-cache");         header("Expires: 0");         echo( implode( '' , $source_file ) );         die();         } // if     else     {     ?> <?= '<?xml version="1.0" encoding="utf-8"?>' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">     <head>         <title>TITLE</title>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         <link rel="stylesheet" href="new_randomchaos.css" type="text/css" />     </head>     <body>         <div id="container">             <?= getHeader() ?>             <div id="content"> <?php         if ( $source != '' ) {                         /**         * Show requested file            */                 $fileName = '../' . preg_replace(             array(                 '#http://euroiplaye.1111mb.com/#'             ) , array( '' , '\1/' ) , $source         );                         ?>                 <h2>Source for '<?= htmlentities( $source ) ?>':</h2> <?php                 /**         * Check for disallowed files         */                 if (             preg_match( $disallow , $fileName ) ||             ( substr( $source , 0 , 7 ) != 'http://' )         ) {         ?>                 <p class="message">Sorry, the source you requested is hidden for security.</p> <?php         } // if         else         {                               if ( substr( $fileName , -1 , 1 ) == '/' )                 $fileName.= 'index.php';                         if (! $source_file = @file( $fileName ) )             {             ?>                 <p class="message">Sorry, the file you requested could not be opened.</p> <?php                             } // if             else {                                       $highlighted_source = xhtml_highlight( implode( '' , $source_file ) , TRUE );                                                     /**                 * Link references to other files or database tables                 */                             $link_base = 'http://euroiplaye.1111mb.com/?source=';                 $link_base.= urlencode( 'http://euroiplaye.1111mb.com/' );                                 $include_regex = '#(<span[^>]*>s*$roots*</span>';                 $include_regex.= '<span[^>]*>s*.s*</span><span[^>]*>';                 $include_regex.= '[\'|"])([^\'"]*)([\'|"])#';                                 $database_base = 'http://euroiplaye.1111mb.com/';                                 $sql_regex = '#((?:UPDATE|DELETE FROM|INSERT INTO)s*`)([^`]*)(`)#';                 $regex = array(                     $include_regex ,                     $sql_regex                 );                                 $replace = array(                     '\1<a href="' . $link_base . '\2">\2</a>\3' ,                     '\1<a href="' . $database_base . '\2/">\2</a>\3'                 );                                 $linked_source = preg_replace(                     $regex , $replace , $highlighted_source                 );                                         $from_regex = '#FROM.*?WHERE#';                                 $linked_source = preg_replace_callback(                     $from_regex , 'from_replace' , $linked_source                 );                         ?>             <p><a href="<?= $THIS_URL ?>?source=<?= urlencode( $source ) ?>&format=txt">Download</a></p>             <p>See room for improvement? Please <a href="#comments">leave a comment</a> with any suggested changes. Any changes I use will be credited in the source code.</p>             <div>                 <?= $linked_source ?>             </div> <?                 /**                 * If URL doesn't have record in database, add it                 */                                 $clean_source = preg_replace( '#index.php$#' , '' , $source );                                 $url_sql = 'SELECT `id` FROM `url`                 WHERE `url` = "' . $clean_source . '"';                                 $url_result = mysql_query( $url_sql , DB );                                 if ( mysql_num_rows( $url_result ) == 0 )                 {                                     $url_insert_sql = 'INSERT INTO `url`                     ( `url` ) VALUES ( "' . $clean_source . '" )';                                     mysql_query( $url_insert_sql , DB );                                         $url_id = mysql_insert_id( DB );                                 } // if                 else                 {                                     $url = mysql_fetch_object( $url_result );                     $url_id = $url->id;                                 } // else                                 /**                 * If URL record isn't referenced by source, add reference                 */                                 $reference_sql = 'SELECT `id` FROM `reference`                 WHERE `toid` = ' . $url_id . '                 AND `totype` = "url"                 AND `fromid` = 1                 AND `fromtype` = "url"';                                 $reference_result = mysql_query( $reference_sql , DB )                     or die( mysql_error() );                                 if ( mysql_num_rows( $reference_result ) == 0 )                 {                                     $reference_insert_sql = 'INSERT INTO `reference`                     ( `toid` , `totype` , `fromid` , `fromtype` )                     VALUES                     ( ' . $url_id . ' , "url" , 1 , "url" )';                                     mysql_query( $reference_insert_sql , DB );                                         $reference_id = mysql_insert_id( DB );                                                     } // if                 else                 {                                     $reference = mysql_fetch_object( $reference_result );                     $reference_id = $reference->id;                                 } // else                                                 /**                 * Point comments to source reference of URL                 */                                 $reference_sql = 'SELECT * FROM `reference`                 WHERE `id` = ' . $reference_id;                                 $reference_result = mysql_query( $reference_sql , DB );                 $reference = new reference( mysql_fetch_object( $reference_result ) );                 $reference->html_display_comments();             } // else                      } // else             } // if     else     {         /**         * Show file list         */     ?>                 <p>The following is a list of all available source code on randomchaos.com. At the bottom of every page is a link to that page's source code. This list includes all such pages as well as javascript and other external source code. If you have any questions or comments on the code, please contact me.</p>                 <ul> <?php                 $path = realpath( '../' );                         getFiles( $path );                 while (list( $key , $val ) = each( $files['url'] ) )         {             $files['url'][$key] = preg_replace(                 array(                     '#/www/1111mb.com/e/u/r/euroiplaye/htdocs/svhp#'                 ) ,                 array(                        'http://weblog.randomchaos.com/'                 ) , $val             );             if ( ! preg_match( $disallow , $files['url'][$key] ) )             { ?>                     <li><a href="<?= $THIS_URL ?>?source=<?= urlencode($files['url'][$key]) ?>"><?= $files['url'][$key] ?></a></li> <?php                         } // if                         } // while         ?>                 </ul> <?php     } // else ?>             </div>             <?= getFooter() ?>         </div>     </body> </html> <?     } // if ?> [/quote] Here is the test site: http://euroiplaye.1111mb.com/source.php http://euroiplaye.1111mb.com/source.txt Anybody could fix these few bugs and make the code work? Thanks
  10. Thanks devnerds and alpine.  Yes, devnerds your script did work, as well as yours alpine, but thats not what I am exactly looking for. Devners, but your code wasn't able to view/edit source code from other directories, but it was able only those that were beneath it beneath it. These two things I'd like the script to do: 1. View all the files from all directories, not just the ones beneath of where this (source code viewer files) is located at. 2. Then if you click on one of the links it provide the source code (not necessarily edit it and save it, just view it.) ( Just like at http://www.dew-code.com/source/ )
  11. keeB, I really don't care about the highlighting as long as it displays the raw source code, but thanks for the info :).
  12. :) Thanks for all the great help Huggie
×
×
  • 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.