Jump to content

per1os

Newly Registered
  • Posts

    3,095
  • Joined

  • Last visited

Everything posted by per1os

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. I like to use a camera, it is very visual!
  6. Mockery is always needed for retarded posts.
  7. 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?
  8. Well, if you would stop posting links to people having sex with animals, I am sure they would allow it.
  9. http://www.phpfreaks.com/forums/index.php?topic=277416.0 ... If you had only read the stickies.
  10. 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.
  11. @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?
  12. 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.
  13. 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.
  14. The best way to work on your web design skills is reading and finding out more information on how it actually works. Just blindly trying and guessing, is a decent way to learn stuff, but often leads to learning the "wrong" stuff. IE, putting the style inline with the HTML, I understand if you are just testing the waters, but yea, bad habits are hard to break. My suggestion would be to find some good resources / tutorials and understand the fundamentals of how webdesign with CSS / HTML / JS works and it will help you immensely if you understand the underlying process and when to user certain items.
  15. Don't suppress errors (@ sign). This makes debugging a bitch. Why do you need rows, if you are pulling the information needed out anyways? Just an extra step, not needed. // make sure you mysql_real_escape_string $username, if it is coming from an untrusted source. $query = mysql_query("SELECT count(*) as cnt FROM users WHERE username = '$username'") or trigger_error('MySQL Query Failed: ' . mysql_error()); // If the query is bad no need to fetch anything. if (!empty($query)) { $result = mysql_fetch_assoc($query); if (!empty($result) && $result['cnt'] == 1) { // Yep a user. }else { // Nope. } }else { // no info returned, error } Should get you started. // Side Note It is practice, not practise
  16. Tables are leet, keep using them! I mean really, thats all I ever do my designs in, they are sooooo cool looking and not n00b looking at all. Keep up the good work, and cssfreakie, you should really look into tables for your templates, it is the way of the future, CSS 2/3 is a thing of the past!
  17. To me you are and if I offended you, well thats your problem, grow a sack and realize, oh shit, itz the internetz! Sorry if you are butt hurt over a few words. On a side note, I would agree with you. But, it is an English forum, and back talking to a Moderator is not suggested. So I would just suggest to drop it before it spins out of control and you get even more offended!
  18. fguix, stop being an idiot troll. The forums are English because the audience is primarily English. If you want a non-English forum, go find it else where.
  19. lol. Learn to use the Internet? No one to blame but yourself buddy. Lazerus is a great tool for Chrome, but I bet you use IE, so yea.
  20. If you want a true backup, I love CrashPlan. Best thing I did was install it on my server and pay the $5/month fee. Incase anything happens, everything is versioned offsite. I recently had a Corrupt MySQL Table and was able to go back 12 hours and restore the uncorrupted table. Saved my ass more then once. If you are just looking to have version control, svn / cvs / git / bzr / mercurial are all good. If you want a true backup I would suggest CrashPlan. (And yes it can run on a Linux Headless)
  21. TLG, hopelessX hit the nail on the head. You are not comparing the storing of data, just the processing. It all depends on your needs, but in general, it would be better to pull the data out in it's raw format and let the processor (in this case PHP) handle the display. This is because you should have your View Logic and Business Logic separated, going with those standards (MVC route) PHP should handle all of the display parts. You can, however, pull certain stuff out of SQL how you want, such as dates, but it would be much easier to change the view logic to handle the date vs the SQL (and less detrimental to the site if you messed up the SQL upon editing) and I would rather not tax my SQL server when PHP can handle it. So, my vote will go with PHP and a separation in the form of a Model View Controller setup.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.