coolcat50
Members-
Content Count
303 -
Joined
-
Last visited
Everything posted by coolcat50
-
Ok, I will teach you how to create a simple HTML editor that runs online with buttons that add HTML tags. Before we start: You should have basic knowledge of these languages. HTML/XHTML Javascript PHP You will need Ability to use filesystem functions. Chmodding abilities Features of Editor Online PHP safe Full HTML support A Few Bad Features Can only create new documents or overwrite Fairly unsafe Now we are ready to begin. The PHP Script This will be our PHP script that we will use to make the file. Make a file called save.php Here is the code <?php//First we need to create a function to take out phpfunction clearPHP(){//First we must get the content from the form.$data=$_POST['contents'];//Ok we have a variable containing the contents.//Now we need to replace all php tags$data=str_replace("<?php","<!--",$data);//We are going to package all php as html comments$data=str_replace("?>","-->",$data);//Our main function is finished}//Ok we need to start our file creator$fName=$_POST['file'];$fContents=clearPHP();//We have our information ready to be implanted$file=fopen($fName,'w+');//We have created the file//Now we need to write to the filechmod($file,0777);fwrite($file,$fContents);//Ok close the filefclose($file);?>That would be about it for our file creating system. The Form The Javascript Create a new file called editor.php This is our Javascript we need in the head tag of our editor. I am just going to demonstrate the bold, italic, underline, and anchor tags. <script type="text/javascript">//We need to start our bold functionfunction addBold(){var current=document.editor.contents.value//Next add a bold tagdocument.editor.contents.value=current+"<b></b>"}//Now add our italic functionfunction addItalic(){var current=document.editor.contents.valuedocument.editor.contents.value=current+"<i></i>"}//Now our underline functionfunction addUnder(){var current=document.editor.contents.valuedocument.editor.contents.value=current+"<u></u>"}//Now our anchor tag//This is more complex than the othersfunction addLink(){var link=prompt("URL of Link","http://")var title=prompt("Name of Link",link)//We have the values for our tag//Lets add the tagvar current=document.editor.contents.valuedocument.editor.contents.value=current+'<a href="'+link+'">'+title+'</a>'}//That ends the javascript</script>That is our javascript that will add the tags.Now we need the form. The Form Here is the code for our form. We will use buttons to add the Javascript functions. <form name="editor" action="save.php" method="post"><input type="button" value="Bold" onclick="addBold()" /><input type="button" value="Italic" onclick="addItalic()" /><input type="button" value="Underline" onclick="addUnderline()" /><input type="button" value="Link" onclick="addLink()" /><br /><textarea name="contents" wrap="false" rows="25" columns="20"></textarea><br /><input type="submit" value="Save" /></form> That gives us our form and now we are done. Style it and you have yourself a simple HTML editor. I hope this tutorial helped you and thank you for reading.
-
You should have also provided a few other tricks with echo. Such as random numbers or something like that. Look at this code. <?php$var1="Hello people!";$var2=str_replace("people","world",$var1);echo $var1." and ".$var2;?> The above code should display. Hello people! and Hello world! So echo can actually be used for several purposes.
-
Well, it doesn't require PHP, but it does require extra files that can clog up my file manager. With the PHP $_GET global I can create the same effect with one file. That could even decrease load times.(I think.)
-
Well, my style is new spaces for me to read easier due to my using my Nintendo Wii for management. Also, I don't want the iframe constantly being one part but change. So, I just used toolbar to show that the variable is part of the url and it changes. I probably need to add a base tag though for the links right? AJAX would probably be better anyway or just plain Javascript. And yes that was an example code.
-
Thanks! That is exactly what I am wanting
-
Well, I don't really understand AJAX and I can't copy and paste code so the XML object will be annoying to use and with a link the page would automatically refresh. Maybe a Javascript pop-up could work, but I want it to show up inside the page. Maybe Javascript style changes could do it. Or something.Also, with an iframe I can have it load with a different file. That would probably be required. Also, I could always use AJAX with PHP to do it. I just gotta learn how to lol.
-
Hello! I am wondering whether or not it is possible to have a dynamic iframe that changes when a link is pressed. I believe I know a way for this to be done with the php $_GET variable and only using a certain part of the url. I am wondering if this would maybe work. I want this for a chatbox that will have a little side menu for BBCode reference and a notepad. <?phpif($_GET['toolbar'] == 'bbcode'){//display my bbcode reference page here}if($_GET['toolbar'] == 'notepad'){//display my notepad page here}if($_GET['toolbar'] == 'smilie')//display my smilie page here}else{?><!-- Display my chatbox here --><!-- IFRAME code --><iframe src="thispage.php?toolbar"></iframe><?php}?>
-
Is Xml A Programming Language Or A Database Language?
coolcat50 replied to coolcat50's topic in Programming
Well, I was using programming language very loosely when I stated that HTML was a programming language. It is in some ways a "programming language". It is telling your web browser to perform certain actions there by "programming" your screen. So in some ways I am correct and in many ways incorrect. Also, I had a very valid point with this question. I am seeing if I can use XML as a secure flat file database system for storing something like my index of files or something. -
Ok, to do this the simple, but not fully accurate way use a code like this. <?php$date=date(D,F,J);echo $date;?> There is a little code.
-
Hello! This is my first tutorial and I will teach you how to set up a notepad system on your mobile phone. I use a Motorola Razr V3 and certain parts may be different.This tutorial requires no special packages, just the ability to create text messages.Steps:1. First, we need to set up the phone to have a false address book entry. So open up your address book and create an entry. Here is the information I have for mine.Name:NotepadNumber:555-1234Speed Dial:1002. Now that we have our "Notepad" entry, we can now make our messages.3.This system uses a feature called drafts which are messages that are saved to be sent later. We will not be sending these though.4.To create a message, open up your message menu and create a new message.5.Make this message a text message or multimedia message.6. Enter in your message and when you are finished, select "Notepad" as the person to send it to.7. When you get to the screen where you enter in the subject, make the subject be the title of your notes.8. Next, press your center button to open the options menu of the message.8. Then save the message as a draft.9. Check your message drafts to see your notepad document.10. Enjoy!To edit the message simply select it and follow steps 7-10 when done editing the message.Thank you for reading! Please comment below.
-
Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if this works. I have not tested it yet, but I will later and post back with a demo and fix it up. Current script: <?php//Save this as something like htmltest.phpfunction CheckForm(){$html_unsafe=$_POST['code'];//Gives us our user input$html_safe=str_replace("<?php","<php>",$html_unsafe);//Starts security measures$html_safe=str_replace("?>","</php>",$html_safe);//User input now secure server side//Still security issues client sideecho $html_safe;//echos our statement}//End function//Main scriptif ($_GET['test']=='true'){//Check submitif (isset($_POST['submit'])){//echo out pageCheckForm();}else{die("Sorry,you shouldn't be viewing this page. Please go back.");}else{//Start form?><form action="htmltest.php?test=true" method="post"><textarea cols=XX rows=XX name="code"><html><head><title></title></head><body></body></html></textarea><input type="submit" name="submit" value="Submit" /><?php} //End script//Made by coolcat50//Please give me credit if you use?> Demo: HTML tester There you go peeps. So what do you guys think?
-
hmm yeah.also with this 403 error pages this could very likely bypass that filter. i will test that out
-
I do not know exactly, but I do believe it will show because you aren't viewing the page but its source. Test it out and post here. One thing for sure it bypasses the Javascript anti-right click code.
-
Sweet! How would you add line numbers to my script? Also, I know hwo to make it safer. Change the php.ini file to make the php colors be white and change HTML to a different color? Security reasons for that.
-
Currently I use Opera 9.01 Wii Version because my computer is broken. When, I buy my laptop I'm going to run Firefox and IE6 or 7. I just am used to IE but I have seen Firefox and i like its interface. If Opera was free then I'd be using Opera because I like it's smoothness on my Wii. lol
-
Hello! I have just came up with a sweet script to show the source code of any website and it only requires one file. This is the basis of the script and can be customized with CSS and other things and can be instituted as a public resource. Well I will provide the code and a step-by-step tutorial on each of its parts. This code has been tested by me. Enjoy! <?php//This little tag starts our php script and is easily the most important part of the script.//We will start our base script here.//You can change some of the styles used here to your desired color.if ( $_GET['page'] == 'source' )//This line starts our source code page.//There are 2 'pages' to he script.//Both are defined with the get superglobal.{if ( isset ( $_POST['submit'] ) )//This line checks our input to make sure submit was clicked.{//We will define our variables here.$file=$_POST['file'];//This gives us our variable for the file.//Lets check to see if a file was entered.if ( !$file ){die("Sorry, you did not enter in a file to view.")}//Then we proceed//Here you could add a user verification var.//Such as a password or a verification number.//For now lets use a verification number$userverify=12345;//The user must enter this field in order to proceed.//Lets check and see if our user entered the verification number.if ( $_POST['verify'] == $userverify )//Checks verification{//Ok, lets get our script going.echo "<div style=\"background-color:yellow\">;//Ok that sets where the code will show.//Lets show our file urlecho "File URL:" . "$file" . "<br />";//There. Now lets use a rule to seperate the url and source.echo "<hr />";//Now lets show the user the source code.show_source($file);//There we go//Now lets close up this if statementecho "</div>";}//End user verify//If the user did not enter the verificationelse{echo "Sorry, you did not enter in the correct number. Try again."}//Ends error notification//Lets end our submit statement}//Now we need to set a statement that if the user did not submit anything.//An error pops up.else{die("Sorry, you shouldn't be viewing this page. Please go back.");}//Now we end our page statement}//now we start an else statement if they did not visit the source pageelse{?><!-- We end the php block for now and focus on html --><form action="url_source_viewer.php?page=source" method="post"><!-- There we set up our form and you must fill in the url statement with the appropriate url of the source page --><input type="text" name="file" value="File URL Here" /><!-- That defines our input form for the file --><br /><input type="text" name="verify" value="Verification Number" /><!-- There is where the user will enter the verification number --><br /><!-- Now lets display our verification number --><p>Verification Number: <?php echo $userverify; ?></p><br /><!-- There we echo out the number --><input type="submit name="submit" value="See Source" /></form><?php//We now need to end our else statement.}//And that is the code. If you copy and paste it please give me some credit.//This is a 'tutorial' that is supposed to teach and provide a resource.//Thank you?> Live Demo: Source Viewer Demo There is my code. Also, feel free to move it to tutorials, I just felt that it should be under PHP programming. Thank you for reading.
-
Well, I kinda would like a Javascript so I can integrate it anywhere. How would I do that?
-
How would i go about making a simple GIF editing tool for making text bars or resizing images. I know GIFworks.com uses HTML and Javascript. I'm wanting to know how to code a script where you could make a bar with text on it. Of course the text comes from user input. I do not if this belongs in PHP, JS, or HTML. Well, thanks!
-
Well, I do know PHP fairly well. Look at my card engine. So, don't be making generalizations like that. kk
-
Yeah good point. Prob about 100kb on a 2.5gig host
-
The Naruto Online Game Ninja, online, game, naruto, mmorpg
coolcat50 replied to OpaQue's topic in Websites and Web Designing
Yeah I played that during the summer before coming back here. Just fyi, I was here like 2-3 years ago and left because ofa crapload of emails coming in (Pob have a folder with at least 1000). Lol. Well the game is actually fun and I would like to make a game similar. Didn't know it was hosted on Xisto - Web Hosting though. -
Here is another card game! <?php//1 Card Poker Version Beta//Engine code here//Shuffle//Deal$pcard=$deck;$dcard=$deck;if($_POST['submit']){if($pcard < $dcard){echo "Sorry, you have lost.\n";echo "You're card" . "$pcard" . "!\n";echo "Dealer's card" . "$dcard" . "!\n";}else{echo "You have won!!!\n";echo "Your card" . "$pcard" . "!\n";echo "Dealer's card" . "$dcard" . "!\n";}}else{echo "<form method=\"post\">";echo "<input type=\"submit\" name=\"submit\" value=\"Click to play!\" />"\n;echo "</form>";}?> There is a one card poker game. Soon I might add a betting section to the games.
-
Hmm, well currently it is just a script that can be used to make others manually. i will set up a preview soon. Currently it is a basis on other PHP games such as Blackjack or poker or even War. Hmm I'll try to get a preview arcade set up. I just need a way to get it on to a site. I'll put it on my RPG site.Preview coming soon.
-
I added a dealer system to it. The system is very basic but can be modified to do more than what it does. Also, i will occasionally post games with it that i come up with. 2 Card Poker <?php//Engine code//Player Cards$pcards=array("$deck","$deck");$dcards=array("$deck","$deck");$ptotal=$pcards['0'] + $pcards['1];$dtotal=$dcards['0'] + $dcards['1'];//Start gameif($_POST['submit']{if($ptotal < $dtotal){echo "Dealer's cards"."$dcards";echo"Your cards"."$pcards";echo "Sorry you lost.";}else{echo "Dealer's cards"."$dcards";echo "Your cards"."$pcards";echo "You have won!";}}else{echo "<form method=\"post\">\n";echo "<input type=\"submit\" name=\"submit\" value=\"Click to play!\" />\n";echo "</form>"}
-
Ok, I have come up with a code that can be used to make card games. It is a deck script and is fairly complex. Here it is. <?php//Start deck shuffle$deck=rand("1,52");//Start cards//Spades$s_ace=str_replace("1","A(S)",$deck);$s_2=str_replace("2","2(S)",$deck);$s_3=str_replace("3","3(S)",$deck);$s_4=str_replace("4","4(S)",$deck);$s_5=str_replace("5","5(S)",$deck);$s_6=str_replace("6","6(S)",$deck);$s_7=str_replace("7","7(S)",$deck);$s_8=str_replace("8","8(S)",$deck);$s_9=str_replace("9","9(S)",$deck);$s_10=str_replace("10","10(S)",$deck);$s_jack=str_replace("11","J(S)",$deck);$s_queen=str_replace("12","Q(S)",$deck);$s_king=str_replace("13","K(S)",$deck);//Diamonds$d_ace=str_replace("14","A(D)",$deck);$d_2=str_replace("15","2(D)",$deck);$d_3=str_replace("16","3(D)",$deck);$d_4=str_replace("17","4(D)",$deck);$d_5=str_replace("18","5(D)",$deck);$d_6=str_replace("19","6(D)",$deck);$d_7=str_replace("20","7(D)",$deck);$d_8=str_replace("21","8(D)",$deck);$d_9=str_replace("22","9(D)",$deck);$d_10=str_replace("23","10(D)",$deck);$d_jack=str_replace("24","J(D)",$deck);$d_queen=str_replace("25","Q(D)",$deck);$d_king=str_replace("26","K(D)",$deck);//Clubs$c_ace=str_replace("27","A(C)",$deck);$c_2=str_replace("28","2(C)",$deck);$c_3=str_replace("29","3(C)",$deck);$c_4=str_replace("30","4(C)",$deck);$c_5=str_replace("31","5(C)",$deck);$c_6=str_replace("32","6(C)",$deck);$c_7=str_replace("33","7(C)",$deck);$c_8=str_replace("34","8(C)",$deck);$c_9=str_replace("35","8(C)",$deck);$c_10=str_replace("36","10(C)",$deck);$c_jack=str_replace("37","J(C)",$deck);$c_queen=str_replace("38","Q(C)",$deck);$c_king=str_replace("39","K(C)",$deck);//Hearts$h_ace=str_replace("40","A(H)",$deck);$h_2=str_replace("41","2(H)",$deck);$h_3=str_replace("42","3(H)",$deck);$h_4=str_replace("43","4(H)",$deck);$h_5=str_replace("44","5(H)",$deck);$h_6=str_replace("45","6(H)",$deck);$h_7=str_replace("46","7(H)",$deck);$h_8=str_replace("47","8(H)",$deck);$h_9=str_replace("48","9(H)",$deck);$h_10=str_replace("49","10(H)",$deck);$h_jack=str_replace("50","J(H)",$deck);$h_queen=str_replace("51","Q(H)",$deck);$h_king=str_replace("52","K(H)",$deck);//Optional additions//Dealer system//Shuffle//Deal$pcards=array("$deck","$deck","$deck","$deck","$deck");$dcards=array("$deck","$deck","$deck","$deck","$deck");//Show handsif($deck == 0){die("I am sorry an error has occured with the card engine.")}else{echo "Dealer's cards" . "$dcards" , ".\n";echo "<br />";echo "Your cards" . "$pcards" . ".\n";}//Jokers//Change deck from rand(1,52) to rand(1,54)//Add this to the end$joker1=str_replace("53","Joker(R)",$deck);$joker2=str_replace("54","Joker(B)",$deck);//Indivual Decks//BETA$spades=array('$s_ace','$s_2','$s_3','$s_4','$s_5','$s_6','$s_7','$s_8','$s_9','$s_10','$s_jack','$s_queen','$s_king');//Soon to come There is my card engine. It is in what I call version ALPHA. Well, enjoy. I will update it soon. Also, tests and modifications are welcome. This is a non-tested script.