Page 1 of 1
I'm so confused...
Posted: Sun Feb 27, 2011 9:56 am
by KingScar
Hey guys,
So the reason i haven't been on that much lately is because I've been coding this new game I've been working on but for some reason i get errors on a lot of the pages for some reason. I'm running the code off of a WAMP server with:
Apache 2.2.17
PHP 5.3.3
MySQL 5.5.8
I"ve been programming php for a good amount of time, however I just started working with WAMP servers not that long ago so I don't know if some of my errors would have to do with the server itself or not. I've got most of the code done I was just hoping the community could go over my coding and tell me where the mistakes are and help me fix them.
Thanks, Ryan
P.S This is the link i've loaded all my files too
http://www.mediafire.com/?c0dk2c5r805rj
Re: I'm so confused...
Posted: Sun Feb 27, 2011 1:36 pm
by Xaleph
what kind of errors are you getting?
Re: I'm so confused...
Posted: Sun Feb 27, 2011 9:34 pm
by rockinliam
Upload it to a free web host give us the link and we shall alpha test it and such. This will help us determine easier where bugs are and where security flaws may exist.
Re: I'm so confused...
Posted: Mon Feb 28, 2011 1:09 am
by KingScar
I'm getting errors like deprecated code and i also notice some files like for example,
include_once ("config.php")
for some reason some includes aren't connecting.
And Liam the game isn't even available to alpha yet because my problem is, IT BARELY WORKS AT ALL!
How do i upload the files to a site like mediafire and group them together so you can do one mass download of all the files instead of one by one?
Re: I'm so confused...
Posted: Mon Feb 28, 2011 7:57 am
by PaxBritannia
For the downloads, try compressing them into a self-extracting archive.
pax.
Re: I'm so confused...
Posted: Mon Feb 28, 2011 7:40 pm
by Xaleph
Well, first check if you have used ; at the end of all lines. Some PHP functions like eregi() are deprecated, instead use functions like str_replace.
For the warnings, check the corresponding code and look it up at php.net. The PHP API is very good, so most awnsers can be found there alone.
Re: I'm so confused...
Posted: Mon Feb 28, 2011 11:30 pm
by KingScar
Thanks Xaleph, I found the answer to one of my problems on there a little while ago but, now i'm having problems with something else i cant figure out.
my connect.php file works fine ive checked the connect it seems like 10 times already but, when i go to log in to test and try to work out the other bugs i get this:
Undefined index: name in C:\wamp\www\untitled\index.php on line 10
and this is the code it's referring to:
Code: Select all
if (preg_match('[^A-Za-z0-9]', $_POST['name'])) {// before we fetch anything from the database we want to see if the user name is in the correct format.
echo "Invalid Username.";
}else{
$query = "SELECT password,id,login_ip FROM users WHERE name='".mysql_real_escape_string($_POST['Username'])."'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
and when i check the server through phpmyadmin i look in the users table and the column 'name' is in there, but it's still throwing that out at me and idk why.
Also, thanks for that pax idk why i didnt just ZIP them in the first place..
Re: I'm so confused...
Posted: Tue Mar 01, 2011 12:29 am
by Xaleph
You are matching the IF statement. This means that you did get a match there, which means it doesn`t go to the else, where you declare your $name.
Btw, the error is PHP, not Mysql. So the query should work fine i guess, but you just don`t have a name to give.
Anyway, i looked over your code again and i see this is your problem:
In the first you use $_POST['name'] and in your query you use $_POST['Username'].
Try sorting that stuff out too.