Calmypal Posted October 11, 2009 Author Share Posted October 11, 2009 Yesm but I sorta... Well... Umm... Misplaced my USB drive which had it. I can look for it. Quote Link to comment Share on other sites More sharing options...
Calmypal Posted October 11, 2009 Author Share Posted October 11, 2009 I am going to hit the sack, hopefully I will find my USB drive and get it over hear tomarrow. What time do you think you will be on? Quote Link to comment Share on other sites More sharing options...
Calmypal Posted October 11, 2009 Author Share Posted October 11, 2009 Here is the original code. If you can change it to remove name_input and replace it with the session userName  <html> <head> <font face="Fixedsys"> <center> <img src = "Banner.bmp"><br> <title>_REMOVED_</title> <h3><a href = "index.php">Home</a> | <b>Chat</b> | <a href="uploader.php">Upload Files</a> | <a href="staff.php">Staff</a></h3> </font> </head> <body> <font face="Comic Sans MS" font size = "2"> <hr> <p> Info on 'Chat':<br> 'Chat' has an 8 chats history, you can chose your own name.<br> If you want to request a full history, please email me.<br> <br> <?php /* ########################## INFO ##########################            Advanced shoutbox              Version 1.0     Free script from WB - Webdesign for beginners.      Visit http://plohni.com/wb for more scripts.        Feel free to modify this script.                lgp /* ########################## INFO ########################## */ /* ###################### INSTALLATION ###################### */  // a) Adjust the configuration variables to your needs     $file = "shouts.txt"; // Name of the file which                // contains the shouts     $shouts = 8; // Number of shouts to be displayed     $maxlength_name = "8"; // Maximum length of name     $maxlength_text = "150"; // Maximum length of text     $break_name = "15"; // Break name after characters               // without space     $break_text = "15"; // Break text after characters               // without space  // b) Copy this code to your PHP file  // c) Copy your PHP file and the shouts file defined in  //  variable $file to your server using ASCII mode  // d) Make the shouts file writable (Windows: adjust  //  security, Unix: chmod 777) /* ###################### INSTALLATION ###################### */ /* ############# SCRIPT (EDIT AT YOUR OWN RISK) ############# */ ?> <p>  <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">   <input type="text" value="Your name" name="input_name" maxlength="<?php echo $maxlength_name; ?>" onfocus="if(this.value=='Your name'){this.value='';}" onblur="if(this.value==''){this.value='Your name';}" /><br />   <input type="text" value="Your text" name="input_text" maxlength="<?php echo $maxlength_text; ?>" onfocus="if(this.value=='Your text'){this.value='';}" onblur="if(this.value==''){this.value='Your text';}" /><br />   <input type="submit" value="Shout!" />  </form> </p> <hr /> <p> <?php  //function to break text after x characters  function str_break($str,$maxlen){   $nobr = 0;   $len = strlen($str);   for($i=0;$i<$len;$i++){    if(($str[$i]!=' ') && ($str[$i]!='-') && ($str[$i]!="\n")){     $nobr++;    }else{     $nobr = 0;     if($maxlen+$i>$len){      $str_br .= substr($str,$i);      break;     }    }       if($nobr>$maxlen){     $str_br .= ' '.$str[$i];     $nobr = 1;    }else{     $str_br .= $str[$i];    }   }     return $str_br;  }  //number of shouts to be displayed  $display = (isset($_GET["show"]) ? "all" : $shouts); ?> </p><p> <?php  //insert new shout  $input_name = $_POST["input_name"];  $input_text = $_POST["input_text"];   //check if form has been submitted  if(isset($input_name) && isset($input_text) && $input_name!="Your name" && $input_text!="Your text" && strlen($input_name)>0 && strlen($input_text)>0){   //get last name and comment   $handle = fopen($file,"r");   while(!feof($handle)){    $row = fgets($handle,999999);    list($tmp_name,$tmp_text) = split("\|\|\|\|\|",$row);    if($tmp_name != "" && $tmp_text != ""){     $last_name = $tmp_name;     $last_text = str_replace("\n","",$tmp_text);    }   }     fclose($handle);   $input_name = str_break($input_name,$break_name); //break name   $input_name = str_replace("<","<",$input_name); //prevent html input   $input_name = str_replace(">",">",$input_name); //prevent html input   $input_name = stripslashes($input_name); //strip slashes     $input_text = str_break($input_text,$break_text); //break text   $input_text = str_replace("<","<",$input_text); //prevent html input   $input_text = str_replace(">",">",$input_text); //prevent html input   $input_text = stripslashes($input_text); //strip slashes   if($last_name != $input_name || $last_text != $input_text){    $handle = fopen($file,"a"); //open shouts file to write (append)    fputs($handle,"$input_name|||||$input_text\n"); //insert name and shout    fclose($handle); //close file handle   }  }  //read shouts file  $names = array(); //array to store names  $shouts = array(); //array to store shouts  $handle = fopen($file,"r"); //open shouts file to read   while(!feof($handle)){ //read row by row   $row = fgets($handle,999999);   list($name,$shout) = split("\|\|\|\|\|",$row);     if($name){    array_push($names,$name);    array_push($shouts,$shout);   }  }   fclose($handle); //close file handle  //reverse arrays so that new lines are first  $names = array_reverse($names);  $shouts = array_reverse($shouts);  //number of shouts to really print  $max = ($display == "all" ? count($names) : $display);  //print shouts  for($i=0;$i<$max && $i<count($names);$i++){   ?><strong><?php echo $names[$i]; ?>: </strong><?php echo $shouts[$i]; ?><br>  <?php } ?> </p> <hr> </p> </font> </body> <footer> <font face = "Times New Roman" font size = 1> Copyright© 2009, Caleb Blankemeyer<br> </center> </html> Quote Link to comment Share on other sites More sharing options...
Calmypal Posted October 12, 2009 Author Share Posted October 12, 2009 Can someone help D= Quote Link to comment Share on other sites More sharing options...
janusmccarthy Posted October 12, 2009 Share Posted October 12, 2009  Okay, I'm going to fix this for you, but a few things.  ...BEGIN SOAPBOX  1. You do not own scripts you have not paid for and did not develop yourself. Don't put a copyright on it. You haven't earned that right. Someone is letting you use that code freely, but THEY own that code. Give credit where credit is due.  2. Learn the language if you're going to ask for help. If you aren't doing the basic work in trying to understand something, you shouldn't ask for someone to do it for you without compensation. We couldn't ask you basic questions about your code. It's one thing to not know the ins and outs of a language when its something you write, because you still know what its trying to do. It's another thing to grab something without knowing what it does, muck with it, and then ask for help without doing your part.  ...END SOAPBOX  You'll want to put back your common.php and get user name methods.  <?php  //function to break text after x characters  function str_break($str,$maxlen){   $nobr = 0;   $len = strlen($str);   for($i=0;$i<$len;$i++){    if(($str[$i]!=' ') && ($str[$i]!='-') && ($str[$i]!="\n"))    {     $nobr++;    }    else    {     $nobr = 0;     if($maxlen+$i>$len)     {      $str_br .= substr($str,$i);      break;     }    }    if($nobr>$maxlen)    {     $str_br .= ' '.$str[$i];     $nobr = 1;    }    else    {     $str_br .= $str[$i];    }   }   return $str_br;  }  $file = "shouts.txt";  $shouts = 8; // Number of shouts to be displayed  $maxlength_text = "140"; // Maximum length of text  $break_name = "15"; // Break name after characters without space  $break_text = "15"; // Break text after characters without space  // b) Copy this code to your PHP file  // c) Copy your PHP file and the shouts file defined in  //  variable $file to your server using ASCII mode  // d) Make the shouts file writable (Windows: adjust  //  security, Unix: chmod 777)  $input_name = $_SESSION['usersname'];  //number of shouts to be displayed  $input_text = '';  if( isset( $_POST['input_text']) && strlen( $_POST['input_text']))  {   $input_text = $_POST['input_text'];   //get last name and comment   $handle = fopen($file,"r");   if( $handle)   {    while(!feof($handle))    {     $row = fgets($handle,999999);     if( $row)     {      list($tmp_name,$tmp_text) = split("\|\|\|\|\|",$row);       if($tmp_name != "" && $tmp_text != "")      {       $last_name = $tmp_name;       $last_text = str_replace("\n","",$tmp_text);      }     }    }   }     fclose($handle);     $input_text = str_break($input_text,$break_text); //break text   $input_text = str_replace("<","<",$input_text); //prevent html input   $input_text = str_replace(">",">",$input_text); //prevent html input   $input_text = stripslashes($input_text); //strip slashes   if($last_text != $input_text){    $handle = fopen($file,"a"); //open shouts file to write (append)    fputs($handle,"$input_name|||||$input_text\n"); //insert name and shout    fclose($handle); //close file handle   }  }  $display = (isset($_GET["show"]) ? "all" : $shouts);  //read shouts file  $names = array(); //array to store names  $shouts = array(); //array to store shouts  $handle = fopen($file,"r"); //open shouts file to read   if( $handle)  {   while(!feof($handle)){ //read row by row    if( $row = fgets($handle,999999)){     list($name,$shout) = split("\|\|\|\|\|",$row);     if($name){      array_push($names,$name);      array_push($shouts,$shout);     }    }   }  }  fclose($handle); //close file handle  //reverse arrays so that new lines are first  $names = array_reverse($names);  $shouts = array_reverse($shouts);  //number of shouts to really print  $max = ($display == "all" ? count($names) : $display); ?> <html> <head> <font face="Fixedsys"> <center> <img src = "Banner.bmp"><br> <title>_REMOVED_</title> <h3><a href = "index.php">Home</a> | <b>Chat</b> | <a href="_REMOVED_">_REMOVED_</a> | <a href="staff.php">Staff</a></h3> </font> </head> <body> <font face="Comic Sans MS" font size = "2"> <hr> <p> Info on 'Chat':<br> 'Chat' has an 8 chats history, max length of 140 characters.<br> If you want to request a full history, please email me.<br> <br> <p>  <?php   echo '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';   echo '<b>'.$_SESSION['userName'].'</b><br />';   echo '<input type="text" value="Your Text" name="input_text" maxlength="'.$maxlength_text.'"'     .' onfocus="if(this.value==\'Your text\'){this.value=\'\';}"'     .' onblur="if(this.value==\'\'){this.value=\'Your text\';}" /><br />';  ?>  <input type="submit" value="Shout!" />  </form> </p> <hr /> <p> <?php  //print shouts  for($i=0;$i<$max && $i<count($names);$i++)  {   echo '<strong> '.$names[$i].': </strong>'.$shouts[$i].'<br>';  } ?> </p> <hr> </p> </font> </body> <footer> <font face = "Times New Roman" font size = 1> Copyright) 2009, _REMOVED_<br> </center> </html> Quote Link to comment Share on other sites More sharing options...
Calmypal Posted October 12, 2009 Author Share Posted October 12, 2009 I told you, I do C++ and Lua, I am new to PHP, and I am copyrighting the page, not his work. And, the guy who made it did not copyright it or claim a GPL or GNU license on it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.