Jump to content

evank3

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

evank3's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, so I need a php code that looks in another file for a line of code. So it searches for a certain line of code in another file. also is it possible to read 1,2,3, etc lines after that line that was read?
  2. Its almost working perfectly! the only problem is that its reading the characters in the file not lines. like the code you gave me gave me the first, fifth, and ninty-ninth character in the file instead of giving me certain lines. Here is my code: <php file_get_contents("URL OF WEBPAGE"); echo $contents[0];//this would give you line one echo "<br>"; echo $contents[4];//this would give you line five echo "<br>"; echo $contents[99];//this would give you line one hundred ?>
  3. Well sort of, but I meant to read an external file from another website. like when you do view source on a page but only grabbing a certain line
  4. Is it possible to just read a certain line of a file and put it into the output? If it took out html codes that would be nice, but it doesn't need to. all I need to do is read a certain line of a external site like www.example.com
  5. I've tried tons of stuff... can someone please help? Theres only one more thing I can think of, but it probably wont work. Please help me. Thanks
  6. I am new to php, and can't seem to remember how to get info from a file that is updating. This is part of the file I am looking at: <td align="right">236,703</td> <td align="right">73</td> <td align="right">1,093,574</td> I want to be able to read the file and write the 1,093,574 without writing any of the other parts of the file to my page. I didn't explain it real well, so just tell me if you need me to explain farther.
  7. First off I need to know how to write to a certain line of a file from a form... I have a code here, but do not know how to add it to a certain line: [code]<?php $word = $_REQUEST["word"] ; $writedata = $word . "\n"; $file = fopen("filter.txt", "a"); fwrite($file, $word); fclose($file); ?>[/code] I need "fwrite($file, $word);" to write the word to line 4 of  my other file filter.php Next I need to be able to delete certain words from line 4 of filter.php from a form. Thanks in advance, Evan
  8. I just found out my earlier problem of submiting info from a form to a file, but now I need it to add enters between words I enter so that they are on separate lines.  I have a simple form that submits to the file below and adds it to a blank text file: [code]<?php $word = $_REQUEST["word"] ; $writedata = '$word'; $file = fopen("filter.txt", "a"); fwrite($file, $word); fclose($file); ?>[/code] When I submit it looks like Blah!Words but i want it like after I submit it. Blah! Words Thanks in advance
  9. Would it help if i changed filter_write.php to this [code]<?php $file = fopen("filter.txt", "a"); fwrite($file, $_POST["name"]); fclose($file); ?>[/code]
  10. Hello, and I am trying to create a language filter that I can have people submit from a form. I am very new to PHP so I know this is probably a really easy thing to do. Here are my codes so far: add_filter.php [code]<form action="filter_write.php" method="post"> Enter your blocked word: <input type="text" name="word" /> <input type="submit" /> </form>[/code] filter_write.php [code]<?php $word = '$_POST["name"]'; $file = fopen("filter.txt", "a"); fwrite($file, $word); fclose($file); ?>[/code] filter.php [code]<?php function language_filter($string) {     $obscenities = @file("filter.txt");     foreach ($obscenities as $curse_word) {         if (stristr(trim($string),$curse_word)) {             $length = strlen($curse_word);             for ($i = 1; $i <= $length; $i++) {                 $stars .= "*";             }             $string = eregi_replace($curse_word,$stars,trim($string));             $stars = "";         }     }     return $string; } ?> [/code] Then filter.txt is blank
  11. I need to add a shoutbox to my forum site (using simple machines), and want to have it so when they are logged in it will have them shout as their username in a certain color, and when logged out they can type in a name but in a different color to avoid confusion.
  12. Thank You both,  I will try these now...  I appreciate the help  :)
  13. I know this sounds really dumb, but I am very new to PHP and love what I have seen with it, but I just cant find out how to install PHP so I can view it on my own browser without hosting it on the net.  I have tried many tutorials, but none of them seem to work for me...  I am running Windows XP. Please help me, Many thanks, evank3
×
×
  • 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.