HannahI 0 Report post Posted May 15, 2010 I have a script that goes to a social networking site that I am creating. I am having some difficultys using this script to post data on the users page for others to see the users thoughts. Just in case you need more information, I have plenty more in log files I write to in the script. I hope you can help me get the script working. By the way, don't blame me because I'm not using MySQL because you won't get me to switch. <?php// Initsession_start();if(!session_is_registered(myusername)){ header("Location:mainlogin.php? next=post.php");}// Declare Variables and Arrays$months = array("Jan-","Feb-","Mar-","Apr-","May-","Jun-","Jul-","Aug-","Sep-","Oct-","Nov-","Dec-");$days = array("Sun-","Mon-","Tue-","Wed-","Thu-","Fri-","Sat-");$years = array(2010);$page = $_SESSION['username'].'.html';// Generate Past Post Data $current = str_replace("<html><head><link rel='stylesheet' href='style.css'></link><title>".$_SESSION['username']."</title><body><img src='logo.gif' width=235 height=95 /><br />".$_SESSION['username']."'s Page <br />","",$page);$current = str_replace("<form action='comment.php' method='get'><input type='hidden' name='current' value='I am getting hungry! Time for dinner.'><input type='hidden' name='page' value='".$_SESSION['username'].".html'>`<input type='text' name='new'><input type='submit' value='Comment'></form><span style='font-style:italic;'>Last Updated on ","",$current);$current = str_replace($months,"",$current);$current = str_replace($days,"",$current);$current = str_replace($years,"",$current);$current = str_replace("</span></body></html>","",$current);// Create a new file$fileUp = file_get_contents($page);$new = $current.'<br />'."<span style='color:".$_POST['importantColor']."'>".$_POST['new']."</span>";$fileDown = str_replace($current,$new,$fileUp);echo $new;// Write to log$log = fopen("friendbooklog.txt","wb");fwrite($log,"Old: \n".$fileUp."\n"."New: \n".$current);fclose($log);// If required, update pageif($_POST['go'] == 1) {$fp = fopen($page,'w+') or die("dead");fwrite($fp,$fileDown);fclose($fp);header("Location: $page");}// Debug?><!-- Form Data --!><html><head><title>Post Content on <?php echo $_SESSION['username']; ?><link rel="stylesheet" href="style.css"></link></head><body><img id="logo" src="logo.gif" width="234" height="95"> <br />Hello, <? echo $_SESSION['username']; ?><form action="?" method="post"><input type="hidden" name="go" value="1"><textarea rows="10" cols=30" name="new">Put Content Here</textarea> <br />This is<input type="radio" name="importantColor" value="#990000">Important<input type="radio" name="importantColor" value="#000000">Not important <br /><input type="hidden" name="page" value="<?php $_SESSION['username'].'.html'; ?>"><input tupe=<input type="submit" value="Post"></form></body></html> Share this post Link to post Share on other sites
HannahI 0 Report post Posted July 23, 2010 Um.... bump. Seriously, I need help with this. Share this post Link to post Share on other sites