Jump to content

doa24uk

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

doa24uk's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi guys, I'm using Wordpress. Here is my .htaccess file # Use PHP5 Single php.ini as default AddHandler application/x-httpd-php5s .php # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress The problem is that I can't access any .php files & certain directly from within the wp-content/plugins directory eg. I can access the following http://mysite.com/wp-content/plugins/ http://mysite.com/wp-content/plugins/plugin-name/ http://mysite.com/wp-content/plugins/plugin-name/file.php but I can access http://mysite.com/wp-content/plugins/plugin-name/readme.txt http://mysite.com/wp-content/plugins/plugin-name/myImage.png Any ideas?
  2. Thanks, just expanding this slightly - that loop is actually within another loop..... $Target = "phrase 2" $textarea_array=array("phrase 1","phrase 2"); foreach ($textarea_array as $XQuery) { $html = "http://www.mysite.co.uk/search?api=" .$XQuery; $dom = new DOMDocument; @$dom->loadHTMLFile($html); $xpath = new DOMXPath($dom); $aTag = $xpath->query('//h3[@class="r"]/a'); foreach ($aTag as $val) { $arr[] = $val->getAttribute('href'); } foreach($arr as $key => $value) { if(stristr($value, $Target)) { $Position = $key; break; } else { $Position = "Not Found"; } } echo $XQuery; echo "-"; echo $Position; echo "<br><br>"; } What should be being output is phrase 1 - position of phrase 1 phrase 2 - position of phrase 2 What is actually being output is phrase 1 - position of phrase 1 phrase 2 - position of phrase 1 And I just can see why!?
  3. As you can see, the Target is 3.com and it IS in the array ... so why isn't this working?? It's continuously outputting Not Found :shrug: :wtf: <?php $Target="3.com"; $arr=array("http://1.com","http://2.com","http://www.3.com/whatever","http://4.com"); foreach($arr as $key => $value); { if(stristr($value, $Target)) { $Position = $key; } else { $Position = "Not Found"; } echo $Position; } ?>
  4. Hi guys, My script does the following: Takes a textarea input, cleans it & splits it into an array. 1 text area line = 1 array value. Open an HTML page with DOM and find the 'Target' on the page. Returns it's position. Here's what should be output: Text Area Line 1 - Position (of Text Area Line 1) Text Area Line 2 - Position (of Text Area Line 2) However what's actually being output is: Text Area Line 1 - Position (of Text Area Line 1) Text Area Line 2 - Position (of Text Area Line 1) Why is it holding on to the position variable? I think it's simply because my loops are in the wrong place. <?php // Get Textarea string and trim spaces & blank lines $textarea = $_POST['phrase']; $textarea = trim($textarea, " \r\n"); // Explode textarea on newlines to get individual search phrases $textarea_array = explode("\n", $textarea); // //Get site to look for (Target) & force removal of http:// & http://www. to be user friendly. // Removal is case insensitive. // $Target = $_POST['target']; function remove_http($Target = '') { return(str_ireplace(array('http://www.','http://'), '', $Target)); } $Target = remove_http($Target); // // //Main Foreach loop - takes each line of text area and searches URL for results. // // foreach ($textarea_array as $XQuery) { //Replace space ( ) with + to ensure compatibility in the next step $XQuery = str_replace(" ","+",$XQuery); $html = "http://www.mysite.co.uk/search?api=" .$XQuery ."&productvalid=1"; $dom = new DOMDocument; @$dom->loadHTMLFile($html); $xpath = new DOMXPath($dom); $aTag = $xpath->query('//h3[@class="r"]/a'); foreach ($aTag as $val) { $arr[] = $val->getAttribute('href'); } foreach($arr as $key => $value) { if(stristr($value, $Target)) { // // Result found, Position is the key + 1 (first array value is zero). // Then further define it to include the nice text, this'll make it easier to echo later. // $Position = $key + 1; // break; } else { // // Result not found, set $Position to not found. // $Position = "Not Found"; } } // // We're out of the loop, so tell the good people the results! // echo $XQuery; echo "-"; echo $Position; } ?>
  5. Solved .... For those looking for the same thing.... array_slice // Get Textarea string $textarea = $_POST['phrase']; // Explode textarea on newlines to get individual search phrases $textarea_array = explode("\n", $textarea); // Slice off the unwanted items // First value should be 0 (start of array) // Second value should be your upper limit (10 in my case) // Anything about the upper limit will be removed $ResultArray = array_slice($textarea_array, 0, 10);
  6. Just reposting won't help .... I've given you what you asked for ... is this correct or not?
  7. Is this what you need? <?php $Question = 'I-A'; echo "1(" . $Question . ")<br />"; echo "2(" . $Question . ")<br />"; echo "3(" . $Question . ")<br />"; echo "4(" . $Question . ")<br />"; echo "5(" . $Question . ")<br />"; ?>
  8. Hi guys, I've got a textarea input .... I'm aware that I can't count / restrict the lines only the characters ... plus I don't want to use JS (needs to be foolproof / JS un-enabled proof). The problem is that someone can submit as many lines as they wish. I want to set the max array size (array values) to say 50... I presume I'll have to count() the array and then somehow dump the 51st, 52nd, n... values in the array?
  9. Thanks! I finally went with this ... just incase someone else is looking for the same thing... $array = array( 'http://www.arau.org/ct_home.php','http://www.arau.org/','http://en.wikipedia.org/wiki/Arau'); foreach($array as $key => $value) { if(stristr($value, "arau.org")) { $partial_match_key = $key; break; } }
  10. Hi guys, My array is as follows: Array ( [0] => http://www.arau.org/ct_home.php [1] => http://www.arau.org/ [2] => http://en.wikipedia.org/wiki/Arau ) All I want to do is look for certain partial matches & output their position in the array. It shouldn't care about the other results ... just the first match Eg. $string_to_match = "arau.org" // If arau.org is found in array echo "Found at position 0"; I've looked at several array search options (in_array,stristr) etc. none seem to work...
  11. Hey guys, Lets say this is a portion of my HTML output page <ul> <li>Listing One</li> <li>Listing Two</li> <li>Listing Three</li> </ul> Here's my psuedo code for what I want to do. $text to find = "Listing Three"; if $text to find = found { echo Found in position 3. } else Sorry, text not found I do have a Javascript script that will number the results ... javascript:var%20p=document.getElementsByTagName('li');var%20j=1;function%20gc(){for(i=0;i<p.length;i++){if(p[i].className=='g'){p[i].innerHTML=j+'.%20'+p[i].innerHTML;j++;}};};gc(); But I've got no idea if I have to pre-number the results in PHP or if PHP can just find it straight off.....
  12. Hey guys, My two possibilities are to match either HTML\1.0 or HTML\1.1 I was using str_replace to just match one but now I believe I need preg_replace. $responsecode = str_replace("HTTP/1.1", "", $headers[0]); However I'm completely lost with the regex for this! Help!
  13. I am so tired lol! I had spaces in the URLs. Replaced spaces with +s and everythings working fine now. Thanks DoA
  14. Hi guys, Here's my script mysql_connect("localhost", "REMOVED", "REMOVED") or die(mysql_error()); mysql_select_db("REMOVED") or die(mysql_error()); // Get all Links $result = mysql_query("SELECT * FROM ping") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { // Send Pings now $title = $row['title']; $url = $row['url']; $offsiteurl = "http://offsitedomain.com/ping/?title=".$title."&blogurl=".$url."&chk_weblogscom=on"; echo $pingomatic; $handle = fopen($offsiteurl, "r") or die("Can't open file"); fclose($handle); It outputs the correct URL and then error's saying Can't open file ... It also says "HTTP wrapper does not support writeable connections" ... However if I hard code the URL into the fopen eg. fopen("http://google.com", "r") it works perfectly ??? All I want to do is create a bunch of URLs from my database & open them one at a time - surely it's simple stuff!!!
  15. I should be more specific. This will be run as a cron job therefore no user integration / visual output is required ... the script simply needs to open the URL to send the ping. I've found the following code that apparently works for classic ASP ... can anyone translate this to php?? function SendPing(byval strBlogName, byval strBlogUrl, byval strPageUrl, byval strFeedUrl) ‘ build ping XMLRPC call strData = “<?xml version=”"1.0″”?>” strData = strData & “<methodCall>” strData = strData & “<methodName>weblogUpdates.extendedPing</methodName>” strData = strData & “<params>” strData = strData & “<param>” strData = strData & “<value>” & strBlogName & “</value>” strData = strData & “</param>” strData = strData & “<param>” strData = strData & “<value>” & strBlogUrl & “</value>” strData = strData & “</param>” strData = strData & “<param>” strData = strData & “<value>” & strPageUrl & “</value>” strData = strData & “</param>” strData = strData & “<param>” strData = strData & “<value>” & strFeedUrl & “</value>” strData = strData & “</param>” strData = strData & “</params>” strData = strData & “</methodCall>” ‘ post to Pingomatic XMLRPC ping URL set objHttp = Server.CreateObject(”MSXML2.ServerXMLHTTP”) objHttp.open “POST”, “http://rpc.pingomatic.com/”, false objHttp.setRequestHeader “Content-Type”, “text/xml” objHttp.setRequestHeader “Content-Length”, len(strData) objHttp.Send strData ‘ check response if (objHttp.status = 200) then strReturn = objHttp.responseText end if ‘ release object set objHttp = nothing ‘ passback SendPing = strReturn end function strData = SendPing(”The Title Of Your Website”, “The URL of your website”, “The URL of the new article”, “The URL of your RSS feed”)
×
×
  • 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.