|
|
|||||||
| About Us | Register | FAQ | Members List | Calendar | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: England, drinking tea.
Posts: 547
|
ok i cann't work out why this stupid frikin script doesn't work.
and yer i have deliberatly changed the username and password ![]() here is the code in a txt, change the extension to .php |
|
|
|
|
|
#2 (permalink) |
|
Banned
![]() ![]() Join Date: Apr 2004
Location: Mother Earth
Posts: 124
|
visit www.phppowerforums.net for help
i don't know if it's still working. their server was down last week |
|
|
|
|
|
#3 (permalink) |
|
Registered User
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2002
Location: St Andrews, Scotland
Posts: 1,575
|
That code is hella insecure. All you need is someone to enter "f@ke.com', NULL; drop signup;" as their emailand you're screwed royally, hope you have backups! Call mysql_escape_string on them to secure your script.
__________________
OS: Arch Linux w/ Kernel 2.6.23.8 + GNOME 2.20.1 - CPU: Intel Pentium M 1.5GHz - Memory: 1280MB DDR PC2700 - Browser: Mozilla Firefox 2.0.0.10 |
|
|
|
|
|
#4 (permalink) |
|
Puchiko-nyu!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2001
Location: 49° 11' N 123° 10' W
Posts: 2,854
|
Straight variables won't work anymore unless you enable the REGISTER_VAR_GLOBALS (or something like that) flag in the php config file, which is NOT recommended.
I'd recommend changing your code to this: access your form variables using $_POST["username"].
__________________
"Not every ejaculation deserves a name." --- George Carlin |
|
|
|
|
|
#6 (permalink) |
|
Emulation64's Animal >:D
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2001
Location: United States
Posts: 1,215
|
Well just a few things to point out that might help .. you didn't really say what the problem was .. so I can only assume what it could be.
------------------------------ try changing if ($mode == 'submit') { to just if ($submit) { ------------------------------ also noticed you use slashes in the query such as \'$name\', .. you should be able to just use '$name', .. but not sure if using the slashes would even cause a problem since I didn't test it. ------------------------------ Also on a side note for the id .. you should not have to include it in the query if you use auto_increment for the database for that field Just a few suggestions after taking a quick glimpse
__________________
![]() ![]() ![]() ![]() Emulation64.com | EFx2Blogs Forums | EFx2Blogs - Sign Up For Your Own Free EFx2Blog Today! |
|
|
|
|
|
#7 (permalink) |
|
I Need a Weapon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Omaha, NE
Posts: 4,321
|
Either set register_globals = 1 in php.ini or use $_POST["username"] to extract the POST variables like kairi said. By default, php.ini comes with register_globals disabled as a security precaution. So, if you didn't configure your PHP installation, the header variables won't be implicitly defined. Even if register_globals were enabled, it's still a good idea to extract the vars so that users can't inject values you aren't expecting into the code.
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.
![]() .: Mac Pro :: Dual Quad-Core Intel Xeon 5400s :: 6 GB 800MHz DDR2 ECC FB-DIMMs :: NVIDIA GeForce 8800 GT 512 MB GDDR3 :. .: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :. .: Home Server :: 2.41 GHz AMD Opteron 180 :: 4 GB DDR400 :: Windows Server 2003 Enterprise R2 :. |
|
|
|
|
|
#9 (permalink) |
|
Emulation64's Animal >:D
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2001
Location: United States
Posts: 1,215
|
on that one .. either remove the id or add a value for the id ..
such as .. $sql = 'INSERT INTO test(name, email, beer) VALUES "'.addslashes($_POST['$name']).'", "'.addslashes($_POST['$email']).'", "'.addslashes($_POST['$beer']).'")'; $result = mysql_query($sql); Also I think it is $_POST['name'] .. not $_POST['$name']
__________________
![]() ![]() ![]() ![]() Emulation64.com | EFx2Blogs Forums | EFx2Blogs - Sign Up For Your Own Free EFx2Blog Today! Last edited by Keith; May 3rd, 2004 at 09:58. |
|
|
|
|
|
#13 (permalink) |
|
Registered User
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2002
Location: St Andrews, Scotland
Posts: 1,575
|
As follows:
Code:
$secure = mysql_escape_string($unsecure); "this 'string' was" Into: "this \'string\' was"
__________________
OS: Arch Linux w/ Kernel 2.6.23.8 + GNOME 2.20.1 - CPU: Intel Pentium M 1.5GHz - Memory: 1280MB DDR PC2700 - Browser: Mozilla Firefox 2.0.0.10 |
|
|
|
|
|
#15 (permalink) |
|
Registered User
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2002
Location: St Andrews, Scotland
Posts: 1,575
|
Well, all you had to do was look at the docs at PHP.net. FYI this is something that you should really should know by now. I was able to figure that in the 30 minutes or less that I've ever used PHP for.
__________________
OS: Arch Linux w/ Kernel 2.6.23.8 + GNOME 2.20.1 - CPU: Intel Pentium M 1.5GHz - Memory: 1280MB DDR PC2700 - Browser: Mozilla Firefox 2.0.0.10 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|