Jump to content

Wanderlei Silva

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by Wanderlei Silva

  1. (cannot find update post) Displaying XML code, is formatted, and takes on my site's CSS style: <?php echo $hiXml->highlight("<note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>")?> But again, the code isn't highlighted like it would be within an IDE.
  2. Hi, I'm using a plugin for PEAR called Text_Highlighter and was hoping for some advice as I've never used a plugin for any language before. In order to have it correctly display some CSS code within a webpage (with line numbers), I have this in my webpage: <?php require_once "Text/Highlighter.php"; require_once "Text/Highlighter/Renderer/Html.php"; $renderer = new Text_Highlighter_Renderer_Html(array("numbers" => HL_NUMBERS_LI, "tabsize" => 4)); ?> <?php $hiHtml =& Text_Highlighter::factory("HTML"); $hiHtml->setRenderer($renderer); $hiCss =& Text_Highlighter::factory("CSS"); $hiCss->setRenderer($renderer); $hiPhp =& Text_Highlighter::factory("PHP"); $hiPhp->setRenderer($renderer); $hiDtd =& Text_Highlighter::factory("DTD"); $hiDtd->setRenderer($renderer); $hiJava =& Text_Highlighter::factory("Java"); $hiJava->setRenderer($renderer); $hiJavascript =& Text_Highlighter::factory("Javascript"); $hiJavascript->setRenderer($renderer); $hiMySql =& Text_Highlighter::factory("MySQL"); $hiMySql->setRenderer($renderer); $hiPerl =& Text_Highlighter::factory("Perl"); $hiPerl->setRenderer($renderer); $hiPython =& Text_Highlighter::factory("Python"); $hiPython->setRenderer($renderer); $hiRuby =& Text_Highlighter::factory("Ruby"); $hiRuby->setRenderer($renderer); $hiSql =& Text_Highlighter::factory("SQL"); $hiSql->setRenderer($renderer); $hiVbScript =& Text_Highlighter::factory("VBSCRIPT"); $hiVbScript->setRenderer($renderer); $hiXml =& Text_Highlighter::factory("XML"); $hiXml->setRenderer($renderer); ?> <?php echo $hiCss->highlight("body { margin:0; padding:0; border:0; width:100%; background:#000; min-width:600px; font-size:90%; background-color:black; } " ) ?> But I find the DOCS to the Text_Highlighter confusing. I'm trying to do two things with the plugin. Highlight the correctly formatted code, so that it overides my css and is coloured like it is in this thread. Also I cannot highlight SQL code, neither coloured highlighting, or line numbers display. The SQL code is formatted within the webpage, but it uses no style at all, it just uses the default black font and there are no line numbers. I use this: $hlSQL =& Text_Highlighter::factory("SQL"); echo $hlSQL->highlight("SELECT * FROM some_table WHERE id = 12"); ?> Can anyone offer some advice on this? It would be most appreciated!
  3. Hello, I am making a PHP site and when users register, I want to have some RSS feeds which they can subscribe to, right now just ones like BBC News feed. When they do they will be displayed on the the homepage of the site. They will be logged in using a session from a PHPbb database/login, but the feeds will display of the homepage of the site, not the forum pages, I have never done this before, and am looking for some advice on how to achieve this as simply as possible. Appreciate any advice. Thanks!
  4. Thanks for the help iarp I have just tried changing ports to port 80 and the exact same error is occurring. I have added an echo to show the contents of the $sock variable, showing: // Open MySQL and Select Database $mysql = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DBASE, $mysql) or die(mysql_error()); // Open UDP Socket $sock = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ) or die(socket_strerror(socket_last_error($sock))); /////////////////////// echo $sock; ///////////////////// // Bind Socket to SOCK_PORT on '0.0.0.0' //socket_bind( $sock, '0.0.0.0', SOCK_PORT ) or die(socket_strerror(socket_last_error($sock))); socket_bind( $sock, '127.0.0.1', SOCK_PORT ) or die(socket_strerror(socket_last_error($sock))); echo $query; // Set Socket to Blocking socket_set_block( $sock ) or die(socket_strerror(socket_last_error($sock))); The database and it's columns do exist inside phpmyadmin, I just cannot escape this error.
  5. Yes, I've tried that and it is still giing me the exact same error. Do I need to configure Apache or anything? The URLs I am attempting to view in my browser are: https://127.0.0.1/submitscore.php http://127.0.0.1/submitscore.php http://localhost/submitscore:8080 http://127.0.0.1/script.php?d=11.22.33 But all give : netstat - ban command does have: showing
  6. Hi, I am trying to open up a socket on an XAMP installation (Windows XP host) but keep receiving the following error: And this is the code: <?php define("SOCK_PORT", 8080); define("SQL_HOST", "127.0.0.1"); define("SQL_USER", "root"); define("SQL_PASS", ""); define("SQL_DBASE", "my_db"); // Add Data function, takes data in form gameid.playerid.score and stores it in MySQL table 'scores' function add_data( $data ) { global $mysql; // Parse $data list($gameid, $playerid, $score) = explode(".", $data); // Construct SQL Query $sql = "INSERT INTO scores(gameid, playerid, score) VALUES(${gameid}, ${playerid}, ${score})"; // Run SQL Query mysql_query( $sql, $mysql ) or die(mysql_error()); } // Open MySQL and Select Database $mysql = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DBASE, $mysql) or die(mysql_error()); // Open UDP Socket $sock = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ) or die(socket_strerror(socket_last_error($sock))); // Bind Socket to SOCK_PORT on '0.0.0.0' socket_bind( $sock, '0.0.0.0', SOCK_PORT ) or die(socket_strerror(socket_last_error($sock))); //socket_bind( $sock, '127.0.0.1', SOCK_PORT ) or die(socket_strerror(socket_last_error($sock))); // Set Socket to Blocking socket_set_block( $sock ) or die(socket_strerror(socket_last_error($sock))); // Loop forever, waiting for connections while(TRUE) { // Get first 65536 bytes from Socket and store as $buf (also get $clientip and $clientport) socket_recvfrom( $sock, $buf, 65535, 0, $clientip, $clientport ) or die(socket_strerror(socket_last_error($sock))); // Run add_data function on the data recieved from socket add_data( $buf ); } // Never Should reach here, but if it is changed to shut down: Close the socket & mysql gracefully socket_close( $sock ); mysql_close( $mysql ); ?> I figure using Port 8080 would be fine? I then I would enter the games score by passing it through the URL: http://localhost/submitscore.php:8080 But when I try to load the page, I keep on getting the error at the top. Could anyone provide a solution?
×
×
  • 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.