Jump to content
MakeWebGames

Spudinski

Members
  • Posts

    1,731
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Spudinski

  1. Spudinski

    Php

    Re: Php Google should be your primary source for information, simply because it has allot of it. Reading trough PHP forums and tutorials is a great help as well, but only thing with that is that you only learn what the author wants you to learn.
  2. Re: MD5 Generator Nice idea, but I only think it could be easier to use javascript. http://www.webtoolkit.info/javascript-md5.html
  3. Re: Need Help!!!!!!! * Topic Moved *
  4. Re: Multiple explore pages   ...and that's why arrays were created. Using separate files would make it easier to modifiy the different pages, but it could hold a security risk if it is placed in web root(htdocs/www/public_html) and not protected by direct access. Here is an example. <?php require('globals.php'); $pages = array( 0 => false, 1 => 'new york', 2 => 'london', 3 => 'tokio', 4 => 'johannesburg', 5 => 'venice' ); $absolute_path = '/home/user/includes/cities/' . strtolower(str_replace(' ', '_', $pages[intval($ir['location'])])) . '.php'; if ($pages[intval($ir['location'])] == false || !file_exists($absolute_path)) { // we assume invalid entry ... or hacking attempt(?) echo 'You do not have permission to be here, you will automatically be transfered to the first city.'; mysql_query('UPDATE `users` SET `location` = 1 WHERE `userid` = ' . $userid); } else { echo ' <h3>Welcome to ' . ucwords($pages[intval($ir['location'])]) . '!</h3></p>'; include($absolute_path); } ?>
  5. Re: CSS Textbox Edit ANY VERSION Cuil was released by someone semi-popular, and someone that has allot of contacts because of where he worked. It was in the - internet - news a few weeks/months ago.
  6. Re: Counting (nr game) 1961
  7. Re: Counting (nr game) 1958
  8. Re: Multi IP Prevention If someone really wants another account, there is nothing that can stop them. Just face that fact and get passed this obstacle already.
  9. Re: CSS Textbox Edit ANY VERSION Google has everything.
  10. Re: Help With A Error * Topic Moved * This is such a simple syntax error to correct, if you don't have the logic to do something - don't do it. } // NOTE You will need to add the gang feature above, it isn't a typing function" function user_dropdown($connection,$ddname='user',$selected=-1) { global $db;
  11. Re: Counting (nr game) 1956
  12. Re: CSS Textbox Edit ANY VERSION W3Scools, http://www.w3schools.com/css/css_border.asp Specifying the amounts in pixels is the better way of doing it, eg. 2px.
  13. Re: Query error Via phpMyAdmin, delete the previous column, since it's useless. ALTER TABLE `users` DELETE `pro_name`;   Do you perhaps have another table in the database that handles this data?
  14. Re: Query error Your missing a column in your table, run the query below via phpMyAdmin as a partial fix. ALTER TABLE `users` ADD `pro_name` TEXT NOT NULL;   You really need to learn and find out where and why this is happening.
  15. Re: Does Anybody like this Game or whatever you want to call it It's a god game, already popular here, everyone likes it. A know a few people who has already pre-ordered it.
  16. Re: Basic/Moderate PHP I'd hate to argue with you, but some of the contents posted above is invalid. Method one, addslashes() is almost the same as magic_quotes, magic_quotes is just automatically executed with super global variables. Since PHP6 this has been removed, for the obvious reason that not everyone wants obfuscated strings by default. With method two, the SEO, that is technically speaking incorrect, faking static pages will give you a better PageRank. This does require mod_rewrite on an apache system, unless you want to use something else. Method three, the $_GET variable needs an parameter and value to return true in your if statement. <?php // sample page: [url]http://www.example.com/page.php?sub_page[/url] if (empty($_GET['sub_page')) { // since sub_page doesn't have any value... echo 'Invalid'; // it fails } // whereas // sample page: [url]http://www.example.com/page.php?sub_page=value[/url] if (!empty($_GET['sub_page'])) { // since the array key holds a value... echo 'You have successfully requested vlaue'; // this is reached } ?>   To make this work correctly and as expected, you need to utilize the QUERY_STRING key located within the $_SEVER array. <?php // sample page: [url]http://www.example.com/page.php?sub_page[/url] if (!empty($_SERVER['QUERY_STRING'])) { echo 'This is the correct way.'; } ?>
  17. Re: Count Backwards :D Oh, it is :) 4899
  18. Re: Count Backwards :D 4901
  19. Re: Counting (nr game) 1949
  20. Re: Counting in 5 backwards 8955
  21. Re: Count Backwards :D 4906
  22. Re: Slight Issue Opera seems to use a very different way of networking than most browsers, and it has these little "mishaps". The session is getting deleted on page load, but this shouldn't happen, it's a bug in your program, not the Opera browser. Mind posting the contents of that script here?
  23. Re: Counting (nr game) 1945
  24. Re: Basic Ajax is easy Opera Mini has full support for Ajax, the application is supported on almost all phones with GPRS capabilities. http://www.operamini.com/features/ http://ajaxian.com/archives/how-js-ajax ... era-mini-4
  25. It might not be asked allot, but I thought I'd share some knowledge on this topic. Scaling images is simple right? just use CSS to quickly make it a square or rectangle, or whatever shape you want it to be. Well, it is correct in some ways, but it scales the image as a square most of the times, by the way the developer has chosen, but the image is mostly distorted. A developer should take into account that images are not all square, and they never will be, so they need to find a way to scale an image, without distorting the image to much by turning images into squares. With basic mathematical knowledge, and a few of PHP's functions and libraries, one can scale the image to hold it's shape just on a smaller scale, making quality-loss allot less, and keeping the shape. Original Image: link So with normal styling, it would look like this; [img=image.png] Scaled Image: link To adjust the image, so that it is displayed exactly on scale to the original/big image, we need to do some calculations. The equation for this should be simple, right? Original Height and Width: 409x1000 What we want: 150x150 height is 150 / 1000 that equals 0.15 width is 150 / 409 that equals 0.37 One problem with that, it would give us an image that is very small and totally off scale. We need to use one of the equations, and then multiply it by the original height or width, thus, an if statement will do.   <?php $image_url = ''; // replace this with the image you want to be scaled echo '[img=' . $image_url . '] $config[0] || $height > $config[1]) { // if the width or hieght is greater than the specified ones $xr = $config[0] / $width; // specified width divided by the original width $yr = $config[1] / $height; // specified height divided by the original height if ($xr * $height < $config[1]) { // if the height is less than the width $rheight = ceil($xr * $height); // calculate the height, as it will be less than the width $rwidth = $config[0]; // the width doesnt need any further calculation } else { // if the width is less than the height $rwidth = ceil($yr * $width); // calculate the width, as it will be less than the height $rheight = $config[1]; // the height doesnt need any further calculation } echo ' style="width:' . $rwidth . 'px;' . 'height:' . $rheight . 'px"'; // we echo the correct values to scale it } echo ' />'; // close the img tag ?>   That will render the image as follows: link You can try my online demonstration here: http://www.spudinski.com/dev/image_resize.php Ask here if you have any questions. References: http://blackdennie.deviantart.com/art/EMO-boy-39066280 http://php.net/getimagesize http://php.net/ceil
×
×
  • Create New...