Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //if user wants to add a word
- if ($_POST["AddWord"]=="true"){
- echo "Whichword";
- if ($_POST["TYPE"]=="property"){
- $file = fopen("pw.txt","r+") or exit("Unable to open file!");
- $test = fread($file,filesize("pw.txt")) or exit("!!!");
- $text = $text . $_POST["word"] . ",";
- echo fwrite($file,"$text") or exit("Unable to edit file!");
- fclose($file);
- echo "Property word added";
- echo $text;
- }
- elseif ($_POST["TYPE"]=="otherword"){
- $file = fopen("ow.txt","r+") or exit("Unable to open file!");
- $test = fread($file,filesize("pw.txt")) or exit("!!!");
- $text = $text . $_POST["word"] . ",";
- echo fwrite($file,"$text") or exit("Unable to edit file!");
- fclose($file);
- echo "Property word added";
- echo $text;
- }
- else{
- echo "object database not yet supported";
- }//end type
- }//end if addword
- elseif ($_POST["AddWord"] == "pw"){
- $file = fopen("pw.txt","r") or exit("Unable to open file!");
- $text = fread($file,filesize("pw.txt")) or exit("!!!");
- fclose($file);
- echo $text;
- }
- elseif ($_POST["AddWord"] == "ow"){
- $file = fopen("ow.txt","r") or exit("Unable to open file!");
- $text = fread($file,filesize("pw.txt")) or exit("!!!");
- fclose($file);
- echo $text;
- }
- elseif ($_POST["AddWord"] == "check"){//check if it's a property word
- //create varibale with commas ither side to make checking correct
- $word = "," . $_POST["word"] . ",";
- //open property words text file
- $file = fopen("pw.txt","r") or exit("Unable to open file!");
- //save its contence to $text
- $text = fread($file,filesize("pw.txt")) or exit("pw!!!");
- //if the word that is being checked is in the file
- if (strrpos($text,$word) != false){
- echo "property";
- }
- //close the filestream
- fclose($file);
- //open other words text document
- $file = fopen("ow.txt","r") or exit("Unable to open file!");
- //save its contence to $text
- $text = fread($file,filesize("ow.txt")) or exit("ow!!!");
- //if the words that is being checked is in this string
- if (strrpos($text,$word) != false){
- echo "other";
- }
- //close filestream
- fclose($file);
- }//end check
- elseif ($_POST["AddWord"] == "AddObjects"){//add noun and properties
- $file = fopen("/objects.xml","r+");
- $text = fread($file,filesize("pw.txt")) or exit("!!!");
- $text = $Text . "\n" . $_POST["object"];
- echo fwrite($file,$Text);
- fclose($file);
- echo $text;
- }
- elseif ($_POST["AddWord"] == "GetObjects"){/get object list.
- $file = fopen("/objects.xml","r");
- $text = fread($file,filesize("pw.txt")) or exit("!!!");
- fclose($file);
- echo $text;
- }
- else{
- mysql_connect("cloud.wfv.me", "lira", "fast10sp33d") or die(mysql_error());
- echo "Connected to MySQL<br />";
- mysql_select_db("lira") or die(mysql_error());
- $result = mysql_query("SELECT * FROM objects");
- echo "Connected to Database";
- echo $result;
- }
- php?>
Advertisement
Add Comment
Please, Sign In to add comment