Jump to content
xisto Community
Sign in to follow this  
HannahI

Need Help Debugging

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.