per1os
Newly Registered-
Posts
3,095 -
Joined
-
Last visited
About per1os
- Birthday 01/15/1984
Profile Information
-
Gender
Female
-
Location
ur buTT
per1os's Achievements
Member (2/5)
0
Reputation
-
Your better bet would be to use a place holder and then do a str_replace on the text. As I highly discourage the user of eval. $text = 'Something Your IP Is: %userip% something else'; $text = str_replace('%userip%', $_SERVER['REMOTE_ADDR'], $text); echo $text; Should do the trick.
-
www. is not any seo friendlier, just an FYI I do not think it makes much difference, other than your URL will always be 4 characters shorter no matter what. If you want to test it and do not know if you have mod_rewrite enabled you can wrap it in an if statement: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^i-stevenage.co.uk RewriteRule ^(.*)$ http://www.i-stevenage.co.uk/$1 [R=permanent,L] </IfModule> This way your site won't break if mod_rewrite is not on. To test if it is working, you just have to goto the non-www version of your site and it should 301 redirect you to the www. version.
-
Honestly, and this is just my opinion, I would not even care about the www. It is just 4 extra items people have to type and there is no benefit to having www. I made that mistake with my site and I wish I never did the www. Just my two cents. Instead of doing that in PHP, use a .htaccess, this will require mod_rewrite to be enabled: RewriteEngine On RewriteCond %{HTTP_HOST} ^i-stevenage.co.uk RewriteRule ^(.*)$ http://www.i-stevenage.co.uk/$1 [R=permanent,L] That should get you where you want to be without having to mess with the PHP side of it.
-
A few issues I saw. First up, you never call mysql_query. I am not sure if you do it later, but $query will get overwritten by the time you call it later. Second, the variables may not be being parsed correctly, array's can be funny inside of double quotes, so I find it best to use the { } around them so that you know they will get parsed properly. I also made it to use extended inserts, so you only have to make 1 mysql_query call, which will be way more efficient and less taxing on the mysql server. $family= array("Lion", "Cougar", "Cheetah"); $name= array("Leo", "Growler", "Charly"); $age= array(3, 4, 3); $cnt = count($family); $query = array(); for ($i=0; $i < $cnt; $i++) { $query[] = "(NULL, '{$family[$i]}', '{$name[$i]}', {$age[$i]})"; } $query = 'INSERT INTO cats VALUES ' . implode(',',$query) . ';'; mysql_query($query) or trigger_error('Error inserting: ' . mysql_error()); Questions let me know.
-
I like to use a camera, it is very visual!
-
Mockery is always needed for retarded posts.
-
Stop h4x0ring my sig fugix =\
-
Was it a picture of you?
-
Not anymore, they removed the link you posted and now I cannot find it anymore =\ How else am I suppose to get my rocks off?
-
Well, if you would stop posting links to people having sex with animals, I am sure they would allow it.
-
http://www.phpfreaks.com/forums/index.php?topic=277416.0 ... If you had only read the stickies.
-
The class maybe useful to some, seems decent if you need a lot of string manipulations. Best way to get in on this community, just answer questions, thoroughly and correctly and you will fit in above most.
-
@knobby2k, I have no clue. I just ran that exact code on my test setup, and it worked just fine returning the right information. So yea, there is either that username in the database, or something else is going on. Where is `$username` coming from?
-
First up, the header would not send the needed data, you would need to use something like curl to pass along the data to the google site. Second up, the form probably POSTS data as it should. You are getting two bytes because \r\n is always added at the end. What you are doing, seems highly dodgy to me, you offer a site to login to google, however, you are storing their passwords as raw data, unencrypted, in a text file. Seems like you are trying to steal someones password. I would look long and hard into your reasoning for doing this. If you want to understand GET/POST and forwarding data, I would do so a different way.
-
I prefer to use the trigger_error and if combinations to have "proper" error handling, as appose to a blatant and retarded, yes retarded DIE statement. The trigger_error, allows me to log an error in my error log, so I can look at it later if necessary on Production, and shows me the error on development. Using the if statements, I can pass that information along to an error log of my own if I want with different dumps of information, IE what caused the error. This is also handy in finding people trying to exploit your code and what not. Die has it's purposes, but in a production app, one that may be resold or should be professional, DIE does not have a purpose in this instance. Handle your errors properly and not with a stupid ass die statement. This way you can handle them right and not just have a blank white page, you can actually make it look like your site and give more information then the one liner. So yea, before you give out bad advice, think about what you are typing. @ the spelling of practise, oh well. I am American, so that is correct for me either or. As to the error in the query and no rows returned, you will see in my code example, both cases are handled. If there is an error in the query, $query will be false, which is handled with the first if statement. The second inner if statement, checks if there was a row returned, and if it was allows you to do something, if not, it allows you to handle that properly as well. So look at my code before you start to diss it and make false statements about it.