$query = mysql_query("SELECT * FROM `users` WHERE `id`='".$sess_id."' AND `username`='".$sess_username."' AND `password`='".$sess_password."' LIMIT 1"); $count = mysql_num_rows($query);
$date = date("m.d.Y"); /* Date - Month.Day.Year */ $time = time(); /* Numerical Time */ $timestamp = date("g:i A"); /* Time - Hour:Minute AM/PM */ $ip = getenv('REMOTE_ADDR'); /* Ip Address */
?>
22-07-2008, 02:45 AM
Hypertext
Don't use ! in your ternarys, instead just reverse the statements.
You shouldn't be directly editing data taken from a database ie $logged['in']
You mispelt mysql_connect
is $_SESSION['id'] boolean?
You have a lot of pointless ternarys
I think your mistaking booleans and wether a string is null/not set
instead get an ip like $_SERVER['REMOTE_ADDR']
single quotes are faster than doubles
your mistaking your variable names (time types) (just a personal preference)
$logged['in'] should be set as true or false, not 1 or 0.
I personally wouldn't use a mysql connection resource in your database selector
I don't know where your going with the output buffering
a few personal preferences but some are needed.
please check your code in a debugger or an ide, coming on here asking about mysql_pconnect, it's to be honest wasting everybodys time when you could see that individual mistake in quarter of a second on an ide or a debugger.
ok your first page
ips are dynamic a lot of the time so don't use them
your database schema looks bad - ip - as a row?
++$error;
is faster than
$error++
Use echo equals like <?= $var ?>
where are some of your functions coming from?
such as is_valid_email
HOW THE HECK ARE YOU DOING ALL THIS WITHOUT A SINGLE ERROR TO PRODUCE FOR US?
Wow...
as for your html you didn't do much with <form> atleast add action
oh and get rid of $insert = ...why is that there in the first place!!??!
22-07-2008, 12:48 PM
Dentafrice
I suggest that everyone read this ;) Quite funny. heh.
Quote:
Originally Posted by Hypertext
Don't use ! in your ternarys, instead just reverse the statements.
You shouldn't be directly editing data taken from a database ie $logged['in']
You mispelt mysql_connect
is $_SESSION['id'] boolean?
You have a lot of pointless ternarys
I think your mistaking booleans and wether a string is null/not set
instead get an ip like $_SERVER['REMOTE_ADDR']
single quotes are faster than doubles
your mistaking your variable names (time types) (just a personal preference)
$logged['in'] should be set as true or false, not 1 or 0.
I personally wouldn't use a mysql connection resource in your database selector
I don't know where your going with the output buffering
a few personal preferences but some are needed.
please check your code in a debugger or an ide, coming on here asking about mysql_pconnect, it's to be honest wasting everybodys time when you could see that individual mistake in quarter of a second on an ide or a debugger.
ok your first page
ips are dynamic a lot of the time so don't use them
your database schema looks bad - ip - as a row?
++$error;
is faster than
$error++
Use echo equals like <?= $var ?>
where are some of your functions coming from?
such as is_valid_email
HOW THE HECK ARE YOU DOING ALL THIS WITHOUT A SINGLE ERROR TO PRODUCE FOR US?
Wow...
as for your html you didn't do much with <form> atleast add action
oh and get rid of $insert = ...why is that there in the first place!!??!
Okay, don't be stupid.. you don't know anything about coding.
After reading your post.. and seeing your stupid remarks about what you think, I have to laugh.. :eusa_clap good job.. it was all a joke right?
Sadly not with you.. you are actually being serious.. you think what you just said was correct.
No.. no it wasn't.
Lets start off with some of the things you just said, and address why they are the most idiotic remarks about PHP I think I have heard yet.
About as bad as someone asking what echo does.
Don't use ! in your ternarys, instead just reverse the statements.
Why do that, and increase the file size and coding.. that is not the preferred method.. use !=, but not !$statement.
Quote:
You shouldn't be directly editing data taken from a database ie $logged['in']
Why not? It Isn't editing it on the database.. just the array it is stored on. It is his data.. it is checking the array, not the database..
Not the safest method, but it works for what he is doing.. duh.
Quote:
is $_SESSION['id'] boolean?
Why would you have an id with letters?
Quote:
instead get an ip like $_SERVER['REMOTE_ADDR']
getenv is the opposite of using a superglobal.. my god read php.net
Quote:
single quotes are faster than doubles
No.. single quotes are for simple strings.. there is no use having a bunch of:
PHP Code:
$string = 'hey ' . $there . ' my name is ' . $caleb . ' I hope ' . $you . ' ...';
That is stupid when you can just use a set of "" and be done with it, as PHP parses that string above as each '' being a different string, then joins them.
So use '' for simple things
PHP Code:
$string = 'hello';
"" for variables and other things.. different times for different things..
don't start going about speeds... you have no clue.
Quote:
$logged['in'] should be set as true or false, not 1 or 0.
Haha.. this is my favorite! My absolute favorite.
Mr. PHP MAN!
TRUE/FALSE is 1/0!!!!!!
I thought you knew all this? All true false is, is a boolean!
So you are telling him to be setting it to the same thing, are you stupid?
Don't give advice if you don't know what you are talking about.
You are trying too hard to be smart.
Quote:
I personally wouldn't use a mysql connection resource in your database selector
Okay dude.. listen.. this isn't a normal mysql connect, it is a pconnect, you normally need a link for it to communicate right as it is persis.
You want to keep it on the same link! Not start another connection, then you run into problems with MySQL taking up 200MB of RAM.
Gah.
Quote:
I don't know where your going with the output buffering
Maybe if you read?
Quote:
ob_start("ob_gzhandler");
He is gzipping it! Congratulations for not reading 6th line.
He is probably using cookies.. you need ob_start(); :rolleyes:
Quote:
a few personal preferences but some are needed.
please check your code in a debugger or an ide, coming on here asking about mysql_pconnect, it's to be honest wasting everybodys time when you could see that individual mistake in quarter of a second on an ide or a debugger.
You don't need an IDE, it makes it easier yes, but he isn't to the point now where he needs a professional development tool.
From what I have read, you are on about the same level as him, and neither do you.
It's to be honest you are wasting everyone's time when you come on here providing wrong advice, wrong coding tips, and stupid points.
mysql_pconnect is a function to connect to the database.. it isn't ******* mispelled.
You really need to use PHP.net..
Quote:
ips are dynamic a lot of the time so don't use them
No **** sherlock, you just figured out the internet?
What other identifying variable do you suggest we use then..? There isn't one, which is why sites log IPs.
You could use hostname, which just transfers to an IP and vise versa, or include a shockwave movie and grab the MAC id but that is too much of a pain.
Which is why we use IPs. Gah.
Quote:
your database schema looks bad - ip - as a row?
Yeah, he is storing the IP.. dip****, the ip isn't a row.. it is a column..
He is either storing the IP when registered, or constantly updating it.. why would you think it is a row?
Quote:
++$error;
is faster than
$error++
It is the SAME thing.. just reversed.. you are telling it to do the same thing.. it is neither faster or slower.. before making a statement.. test it out.. time it.. god.
Quote:
Use echo equals like <?= $var ?>
No.. just no.. that is an awful way to do it.. <? is a shortag, do it the right way if you are going to be telling him how to do it.
You are going to make him a bad as you.
[php
<?php echo $var; ?>
[/php]
Simple ;) Put it in your clipboard, or snippets, easy as heck.
where are some of your functions coming from?
Probably a file he hasn't posted, thought of that?
Quote:
HOW THE HECK ARE YOU DOING ALL THIS WITHOUT A SINGLE ERROR TO PRODUCE FOR US?
All your statements are invalid, so there is no 'doing all this'.
If you haven't noticed.. it isn't about the PHP.. it is about inserting into the database.
Quote:
as for your html you didn't do much with <form> atleast add action
Seriously kid.. he didn't ask what the hell you thought about his HTML, if you haven't noticed.. the title is Not adding to DB [PHP]
PHP! PHP! damn.
Quote:
oh and get rid of $insert = ...why is that there in the first place!!??!
Because it is a query! You can get results from queries, server response, and do way more as well as fetch the array sent in an insert.
There is nothing wrong with that..
All in all.. you just got owned... quit providing advice.. noob.
The error probably is in MySQL, but I can't be arsed to check the code.
That should return a MySQL error for us to look through.
If that isn't it, try changing to mysql_connect and removing the $link from the mysql_select_db.
22-07-2008, 01:06 PM
Excellent1
Quote:
Originally Posted by Hypertext
Don't use ! in your ternarys, instead just reverse the statements.
You shouldn't be directly editing data taken from a database ie $logged['in']
You mispelt mysql_connect
is $_SESSION['id'] boolean?
You have a lot of pointless ternarys
I think your mistaking booleans and wether a string is null/not set
instead get an ip like $_SERVER['REMOTE_ADDR']
single quotes are faster than doubles
your mistaking your variable names (time types) (just a personal preference)
$logged['in'] should be set as true or false, not 1 or 0.
I personally wouldn't use a mysql connection resource in your database selector
I don't know where your going with the output buffering
a few personal preferences but some are needed.
please check your code in a debugger or an ide, coming on here asking about mysql_pconnect, it's to be honest wasting everybodys time when you could see that individual mistake in quarter of a second on an ide or a debugger.
ok your first page
ips are dynamic a lot of the time so don't use them
your database schema looks bad - ip - as a row?
++$error;
is faster than
$error++
Use echo equals like <?= $var ?>
where are some of your functions coming from?
such as is_valid_email
HOW THE HECK ARE YOU DOING ALL THIS WITHOUT A SINGLE ERROR TO PRODUCE FOR US?
Wow...
as for your html you didn't do much with <form> atleast add action
oh and get rid of $insert = ...why is that there in the first place!!??!
Mod, please delete this post. Will, if you get an error post it here.
22-07-2008, 04:08 PM
Independent
I won't bother quoting your post caleb, it's long, but I agree as your code is right etc.
Add to your form code; (Top of your form, replace the FORM tag)
HTML Code:
<form action="" method="post">
23-07-2008, 12:13 AM
Hypertext
Quote:
Originally Posted by Dentafrice
I suggest that everyone read this ;) Quite funny. heh.
Okay, don't be stupid.. you don't know anything about coding.
After reading your post.. and seeing your stupid remarks about what you think, I have to laugh.. :eusa_clap good job.. it was all a joke right?
Sadly not with you.. you are actually being serious.. you think what you just said was correct.
No.. no it wasn't.
Lets start off with some of the things you just said, and address why they are the most idiotic remarks about PHP I think I have heard yet.
About as bad as someone asking what echo does.
Don't use ! in your ternarys, instead just reverse the statements.
Why do that, and increase the file size and coding.. that is not the preferred method.. use !=, but not !$statement.
Why not? It Isn't editing it on the database.. just the array it is stored on. It is his data.. it is checking the array, not the database..
Not the safest method, but it works for what he is doing.. duh.
Why would you have an id with letters?
getenv is the opposite of using a superglobal.. my god read php.net
No.. single quotes are for simple strings.. there is no use having a bunch of:
PHP Code:
$string = 'hey ' . $there . ' my name is ' . $caleb . ' I hope ' . $you . ' ...';
That is stupid when you can just use a set of "" and be done with it, as PHP parses that string above as each '' being a different string, then joins them.
So use '' for simple things
PHP Code:
$string = 'hello';
"" for variables and other things.. different times for different things..
don't start going about speeds... you have no clue.
Haha.. this is my favorite! My absolute favorite.
Mr. PHP MAN!
TRUE/FALSE is 1/0!!!!!!
I thought you knew all this? All true false is, is a boolean!
So you are telling him to be setting it to the same thing, are you stupid?
Don't give advice if you don't know what you are talking about.
You are trying too hard to be smart.
Okay dude.. listen.. this isn't a normal mysql connect, it is a pconnect, you normally need a link for it to communicate right as it is persis.
You want to keep it on the same link! Not start another connection, then you run into problems with MySQL taking up 200MB of RAM.
Gah.
Maybe if you read?
He is gzipping it! Congratulations for not reading 6th line.
He is probably using cookies.. you need ob_start(); :rolleyes:
You don't need an IDE, it makes it easier yes, but he isn't to the point now where he needs a professional development tool.
From what I have read, you are on about the same level as him, and neither do you.
It's to be honest you are wasting everyone's time when you come on here providing wrong advice, wrong coding tips, and stupid points.
mysql_pconnect is a function to connect to the database.. it isn't ******* mispelled.
You really need to use PHP.net..
No **** sherlock, you just figured out the internet?
What other identifying variable do you suggest we use then..? There isn't one, which is why sites log IPs.
You could use hostname, which just transfers to an IP and vise versa, or include a shockwave movie and grab the MAC id but that is too much of a pain.
Which is why we use IPs. Gah.
Yeah, he is storing the IP.. dip****, the ip isn't a row.. it is a column..
He is either storing the IP when registered, or constantly updating it.. why would you think it is a row?
It is the SAME thing.. just reversed.. you are telling it to do the same thing.. it is neither faster or slower.. before making a statement.. test it out.. time it.. god.
No.. just no.. that is an awful way to do it.. <? is a shortag, do it the right way if you are going to be telling him how to do it.
You are going to make him a bad as you.
[php
<?php echo $var; ?>
[/php]
Simple ;) Put it in your clipboard, or snippets, easy as heck.
where are some of your functions coming from?
Probably a file he hasn't posted, thought of that?
All your statements are invalid, so there is no 'doing all this'.
If you haven't noticed.. it isn't about the PHP.. it is about inserting into the database.
Seriously kid.. he didn't ask what the hell you thought about his HTML, if you haven't noticed.. the title is Not adding to DB [php]
PHP! PHP! damn.
Because it is a query! You can get results from queries, server response, and do way more as well as fetch the array sent in an insert.
There is nothing wrong with that..
All in all.. you just got owned... quit providing advice.. noob.
The error probably is in MySQL, but I can't be arsed to check the code.
That should return a MySQL error for us to look through.
If that isn't it, try changing to mysql_connect and removing the $link from the mysql_select_db.
What the hell was that orgasm about?
Chill pill alert.
Seriously Caleb, have you even heard about something called benchmarks, the stuff I said is faster is faster because it is. And your thing about <?= ?> is just plain funny. Your the noob!, noob.
23-07-2008, 12:17 AM
Source
*removed*
Edited by SyrupyMonkey (Forum Super Mod.): Please don't be rude to other members.
23-07-2008, 12:59 AM
Dentafrice
Quote:
Originally Posted by Hypertext
What the hell was that orgasm about?
Chill pill alert.
Seriously Caleb, have you even heard about something called benchmarks, the stuff I said is faster is faster because it is. And your thing about <?= ?> is just plain funny. Your the noob!, noob.
Quit using terms in which you do not even know the definition of, you don't even know what benchmarks or benchmarking is, or how to even complete a succesful, accurate benchmarking test.
You really don't have any idea about PHP, how it works, and what it is based on?
I have been coding far longer then you, and I know far more then you, if I remember correctly.. you asked me what a class is.. and that was around May, and in almost two months you know what I have learned in years, no...
Quit pretending you know what you are talking about.. it is getting old.
I know what the **** a benchmark is, don't talk to me like I'm stupid.. when you don't even know what one is.
It is not "faster because it is", no.. you don't even know what PHP is doing when it interprets the code.. you don't know what memory it is using, the overhead from using different functions and different methods is all the same.
Quit pretending..
I would love to see how you think my statement about <?=$test; ?> is just "plain funny", *removed*
Edited by SyrupyMonkey (Forum Super Moderator): Please don't be rude, thanks.