Viking gear
Gear Gifts and Apparel
PHP Gallery
PHP Gallery is a free php image script.
Goth and Gore Gifts
Shop right now or else!
Sharp Stuff
Switchblades Icepicks and german knives

Search the script archive.

Enter a search term check the script type and click submit. To search for a general category for example to find all results for scripts working with text files or file manipulation enter file or curl. Same for directory, sql etc. Otherwise use specific terms.

Here is the script you requested.

scripts/search-file-lines-array.txt: 981 bytes
search text file line in an array using array search and
strpos to print out search result lines in 
a list

<?php
    $id 
$_GET['id'];
//$id = $_GET['id'];
//$id=$arr[2];

$st "blog";
$file="test2.tx
t"
;

            
$file_text=file_get_contents($file);
            
$ini_array=explode('[start_post]',$file_text);
//ech
o $ini_array[];
//      for($i=1;$i<count($ini_array);$i++){ 
 //   echo("Element $i contains $ini_a
rray[$i]<br/>"); 
 
   
$pos= array_search('blog',$ini_array);
//if(stristr(
$ini_array,$st)){
   echo
 "
yes";
 echo 
$pos;
// }  
   
//      for (
$x ; $id);
$pos=stripos($i,$st); //look for $key in each
 line 
$p= count($pos);
$p++;
//echo "
$p<br>";

<?php
$tmp = array();
for(
$i=0;$i<count($_POST['valu
e']);
$i++)     
if (strlen(trim(stripslashes(
$_POST['value'][$i]))) != 0)            
$tmp[] = 'valu
e_' . 
$i . " '" . htmlentities($_POST['value'][$i]) . "'";
if (!empty(
$tmp))    
$wc = ' where ' .
 implode(' AND ',
$tmp);
echo 
$wc
// debuging line to see what you've gotten
?>


Post a comment

No comments yet

Search ScriptsnTips


Php JavaScripts CGI/Perl