Jump to content
xisto Community

ghostrider

Members
  • Content Count

    399
  • Joined

  • Last visited

Everything posted by ghostrider

  1. Save the files in the www or public_html folder. Use http://forums.xisto.com/no_longer_exists/ as your address for your computer.
  2. Intro To PHP Tutorial 3 - Form Data and Conditional Statements Released 4/12/07 By Chris Feilbach aka GhostRider Contact Info: E-mail: assembler7@gmail.com AIM: emptybinder78 Yahoo: drunkonmarshmellows Website: http://forums.xisto.com/no_longer_exists/ PART I - FORM DATA One of the things that makes PHP so popular is its ability to handle form data. You can do whatever you want with it, you can email it to yourself, store it in a database, display it on a page, you can do literally ANYTHING with it. There are two ways to send data to your server, GET and POST. Both are equally easy to use in PHP. GET is the stuff after the question mark in the address bar in the browser. You don't see the POST data in the address bar, it is sent discreetly along with the request for the webpage. POST is more secure than GET, and can also handle more data being sent. I only use GET when I am splitting my page into different sections and I don't want to make a bunch of PHP pages. I will go into that more in a different tutorial. http://forums.xisto.com/no_longer_exists/ The above address has three GET variables, mode, submode, and aid. Now how do you use this data in your PHP script? Look below. http://forums.xisto.com/no_longer_exists/ <?PHP// For GET data.$var1 = $_GET['mode'];$var2 = $_GET['submode'];$var3 = $_GET['aid'];PHP?> If the variable was sent via POST, you would change all the $_GET['']s to $_POST['']s. <?PHP// For POST data.$var1 = $_POST['mode'];$var2 = $_POST['submode'];$var3 = $_POST['aid'];PHP?> We will be creating two pages in this tutorial, one that sends data, and the other that processes the data and displays it. First, lets look at the html required to make this work. We are going to make two pages: index.php - Asks user for name and sex, and sends it to process.php. process.php - Processes the user's data and displays it. Index.php will be sort of like a welcome to our site. We ask them they're name and sex. First we need to take care of the basics and make our site look nice. <html><head><title>Welcome to our site!</title></head><body><b>Welcome to our site!</b><br>We would like to know more about you. Please fill in the information below. We need to tell the browser where to send the data. We will send it via POST because it is more secure than GET. We are sending to process.php (our action) and using POST (our method). <form action='process.php' method='post'> If you remember your HTML, you will know that each input has a type, a name, and usually a value (the exception are text boxes). They also sometimes have other variables that change the way they behave on the page. We care about two, the name, and the value. Lets ask our user for their name. <br><br>Your name:<input type='text' name='username' size=50 maxlength=50> Lets ask them for their sex also. Remember a radio button is the same as an option. Radio buttons that are in a group always have the same name, but different values. <br>Your sex:<br><input type='radio' name='sex' value='m'>Male<br><input type='radio' name='sex' value='f'>Female<br><input type='radio' name='sex' value='u'>Undecided Lastly, put in the submit button. The value tag in submit sets the buttons caption (what it displays). <br><input type='submit' value='Submit!'> For the sake of being proper with our coding, we'll end the form and the body. </form></body></html> All put together the code looks like: <html><head><title>Welcome to our site!</title></head><body><b>Welcome to our site!</b><br>We would like to know more about you. Please fill the information below.<form action='process.php' method='post'><br><br>Your name:<input type='text' name='username' size=50 maxlength=50><br>Your sex:<br><input type='radio' name='sex' value='m'>Male<br><input type='radio' name='sex' value='f'>Female<br><input type='radio' name='sex' value='u'>Undecided<br><input type='submit' value='Submit!'></form></body></html> PART II - Conditional Statements Conditional statements, which are also sometimes called if ... then statements, or simply if statements, are what makes a language truly dynamic. They allow whether your data is equal to something, or not equal. If you are dealing with numbers, you can also use greater than, less than, greater than or equal to, or less than or equal to. We are dealing with strings so we are only concerned with the top two. All condition statements start with an if. They then follow by a left parenthesis (. After that they have a variable, a sign (equal to, not equal to etc.), and either another variable or a constant (like "yes" or 2.5 or "hello"). They then have a right parenthesis ) and a left curly parenthesis {. The code you type between will be executed if the condition is true. The statement ends with a right curly parenthesis }. You should always indent your conditional statements because otherwise when your code becomes complex it will be NEARLY IMPOSSIBLE to debug or read. Signs that are used in PHP. == - Equal != - Not equal < - Less than > - Greater than <= - Less than or equal to >= - Greater than or eqaul to Here is an example conditional statement: if ($variable == "yes") { // This code is executed if $variable is equal to yes. print "yes"; } Almost always you need to check for more than one variable. You can expand on your conditional statements by using an elseif statement. Its syntax is identical to an if statement. Below is the code: if ($variable == "yes") { // This code is executed if $variable is equal to yes. print "yes"; } // You need to close the if statement. elseif ($variable == "no") { // This code is executed if $variable is equal to no. print "no"; Sometimes you can have three or four or even five different conditions to test for. You can use an else statement in one of two ways, you may use it in place of an elseif statement, or use it without a variable as a last resort. // Using the else statement in place of an elseif statement. if ($variable == "yes") { // This code is executed if $variable is equal to yes. print "yes"; } else ($variable == "no") { // This else could also be an elseif statement. // This code is executed if $variable is equal to no. print "no"; } else ($variable == "maybe") { print "maybe"; } If you choose to use an else as a sort of "last resort", for an unknown value, use it like this. // Using the else statement as a "last resort". if ($variable == "yes") { // This code is executed if $variable is equal to yes. print "yes"; } elseif ($variable == "no") { print "no"; } elseif ($variable == "maybe") { print "maybe"; } else { print "I have no idea what " . '$variable' . " equals."; // Notice that $variable had to be put in single quotes to have it display $variable, NOT its value. } Read through it a couple times until you really know it well! Conditional statements are sort of complex for beginners and should be reviewed as they are very important. One thing that helps when you start to develop your own software is to comment what you are testing for in your conditional statements. I still do that for some of my complex ones. It is a helpful tool and will reinforce what I am teaching you now. Now that we have covered conditional statements we can start to work on process.php. Whenever I have more than one file, I always write a brief comment that tells what the file name is and what it does. I would have done this in index.php but its all HTML. I also comment what form data it receives (if any), and how it receives it. This is great for debugging, and looking back on your code. I'm going to type this all in one, and comment it very well. Contact me if you have any questions about it. <?PHP// process.php - Takes data from index.php and displays it// Form data (POST)// username - The name of the user.// sex - Contains the sex of the user (m=male,f=female,u=undecided)// We want to display the name of the user in the title and the body. If the user is a male lets make the font color blue, if they are female make it red, and leave it black if they are undecided.print("<html><head><title>Welcome ");// Lets get the data. Place the name inside of the $_POST[] or $_GET[] variable to get the value of that data.$username = $_POST['username'];print $username . "</title></head><body>"; // Prints the user name and finishes the head of process.php. Starts the body.$sex = $_POST['sex']; // Gets the sex of the user. if ($sex == "m") { // The user is a male. print("<font color='#0000FF'>You are a male.</font>"); } elseif ($sex == "f") { // The user is a female. print("<font color='#FF0000'>You are a female.</font>"); } else { print("You did not specify a sex."); }PHP?></body></html> This is an awful lot to introduce so early in a tutorial, but both of these concepts go hand in hand. Read through it a couple of times. And once you understand congratulate yourself. You know one of the most important concepts in PHP. Be sure to contact me if you have any questions. The code demonstrated in this tutorial may be viewed at: http://forums.xisto.com/no_longer_exists/
  3. My room is generally messy, but when my mom tells me to clean it, it gets slightly better. I move all my stuff from the floor to the closet. When she tells me to clean my closet I move it under my bed, and when she tells me to clean under my bed I sorta scatter it and make it look somewhat nice.
  4. I post in this forum to make sure I keep my free web hosting. I also like to read what other people like to say, and contributing and helping other people learn stuff is always fun.
  5. To shadowx: You don't need a period to join two variables. I just couldn't think of any other way to demonstrate joining strings together.To truefusion: Thanks for pointing out that I had forward slashes instead of blackslashes. I have corrected it .
  6. If you haven't read the first one, read it by clicking here. I got a lot of positive comments about my last tutorial. Do you guys think I should keep writitng these? Intro To PHP Tutorial 2 - Variables Released 4/06/07 By Chris Feilbach aka GhostRider Contact Info: E-mail: assembler7@gmail.com AIM: emptybinder78 Yahoo: drunkonmarshmellows Website: http://forums.xisto.com/no_longer_exists/ It has been a very long time since I have released a tutorial. I've been quite busy working on my newest script for handling news (GAMES), and redesigning my webpage. This tutorial will cover variables, which are what programmers use to store data in. Make sure that you have read the first tutorial, and that you understand everything in this tutorial as well, as this is one of the core fundamentals in any language that you learn. Anyway you choose to look at it, computer programming is all about manipulating and displaying data. Even the most simple program possible, has to deal with data, the CPU has to read the data, process it, and then send an output. In a computer game, the computer is inputing data from somewhere (keyboard, mouse, joystick), and outputing data thats based on its inputs (screen and speakers). This makes variables, the things that hold data very very important to use and to understand. Variables in PHP can either hold data or numbers. Numbers are also sometimes called integers. To tell PHP that your variable is truly a variable, put a dollar sign ($) in front of it, like so. <?$var1 = "Hello.";?> Variables can also hold numbers: <?$var2 = 22;$var3 = 67.43009;?> One of the most important things in PHP is understanding the difference between strings (a bunch of letters/numbers) in double quotes ("") and single quotes (''). Strings in double quotes allow you to put other variables inside of the string. PHP will then translate that variable into its value. Single quotes will not do this. For example, lets say that you have a simple script that asks for the persons first name via a form on another page, and then displays it. The name of the person will be stored in $name. <?$name = "Chris";print "Hello, $name!"; // Will display Hello, Chris!?> HOWEVER, if you put it in single quotes <?$name = "Chris";print 'Hello, $name!'; // Will display Hello, $name!?> This is a very important thing to understand, so make sure you really get it. Inside a quote you can only have two quote marks, one that signifies the beginning of the string, and another that signifies the end. But what if you to want to use quotes inside of a string? The solution is simple, lets say you want to put the persons name in quotes (""). Use a backslash (\) in front of the quotes inside of the string to avoid parse errors. Here would be your code: <?$name = "Chris"; // This could also be $name = 'Chris';print "Hello, \"$name\"!"; // Will display Hello, "Chris"!?> There is one more concept that I want to cover before I conclude this tutorial. Strings can be joined using a period *. Lets say that you have a last name, too. <?$name = "Chris";$lname = "Feilbach";print "Hello, $name" . " " . $lname . "!";?> Be sure to review this stuff, and make sure you really know it. Next week, or whenever I release my next tutorial, we will cover form data, and conditional statements.
  7. Also, learning history is a way to make sure humans don't repeat mistakes. Many of my history teachers told me that and I believe them. History does have a tendency to repeat itself, and knowledge is the way to stop that.
  8. CPanel X is showing the correct amount of databases, however when I go to PHPMyAdmin it says 'No input file specified'. However the databases are there, and my webpage is showing all the data correctly, so it shouldn't be too hard of a problem to fix.
  9. If you remember stuff from your algreba class, you should recall that an equation that is used on a graph is usually in the form of y = x, or x = y, or something that includes both x and y. Parametric equations invovle a third variable, T, which is generally used to represent time. It takes two equations to graph a parametric equation, x = T and y = T. The x equation defines the x coordinate of the point you are plotting, and the y equation defines the y coordinate of the point. The variable T is often referred to as time because parametric equations make it very easy to graph things like motion. It also makes it very easy to to graph lines at an angle. With y = x, you can kind of graph things at an angle, for example y = 2x will producer a steeper line than y = x. But with parametric equations you can graph and exact angle like so. This makes parametric equations somewhat helpful in trigonometry, or the math of finding the missing side or angle in a triangle. x = cos(Angle) * T y = sin(Angle) * T After about 30 minutes of really thinking about it, I have found a mathematical proof explaining why the above equation will generate a line with the angle that is specified by Angle. Every equation will have a starting point. For simplicity in the proof, lets call this point (0,0). This is the point where the line starts, and also is where the angle is formed. With a graphing calculator, you can have T start and end on any value, but in this case we will have it start on zero. We are drawing a line with a 45 degree angle thus our equations would be: x = cos(45) * T y = sin(45) * T Each parametric equation can be modeled by a right triangle, where the line being made is the hypotenuse of the triangle, x is the length of the side that runs horizontally, and y is the length of the line that runs vertically. I've drawn a picture to help illustrate my point. I appolgize for this being probably the worst drawn picture in existance. Im using a program for making icons. . [ If you once again remember back to your algebra days, you will remember three ratios for right triangles: sine (sin) opposite side length/ hypotenuse length cosine (cos) adajencent side length/ hypotenuse length tanget (tan) opposite side length/ adajcent side length I'd draw you another pretty picture but hopefully you already get the idea. Remember that whatever the angle of the triangle, the ratios between the sides will always be the same. Lets assume now that T is equal to one and we are plotting our next point. Go back to our original equations: x = cos(45) * T y = sin(45) * T Since T is equal to 1 x = cos(45) y = sin(45) Those are out points for x and y. However, you can also get the length of the legs based of of this. You already know that the angle between the horizontal line and the vertical line is going to a be 90 degrees. You also know the other angle measure, 45 degrees. The last angle measure can be determined by subtracting both of those from 180, because there are 180 degrees in a triangle. The length of the horizontal leg is equal to Tcos(45) - 0 (0 is our x starting point). The length of the vertical leg is equal to Tsin(45) - 0 (0 is our y starting point). The Law Of Sines states that any angle divided by its opposite side will be the same for every angle in the triangle. I learned this is Honors Geometry last year and Honors Advanced Algebra last year. I'll have a proof for you soon. However using this you can find out the angle between the the horizontal line and the line that you are plotting. We are solving for our angle. sin a (our angle) sin((180-90-a)) --------------------------- = ------------------------- length of vertical side length of horizontal side Using proportions, multiply this out to get: sin A * length of horizontal side = sin 45 * length of vertical side Multiply this done further, and you will find that the sin of our angle (45 degrees), is what you should get. Lastly, to use parametric equations on a graphing calculator (a TI one), press mode, and instead of func choose PAR or PARAM.
  10. This is my first attempt at writing a PHP tutorial. Its from a while ago. What do you guys think? Intro To PHP Tutorial 1 - What is PHP? Released 2/20/07 By Chris Feilbach aka GhostRider Contact Info: E-mail: assembler7@gmail.com AIM: emptybinder78 Yahoo: drunkonmarshmellows Website: http://forums.xisto.com Hello, and thank you for choosing my tutorial. If you are completely new to PHP, this tutorial will teach you all the basics, and if you are not it will serve as an excellent reference for you. I will release the next section of my tutorial every 1 to 2 weeks. All of the basics will be covered; in this set of tutorials you will learn everything a PHP coder needs to know, including how to use MySQL (a database server), and how to handle data from forms. If you want to learn about something in particular, go ahead and contact me and I will see what I can do. You also should contact me if you have any questions about anything I write in my tutorials. You should know HTML before you read my tutorial. If you don't PHP has no use to you. Go learn it and then come back. It does not take long to learn how. http://www.w3schools.com/ is a great resource. PHP stands for Hypertext Preprocessor, which is a bunch of big words that means it runs a script, or a bunch of PHP that you write, and then outputs something to the person viewing your web page. PHP is very powerful; it can output more than just HTML. You can also create images, and various other things using PHP and output them to your user's browser. PHP is a server-side application, meaning that all of the processing is done on the server, or the computer that sends the data to your user. Things such as HTML and JavaScript are client-side applications, meaning that the code is sent to the computer viewing it and then processed. The fact that PHP is server-side means that any computer with a web browser can view its output. PHP requires a server, such as Apache, to run. I run all of my scripts that I make off of my website. You can either get webspace that supports PHP (http://forums.xisto.com/ is where I get my totally free webspace), or simply download your own webserver on your computer. I don't have a preference for a server for testing PHP. Anything that supports it will do. PHP files are placed in the same directory that your html files and other files are stored. For my site, I place them in the public_html. PHP files can be written in ANY text editor. I primarily use Linux, so I use KWrite to write my PHP files, but Notepad is probably the best editor for Windows. I prefer KWrite over Notepad because it color codes your PHP, making it much easier to read, and also displays line numbers if you press F11, a feature that makes debugging PHP much easier. I have been programming in a variety of languages for 10 years now, and every other decent programmer will tell you the same as I am about to. Take small steps with learning ANY language, don't be discouraged if it doesn't work right away (it usually doesn't when your new to it), and enjoy your success. Show some creativity with your work and make it yours. Have some patience at first, as I said above, things won't always work the first (or second, or third, and so on) times, especcally when your new. If worst comes to worst e-mail me your code and I'll help you out the best I can. Now that you've listened to all of that, I think its about time we actually coded something. First we need to learn a little bit about the syntax of PHP. I'll walk you through it step by step. First, to tell the server that we are beginning PHP code, we need to put this. <?PHP The server is now proccessing PHP. You no longer can just write HTML, you will cause an error if you do. To send stuff use the print() or echo() functions. Both of them do exactly the same job. print("PHP is awesome!"); This command sends PHP is awesome! to the user's web browser. "PHP is awesome!" is something called an argument, or something that a function needs to do its work. You need to place strings, or things with characters, in quotes "". End it with a parenthesis, and use a semi-colon ( to tell PHP that it had reached the end of the line. YOU NEED TO DO THIS FOR EVERY LINE OF CODE, OR YOU WILL GET AN ERROR. You can include HTML markup inside of the print() or echo() function. For example: print("<br><font color=red>Red is my favorite color.</font>"); Will print out Red is my favorite color., in red. End your php code with this: PHP?> I have one more thing to introduce to you today. You can add comments to your code to help yourself and other people that read it understand it. Anything that follows two forward slash marks (//) is considered a comment. PHP will not consider them code. The whole thing looks like this: <?PHPprint("PHP is awesome!"); // The two lines mean that this is a comment.// PHP completely ignores //. Commenting your code is very imporant, so do it!print("<br><font color=red>Red is my favorite color.</font>");PHP?> Have some fun with this. Print whatever your heart desires. Next tutorial we will go into variables, and shortly after that we will cover forms. Happy coding!
  11. I can't get to phpMyAdmin on my site either. Give OpaQue and the other admins some more time. Transfering a hard drive full of websites and get everything set up and working correctly is no easy job. Getting the sites transferred alone in 8, and having them working is absolutly amazing. The reason you are having loads of database errors is probably because of the fact that you don't have any databases. I don't either. Take a look in your MySQL databases.
  12. I learned CSS by experimenting and W3Schools. Its not that hard once you get the hang of it. Start out just using it to do simple things and then build up from there, like you would with any other langauge.
  13. That is one hell of a story. Congratulations on your success and thank you for providing such a great service.
  14. Ohh wow that was really fast. Thanks for doing that .
  15. I've posted being slightly inebriated occassionally, but not like drop dead drunk. I don't have an objection to getting high but I haven't done it either. When I'm drunk I tend to do really stupid things, so I try to stay away from places where I could be viewed as not intelligent or stupid, or looked down upon when I am drunk. I'm really curious to see the results of this poll.
  16. Its good to hear that you backed everything up . I just googled QTPartED and it looks like good software, but I'm looking at screenshots not code. Since you have it all backed up I would just reformat it.
  17. After 30 boots? I think you should probably keep the computer running, and just as a precaution, get all your important files off your computer so if you do need to do something like reformat your hard drive you at least have your data. You could also create a Ghost image using Norton Ghost. What does Windows classify the partition as, part of the NTFS partition or something else, like unallocated space? I don't know of any free partitoners for Windows but whenever I'm on Windows and need partitioning I use PartitionMagic 8.0. Your partitioner could have easily just erased the data from that part, and not call it formatted. From what I've noticed, Windows defines something to be formatted when it has some sort of file system, and unallocated when it does not. Also, what partitioner did you use to detach and reattach the partition of free space you made. Free partitions, or cheap ones, might not update all the data stored in the Master File Tables, which may be causing an error And finally, Since your logging into Windows, even if its in Safe Mode, this isn't a BIOS error. Its either a nasty bug, or Windows being Windows. Post back. I'm interested to see how this turns out.
  18. Does Windows give a specific error message when you try to load it? The fact that Windows does not see the partition and Linux does makes me think that the partition doesn't have the right type. What does the Linux partition say it is, does it say it is NTFS, or free space, or FAT32? Windows often doesn't read partitions if they aren't the right type.
  19. GMail paper is free service that allows you to request your email from any GMail account to be printed, and sent to you for free. All Images are printed on glossy photo paper, however WAV and MP3 files are not sent along. There is no limit to the amount of emails that can be sent. It even uses 96% post-consumer organic soybean sputum. To read more, go here. Gmail Paper
  20. Another security vulnverability? This is just sad. The amount of holes they have in their systems and the time it takes to fix them is just not good at all. This is one of the reasons I switched to using Linux. Windows runs really slow on my computer. I have only had one problem is the fact that my browser sometiems randomly closes, but with the increased speed on my computer it is worth it. Hopefully there aren't too many more vulnerabilities. Its saddening hearing about all of them.
  21. After reading the popular mechanics I still believe that the September 11th attacks were done by terrorists. As posted above, people just don't want to deal with the fact that some people want to kill us.
  22. Interesting function. What exactly is the purpose of the argument InNoWanted?
  23. If you are going to do what Galahad said, you need to make sure you start out VERY simple and have very small goals, if you do not, you'll just get frustrated. All of the programming I know I taught myself, and I made that mistake. If you have any VB questions you can ask me. I've been writing with it for close to 11 years now. Good luck .
  24. I really like my iPod Mini. iPod nanos are too small, and I don't have any videos I want to watch. It fits right in my hand, and I'm never going to use more than 6 GB. Its perfect for me.
  25. Notice from jlhaslip: Dell Dimension 24002.8 GHZ Intel Pentium 4256 MB DDR (i think DDR) RAMNVidia 256 MB GeForce 5200 (not sure about the 5200 part)80 GB Hard DriveIntel Sound CardDell NICThese lists need to be "quote" tagged. My comp is 3 years old.
×
×
  • 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.