Jump to content

codeboy89

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

codeboy89's Achievements

Member

Member (2/5)

0

Reputation

  1. $msg is input text data from the user and i want it posted, but if someone else inputs text data it displays only the new entry. currently it is leaving up the old data also..
  2. i have the following code for taking input data and writing it to a textfile then echoing it to a webpage to view. i do not know why sometimes data is left over from a previous submission and sometimes it clears it. i want it to clear out the textfile and only show the last inputed message when i echo it. $file = "msg.txt"; $read = file_get_contents($file); $open = fopen($file, "r+"); $lock = flock($open, LOCK_EX); $add = "$msg"; $add = fwrite($open, "$add"); fclose($open); please help
  3. thanks for your help premiso, this solved the problem.. $file = "bb.xml"; $read = file_get_contents($file); $open = fopen($file, "r+"); $lock = flock($open, LOCK_EX); no more annoying flooded error_logs popping up
  4. can you show me how to properly setup file_get_contents() with parameters in my situation. i am very new still...
  5. yes that is still producing the error, and no the file is not deleted, i am adding some input text then closing it out with fclose. i just keep logging error_log entries on the fread line??
  6. premiso, i tried moving $read before $lock but it didn't solve the problem. i'm still getting the same error over and over in the log.
  7. here is my code to open/read an xml file before posting to it. $file = "bb.xml"; $act = fopen($file, "r+"); $lock = flock($act, LOCK_EX); $read = fread($act, filesize($file)); here is the error_log entry: PHP Warning: fread() [<a href='function.fread'>function.fread</a>]: Length parameter must be greater than 0 in go.php on line 37 can anyone help a newbie solve this problem?
  8. I forgot to mention I want this to find and make any urls into links, that is what the original ereg_replace is supposed to do. It is not a url only input field.
  9. I added the function, and called it the way gizmola has shown above. It does not work. Nothing updates at all.
  10. Alright, I found the following function online. function HyperlinkText($text) { return ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\">\</a>", $text); } Can anyone explain to me how I would use this function to turn a url into a clickable link. I want to use it on a input field named "bull". Here is my code currently that takes data and submits it to an XML file to be viewed. $file_name = "bb.xml"; $file_act = fopen($file_name, "r+"); $lock = flock($file_act, LOCK_EX); $file_read = fread($file_act, filesize($file_name)); $date = date ("j M Y"); $post = "<bb>\n<p>$name $date<br />$bull</p>\n</bb>\n"; $post = stripslashes($post); fwrite($file_act, "$post"); fclose($file_act); I am not sure how to incorporate this function. I would really appreciate any help.
  11. I am still learning PHP and understand adding lines to an extent. But I am not sure how I would go about adding lines to a image thats so small. Can anyone show me how it can be done or adding noise just to make it a little harder. <? session_start(); $cap = rand(100, 999); $_SESSION['captcha'] = $cap; $img = ImageCreate(25,11); $bg = ImageColorAllocate($img,255,255,255); $txt = ImageColorAllocate($img,0,102,153); ImageFill($img,0,0,$bg); ImageString($img,3,0,0,$cap,$txt); header('Cache-control: private, no-cache, must-revalidate'); header('Expires: 0'); header("Content-type: image/png"); ImagePNG($img); ImageDestroy($img); ?>
  12. HAHA that was easy. Thanks, that really made it simple.
  13. I am trying to remove the paging system from this snippet, it displays XML data into pages according to the $posts variable. How would I simplify this code (remove whats not needed) and show just everything on 1 page. I keep getting errors. Thanks for any help <? $file = implode('', file ("post.xml")); { // Max amount of posts on one page $posts = 6; // Count the number of posts $foo = preg_split ("<.*ponmurt.*>", $file); $count = (count($foo)-1)/2; $pages = intval(($count-1)/$posts)+1; $page = intval($_GET["page"]); // Always begin at the last page if($page < 1 || $page > $pages) $page = $pages; // Write the required page numbers if($pages > 1) { print "<p>page "; for($i=$pages; $i>=1; $i--) if($i == $page) print " <b><font size = \"3\">$i</b></font> "; else print "<a href=index.php?page=$i> $i </a>"; print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<br/></p>"; } $start = ($page-1) * ($posts*2) + 1; for($i=$start; $i<$start+$posts*2; $i+=2) print $foo[$i]; // Write the required page numbers if($pages > 1) { print "<p>page "; for($i=$pages; $i>=1; $i--) if($i == $page) print " <b><font size = \"3\">$i</b></font> "; else print "<a href=index.php?page=$i> $i </a>"; print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<br/></p>"; } } ?>
  14. I am currently using the snippet below, can anyone show me a way to use the similar setup without cookies? if (isset($_COOKIE['FormSubmitted'])) { die('You may only submit this form once per session!'); } setcookie('FormSubmitted', '1');
  15. Thanks mikesta!!
×
×
  • 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.