Jump to content

violinrocker

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Everything posted by violinrocker

  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
  16. I wanted to do something like the code below $str = "SELECT news_feed.*, friends.*, articles.* FROM news_feed INNER JOIN articles ON news_feed.name = anime.name OR inner join friends on news_feed.name = friends.friendname WHERE friends.username = '$name' or articles.subscriptor = '$name'"; what its supposed to do is check the tables "articles" and "friends" and check if they are related to the $name (i.e. $name is a friend of $friendname or $name is subscribed to this article) and then get the items from news_feed that $name's friends and the articles he is subscribed to posted
  17. nice, i think this would work... $lastId = mysql_insert_id(); ... its the first time i've seen it
  18. I think Im getting what you are trying to say... but I am going to insert the forum post and the subscription at the same time and i have no idea how i could get the same incremented ID to be used on the other one
  19. initially i wanted to use auto increment... but then... how would i link the auto-incremented number from the forums to the auto-incremented number in the subscription?
  20. i have to tables... forums & subscription i would like to insert a random character string into 'forums' to be used as a subscription id. and then have the same random string to be inserted into 'subscription'
  21. i have this function function friends($info) { mysql_connect("localhost", "kiphi", "bncorjnn") or die(mysql_error()); mysql_select_db("kiphi_comments") or die(mysql_error()); $count = "SELECT COUNT(*) as num FROM friend_requests where username='$info'"; $count2 = mysql_fetch_array(mysql_query($count)); $ol2 = "SELECT * FROM friends INNER JOIN active_users ON friends.friendname=active_users.username where friends.username='$info'"; $fetchol= mysql_query($ol2) or die("Could not get threads"); while ($online = mysql_fetch_array($fetchol)){ $friend['online'] = $online[friendname];} return $friend;} and then i use this to call the function above $friend=friends($session->username); echo $friend['online']; what it does is checks the active users and then compares it to your friend list and then echo those friends that are online, problem is it only shows 1. i tried the Count(*) and it shows 3. i think i need to use, 'while' but i dont know where to put it
  22. I have this code, its working pretty fine until i insert "echo "$ipDetail['country']";" to get the converted ip to name its origin <?php $ip=$_SERVER['REMOTE_ADDR']; function countryCityFromIP($ipAddr) { //function to find country and city from IP address //Developed by Roshan Bhattarai http://roshanbh.com.np //verify the IP address for the ip2long($ipAddr)== -1 || ip2long($ipAddr) === false ? trigger_error("Invalid IP", E_USER_ERROR) : ""; $ipDetail=array(); //initialize a blank array //get the XML result from hostip.info $xml = file_get_contents("http://api.hostip.info/?ip=".$ipAddr); //get the city name inside the node <gml:name> and </gml:name> preg_match("@<Hostip>(\s)*<gml:name>(.*?)</gml:name>@si",$xml,$match); //assing the city name to the array $ipDetail['city']=$match[2]; //get the country name inside the node <countryName> and </countryName> preg_match("@<countryName>(.*?)</countryName>@si",$xml,$matches); //assign the country name to the $ipDetail array $ipDetail['country']=$matches[1]; //get the country name inside the node <countryName> and </countryName> preg_match("@<countryAbbrev>(.*?)</countryAbbrev>@si",$xml,$cc_match); $ipDetail['country_code']=$cc_match[1]; //assing the country code to array //return the array containing city, country and country code return $ipDetail; }$ipDetail="countryCityFromIP('12.215.42.19')"; echo "<b>IP Address= $ip</b> "; echo "$ipDetail['country']"; ?> this is the error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/GGME/public_html/addons/iptest.php on line 25
  23. hmmm another error.... $sql2 = "INSERT INTO user_extension (username, sig) VALUES ($session->username, $_POST[sig]) ON DUPLICATE KEY UPDATE $_POST[sig]=sig"; $session->username=violinrocker Attention! SIG Error: Unknown column 'Violinrocker' in 'field list'
  24. oh w8.. i think i found what was wrong... sorry xD
×
×
  • 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.