| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Php site.com?site | |
|---|---|
| Tweet Topic Started: May 5 2005, 10:24 PM (1,085 Views) | |
| Das | May 6 2005, 10:02 AM Post #16 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I think I understand teh smart Sethy. All these posts exsist on the database, and $_Get[] retrevies the infromation from the database and displays it on this page in the form of posts? *Das hopes he is right for once. |
![]() |
|
| Rory | May 6 2005, 10:22 AM Post #17 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
not quite. Let me break it down for you. When you have a url like so: http://examplesite.com/index.php?page=rawr&id=5 you are actually creating two variables. however, to access these variables, you have to use the Super Variable $_GET[]. $page = $_GET['page']; This would assign 'rawr' to the variable $page. Then, somewhere else in your php code, you could use that variable to do something. There are other super variables, like $_POST[] and $_COOKIE[]. $_POST[] is used when sending data from forms, but not shown in the url (if you were submitting a password you would use the form method Post not Get, so people can't see your password). I hope that kind of makes sense. $_GET[] is a way of accessing the variable sent in the url as index.php?page=rawr It is not used to actually retrieve the data from anywhere else. you would have to then do something using that variable. |
![]() |
|
| Das | May 6 2005, 10:32 AM Post #18 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
O I think I get it now. Thank you muchly. You talk in nice small words that are easy to understand. |
![]() |
|
| kingy | May 6 2005, 11:09 AM Post #19 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
just while we are on this subject...is $_Get necessery all of the time? i have used ?page=1 format things and just used if ($page==1) for ages, and it hasn't caused problems, so is the global neccessery or should i use it? |
![]() |
|
| Rory | May 6 2005, 11:56 AM Post #20 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You should most definitly get into the practice of using the super variables. Using just $page means that register_globals is turned on, and this could lead to security problems. You should put all values from query strings into variables from the superglobal variables. |
![]() |
|
| Seth | May 6 2005, 12:18 PM Post #21 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yep. What if I knew your admin passwordcheck variable name? So you check if ($login == TRUE) { show_admin_tools(); } and I call http://youradmin.com/?login=TRUE :ph34r: |
![]() |
|
| Das | May 6 2005, 05:17 PM Post #22 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Would it be a bad thing to have all the login done through individial files? Like: http://www.yourname.com/login.php //Form where name and password are entered http://www.yourname.com/loginincheck.php // Check the password and username vars http://www.yourmane.com/setcookie.php //Set appropritate cookie for user It looks a little tacky, but is that suseptable to attacks? Can you creat a cookie for another site, and fool thoose types of things. |
![]() |
|
| Rory | May 6 2005, 05:21 PM Post #23 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It is best to do it all in one. Just have a form on a page, and have: if ($_POST['submit']) { // do verification // if verify's do cookie setting } else { // display the form for filling out } if that makes sense? |
![]() |
|
| Das | May 6 2005, 05:29 PM Post #24 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Err you mean something like... if ($_POST['username'] == $username && $_POST['password'] == $password ) { // Put cookie } else { echo "You are very forgetful or trying to hack" } Can you have the form and "$_POST['username']" on the same page? |
![]() |
|
| Seth | May 6 2005, 05:40 PM Post #25 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yes, if you make the form submit to itself. |
![]() |
|
| Das | May 6 2005, 05:53 PM Post #26 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Would it still be able to process the info on the same page? EX:
Would that actually work and set the cookie if things were right? [ot]Can you make the password for replace the password text with ****? |
![]() |
|
| JoeC | May 6 2005, 05:56 PM Post #27 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Would that not break / let them in if you entered:
in the password box? Just a little injection. |
![]() |
|
| Das | May 6 2005, 06:01 PM Post #28 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
What? Try again. |
![]() |
|
| Rory | May 6 2005, 06:06 PM Post #29 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Das Ein. To have the form and processing on one page, you have to do it how i said. You make the form submit to the same page, and have the submit button called 'submit'. (Make sure the form's method is 'post' if you are submitting passwords) Then you check whether $_POST['submit'] has been set. If not, you display the html for the form, otherwise you process the information sent. so you would have this:
That should be what you want... Also, that should replace any text written in the password field with ****'s so you can't see it. (but the text is actually the same) |
![]() |
|
| Das | May 6 2005, 06:11 PM Post #30 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Rory you must have forgot to close a tag in your example because it displays
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| Go to Next Page | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
8:35 AM Jul 11
|




![]](../../../../0/1/0/p601690/pipright.png)



8:35 AM Jul 11