Jump to content

violinrocker

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

violinrocker's Achievements

Member

Member (2/5)

0

Reputation

  1. i found a script here Im only know a little about pings and so... my questions are 1. do I need to put the post's url on $blogUrl or do i put the root url? 2. there is something at the bottom of the page about atom- or rss-feed... do I need an rss feed for this script to work? if so, Do i just make an rss feed? <?php // Please, edit these variables to your needs $blogTitle="Title Of your blog"; $blogUrl="http://www.yourblog.url/"; $pingListFile="pinglist.txt"; $showDebugInfo=FALSE; // Do you want verbose output? // Stop editing here // PingRPC.php // // 2007 by Sascha Tayefeh // http://www.tayefeh.de // // This is a PHP5-based XML-RPC ping script. It reads a one-column // fully qualified URL-list from a file ($pingListFile). Here is // an example how this file must look like: // ---------------------- // http://rpc.icerocket.com:10080/ // http://rpc.pingomatic.com/ // http://rpc.technorati.com/rpc/ping // http://rpc.weblogs.com/RPC2 // ---------------------- $replacementCount=0; $userAgent="pingrpc.php by tayefeh"; // Read pinglist file. Must contain one fully qualified URL // (e.g: http://rpc.technorati.com/rpc/ping) PER LINE (-> // delimiter is an ASCII-linebreak) $fp=fopen($pingListFile,"r"); while ( ! feof( $fp) ) { $line = trim(fgets( $fp, 4096)); // get the hostname $host=$line; // Make a copy of $line $host=preg_replace('/^.*http:\/\//','',$host); // Delete anything before http:// $host=preg_replace('/\/.*$/','',$host); // Delete anything after behind the hostname // get the path $path=$line; // Make another copy of $line $path=preg_replace('/^.*http:\/\/[a-zA-Z0-9\-_\.]*\.[a-zA-Z]{1,3}\//','',$path,-1,$replacementCount); // Delete anything before the path if(!$replacementCount) $path=''; // if there was no replacement (i.e. no explicit path), act appropiately if($host) $myList[$host]=$path; } echo "<h1>Ping process started</h1>"; echo "<p>Reading URLs from file $pingListFile: "; echo count($myList)." urls read.</p>"; // Use DOM to create the XML-File $xml= new DOMDocument('1.0'); $xml->formatOutput=true; $xml->preserveWhiteSpace=false; $xml->substituteEntities=false; // Create the xml structure $methodCall=$xml->appendChild($xml->createElement('methodCall')); $methodName=$methodCall->appendChild($xml->createElement('methodName')); $params=$methodCall->appendChild($xml->createElement('params')); $param[1]=$params->appendChild($xml->createElement('param')); $value[1]=$param[1]->appendChild($xml->createElement('value')); $param[2]=$params->appendChild($xml->createElement('param')); $value[2]=$param[2]->appendChild($xml->createElement('value')); // Set the node values $methodName->nodeValue="weblogUpdates.ping"; $value[1]->nodeValue=$blogTitle; $value[2]->nodeValue=$blogUrl; $xmlrpcReq = $xml->saveXML(); // Write the document into a string $xmlrpcLength = strlen( $xmlrpcReq ); // Get the string length. echo "Here's the xml-message I generated (size: $xmlrpcLength bytes):"; echo "\n<pre>\n"; echo htmlentities($xmlrpcReq); echo "</pre>"; echo "<dl>"; // Proceed every link read from file foreach ( $myList as $host => $path) { if($showDebugInfo) echo "<hr/>"; echo "<dt><strong>Pinging host: $host </strong>"; $httpReq = "POST /" . $path . " HTTP/1.0\r\n"; $httpReq .= "User-Agent: " . $userAgent. "\r\n"; $httpReq .= "Host: " . $host . "\r\n"; $httpReq .= "Content-Type: text/xml\r\n"; $httpReq .= "Content-length: $xmlrpcLength\r\n\r\n"; $httpReq .= "$xmlrpcReq\r\n"; echo "</dt>"; if($showDebugInfo) { echo "<dd><strong>Request:</strong><pre><span style=\"color: #cc9900\">".htmlentities($httpReq)."</span></pre>"; echo "<strong>Answer</strong>:<span style=\"color: #99cc00\"><pre>"; } // Actually, send ping if ( $pinghandle = @fsockopen( $host, 80 ) ) { @fputs( $pinghandle, $httpReq ); while ( ! feof( $pinghandle ) ) { $pingresponse = @fgets( $pinghandle, 128 ); if($showDebugInfo) echo htmlentities($pingresponse); } @fclose( $pinghandle ); } if($showDebugInfo) echo "</span></pre></dd>"; } echo "</dl>"; echo "<p>FINISHED</p>"; ?>
  2. ^ haha thanks for the tip, instead of $_POST i had $POST ... thanks so much for the replies i really appreciate it
  3. this is whats on my comment_ajax page (without the included files) if(isSet($_POST['comment'])) { if($POST['sub']==1){ cominsert($session->username,$POST['comment'],$_POST['msg_id']); } else{ subcominsert($session->username,$POST['comment'],$_POST['msg_id']);} i tried changing $_POST[msg_id] to $POST['sub'] to see if the value for sub can be inserted into the database, but it inserts nothing
  4. i removed </input> but it still doesnt post it. i think i may have something wrong in here var comment= $("#ctextarea"+ID).val(); var sub= $("#csub"+ID).val(); var dataString = 'comment='+ comment + '&msg_id=' + ID + '&sub=' + sub; or here <input type='hidden' name="sub" id="csub$msg_id" class="comment" value='$sub'>
  5. I cant seem to post 'sub'... 'comment' is posted but sub is not... what is wrong with my code? $('.comment_button').live("click",function() { var ID = $(this).attr("id"); var comment= $("#ctextarea"+ID).val(); var sub= $("#csub"+ID).val(); var dataString = 'comment='+ comment + '&msg_id=' + ID + '&sub=' + sub; if(comment=='') { alert("Please Enter Comment Text"); } else { $.ajax({ type: "POST", url: "extra/comment_ajax.php", data: dataString, cache: false, success: function(html){ $("#commentload"+ID).append(html); $("#ctextarea"+ID).val(''); $("#ctextarea"+ID).focus(); } }); } return false; }); this is my form <form method=\"post\" action=\"\"> <input type='text' name=\"comment\" class=\"comment\" maxlength=\"200\" id=\"ctextarea$msg_id\" style=\"float:left;width:400px;padding:1px\" ></input> <input type='hidden' name=\"sub\" id=\"csub$msg_id\" class=\"comment\" value='$sub'></input> <input type=\"submit\" value=\" Comment \" id=\"$msg_id\" class=\"comment_button small green awesome\" style=\"float:left;padding:2px\"/> </form>
  6. Oh lol nvm... i found out it was my include files that was messing it.... anyway, it worked great thank you so much for the help
  7. that would make it something like $names = array('smiley','hanane','dub'); or will it be something like $names = array[smileyhananedub]; sorry if im so stupid with this, im not well versed with arrays coz if i manually put the names like $names = array('Abraham Lincoln', 'Adolf Hitler', 'Agent Smith', 'Agnus', 'AIAI', 'Akira Shoji', 'Akuma', 'Alex', 'Antoinetta Marie', 'Baal', 'Baby Luigi', 'Backpack', 'Baralai', 'Bardock', 'Baron Mordo', 'Barthello', 'Blanka', 'Bloody Brad', 'Cagnazo', 'Calonord', 'Calypso', 'Cao Cao', 'Captain America', 'Chang', 'Cheato', 'Cheshire Cat', 'Daegon', 'Dampe', 'Daniel Carrington', 'Daniel Lang', 'Dan Severn', 'Darkman', 'Darth Vader', 'Dingodile', 'Dmitri Petrovic', 'Ebonroc', 'Ecco the Dolphin', 'Echidna', 'Edea Kramer', 'Edward van Helgen', 'Elena', 'Eulogy Jones', 'Excella Gionne', 'Ezekial Freeman', 'Fakeman', 'Fasha', 'Fawful', 'Fergie', 'Firebrand', 'Fresh Prince', 'Frylock', 'Fyrus', 'Lamarr', 'Lazarus', 'Lebron James', 'Lee Hong', 'Lemmy Koopa', 'Leon Belmont', 'Lewton', 'Lex Luthor', 'Lighter', 'Lulu'); a javascript that fetches the name works... but if i tried fetching from the database, it doesnt work
  8. in my table i have the names "smiley,jc,dub,cookie,pete" what i wanted to do was fetch them from the database and put them inside $names = array(smiley,jc,dub,cookie,pete); sorta like $names = array( while ($row = mysql_fetch_assoc($result)) { return $row[name] } );
  9. i was wonderin if there is a function where you can get a column in an array format... if there is none, how could I put a row of names inside an array. @include ("../session.php"); include ("../addons/functions/general.php"); mysql_connect("localhost", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); $result = mysql_query("SELECT friendname FROM friends where username='$session->username'"); while ($row = mysql_fetch_assoc($result)) { } $response = array(); $names = array('ROW of NAMES in HERE); i need $names = array('ROW of Names in Here); to be like this $names = array('Abraham Lincoln', 'Adolf Hitler', 'Agent Smith', 'Agnus', 'AIAI', 'Akira Shoji', 'Akuma', 'Alex', 'Antoinetta Marie', 'Baal', 'Baby Luigi', 'Backpack', 'Baralai', 'Bardock', 'Baron Mordo', 'Barthello', 'Blanka', 'Bloody Brad', 'Cagnazo', 'Calonord', 'Calypso', 'Cao Cao', 'Captain America', 'Chang', 'Cheato', 'Cheshire Cat', 'Daegon', 'Dampe', 'Daniel Carrington', 'Daniel Lang', 'Dan Severn', 'Darkman', 'Darth Vader', 'Dingodile', 'Dmitri Petrovic', 'Ebonroc', 'Ecco the Dolphin', 'Echidna', 'Edea Kramer', 'Edward van Helgen', 'Elena', 'Eulogy Jones', 'Excella Gionne', 'Ezekial Freeman', 'Fakeman', 'Fasha', 'Fawful', 'Fergie', 'Firebrand', 'Fresh Prince', 'Frylock', 'Fyrus', 'Lamarr', 'Lazarus', 'Lebron James', 'Lee Hong', 'Lemmy Koopa', 'Leon Belmont', 'Lewton', 'Lex Luthor', 'Lighter', 'Lulu');
  10. i used the code below and i want to put $session->username into url: "addons/functions/ajax_more.php", so that it would be like url: "addons/functions/ajax_more.php?name=$session->username", because the code i have in ajax_more.php requires $session->username... the only options i could think of is $_Post and $_get but i really dont know jquery. $(function() { //More Button $('.more').live("click",function() { var ID = $(this).attr("id"); if(ID) { $("#more"+ID).html('<img src="moreajax.gif" />'); $.ajax({ type: "POST", url: "addons/functions/ajax_more.php", data: "lastmsg="+ ID, data: "username="+ ID, cache: false, success: function(html){ $("ol#updates").append(html); $("#more"+ID).remove(); } }); } else { $(".morebox").html('The End'); } return false; }); }); this is whats inside ajax_more.php... at first i included a php file from which $session->username is from, but then it posts an error like session_start() [function.session-start]: Cannot send session cache limiter - headers already sent if(isSet($_POST['lastmsg'])) { $lastmsg=$_POST['lastmsg']; $str = "SELECT * FROM news_feed INNER JOIN friends ON news_feed.name = friends.friendname WHERE friends.username = '$session->username' and id<'$lastmsg' ORDER BY date DESC LIMIT 10 ";
  11. i have them in different dbs long before i thought of that function... and now i have thousands of rows in both of those dbs
  12. try if ($_GET=='') { echo "the form in here"; } else if ($_GET=='ro') { echo "the really long content that you want in here"; }
  13. you can try ummm.... $_GET[id] on your send.php for your id and then on your blog.php's form do something like <form action="send.php?id=<? echo "$_GET[id]"; ?>" method="post"> that way... it sends it to send.php with the id and you can use $_GET[id] once you are in send.php
  14. im using a function which connects to a db called 'comments' and then inside that function i again called another function that will connect to the db 'main' to get avatars.... but as i put mysql_select_db("main") or die(mysql_error()); on the new function, the original function stops to fetch rows. i tried to remove "mysql_select_db("main") or die(mysql_error());" and used the new function to return some text only and it worked, so i guess the connection to the db was the problem... i tried doing mysql_query("SELECT * FROM main.avatar INNER JOIN main.list ON main.avatar.title=main.list.id WHERE main.avatar.page_id='$id'"); but it also didnt work
  15. what I want to do is something like... i want to get rows from the news_feed that my friends and articles i subscribed to posted... but the only way to determine if i am friends with the one who posted or if i am subscribed to that article is checking 2 different tables.... so its sorts like "news_feed INNER JOIN ON friends OR articles" and not joining 3 tables
×
×
  • 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.