Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. If you get to 100 million users , you could pay people to figure it all out and be across multiple servers. create indexes in mysql save and cache the output gd images cache queries, pages I believe it would be slow using a single database no matter how you did it if had many users. I was planning to do my users areas designed something like this, main site with registration and login mysql to keep track of users, id, user page, avatar, join date, tagged/keyword interests new registrations creates a new folder with username in username folder...premade sqlite databases for each user... posts, friends, comments, images have a selection of different community themes for them but no editing allowed Might as well tell you about cassandra. http://cassandra.apache.org/ Cassandra is in use at Digg, Facebook, Twitter, Reddit, Rackspace, Cloudkick, Cisco, SimpleGeo, Ooyala, OpenX, and more companies that have large, active data sets. The largest production cluster has over 100 TB of data in over 150 machines.
  2. This forum is a good place. But actually from the source itself would be the best place to read. http://dev.mysql.com/doc/refman/5.6/en/index.html
  3. have a single table just for images in database save all images to same folder on upload insert image_name/location and also user_id into mysql and use auto_increment for id I mention the use of id because if they marked an image as public..you could make an images gallery of all the users, or per user. You are most likely going to have a users table to store items like username,email,password,join_date and so on. Since there is no need to find all their images everywhere they go on the site...while still retaining their user info and avatar, you could also just add something like an avatar_photo to the users table, and insert the location where the avatar is stored. That location could also be an external web address if desired. If they never select an avatar have a default image to be used. I personally created a thumbnailer for the images to use as avatars with GD each of the values can be manipulated on the fly to see different results here's an example http://get.blogdns.com/dynaindex/thumb-create.php?size=100&rotate=0&text=Quickie&textsize=6&textcolor=aqua&crop=1.1&bordermargin=0&borderwidth=2&bordercolor=silver&imgsource=http://get.blogdns.com/dynaindex/images/1297191972-09l.jpg and this is the original uploaded image http://get.blogdns.com/dynaindex/images/1297191972-09l.jpg
  4. About the images per user. It's best to have a central folder or can also do username folders to store all the images. When the image is uploaded, add a timestamp to the image name (to make every image unique even if named the same), save that image name/location to a database along with their user id. There are also more advantages for storing them in a database. You can add custom titles, description, uploaded date, ratings, public or private and so on. here's an example of my insert query mysql_query("INSERT INTO user_image (user_id, rank, public_view, title, description, upload_date, type, size, file_location) VALUES ('$user_id', '$rank', '$public_view', '$escaped_title', '$escaped_description', '$my_date', '$file_type', '$file_size', '$final_file_location')"); Basically if the user was to have only one image, i can see you just using a user table and add their image. But if the user is to have more than one image or a gallery, make an exclusive images table.
  5. Using auto_increment gives each a truly unique value, unless you are using unique values as a primary key you could easily have duplicates or issues when trying to fetch/update/delete the values. The one big problem with auto_increment is when merging, but that could also be solved by exporting and importing the sql instead. But could have duplicate data with a different id key. A simple script deleting any duplicate data could remedy that. Then can even reset the auto_increment id's removing empty ones. These 3 items are very common and basic things to do. 1.count rows http://dev.mysql.com/doc/refman/5.6/en/counting-rows.html 2.display the data for each for in a while loop http://dev.mysql.com/doc/refman/5.6/en/select.html http://dev.mysql.com/doc/refman/5.6/en/while-statement.html 3.update the data (like on row 4, column 'icecream') http://dev.mysql.com/doc/refman/5.6/en/update.html I recommend people use auto_increment unless have a special purpose to not use it. Why not simply just alter the table and make it auto_increment? alter table table_name add id int(11) primary key auto_increment not null; http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
  6. try this <?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) header('Location: http://www.site.com/mobile.php');//change this to your actual mobile location //this code must be before anything is output to the browser ?> You can also do it in apache by placing this in your htaccess file RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-) [NC] RewriteRule ^$ http://www.site.com/mobile.php [R,L] change the last line to where you want it redirected
  7. Pagination is never simple, here's a tutorial here. http://www.phpfreaks.com/tutorial/basic-pagination
  8. If this helps you at all, I also add this before my mysql query to insure it gets saved as utf8. mysql_query("SET NAMES 'utf8'");
  9. From my experience..... you have to find what encoding the site you are connecting to uses, and then encode that to utf8 and save as utf8. Is a few options. http://php.net/manual/en/function.mb-detect-encoding.php http://php.net/manual/ja/function.mb-convert-encoding.php http://php.net/manual/en/book.iconv.php Languages and encoding is one of the worst things the internet and server applications have not nailed out completely. php6 was supposed to solve all this..but this has been in the shadows for a while now. For any odd characters or your own special rules, you can make a function and do string replaces. Browse the net, many have made similar functions already.
  10. Your variable is in html, so you must echo the php like so. <td><input name="<?php echo $mem_or_ven;?>" type="submit" name="Submit" value="Register" /></td>
  11. My best response would be to learn how to write functions. http://php.net/manual/en/language.functions.php Functions can be made in a few ways, but usually you need to either echo or return the result. function db_select($db){ if($db == 1) { $myselect = mysql_select_db("$db_name")or die("cannot select DB"); } elseif($db == 2) { $myselect = mysql_select_db("$db_name2")or die("cannot select DB"); } else { $myselect = "There was a problem selecting a database"; } return $myselect; } The above is just a fast example.
  12. You may also want to look into this video script. It's a free opensource. http://www.phpmotion.com/ Your server must meet all the requirements.
  13. For your first site, you did very well. I think if anyone has anything to say about it would be opinions, the site is pretty clean and functional. Now just add lots of content and good to go.
  14. Seems it should work Maq. Adding supercache plugin is a good thing. http://wordpress.org/extend/plugins/wp-super-cache/
  15. I do have another idea. Lets say your cron runs...you are getting the faxes, for every fax you send you also place the fax number into a text file. Every time you are to send a new fax only perform your send fax and move file if the fax is not in the fax text file list. Delete the fax list text file before next cron run.
  16. I realized it was a longer process, but also a needed process. Even if you did locking of the files, I would think you still need to find which files to lock. Which would be any matching fax numbers files.
  17. I'm pretty sure I have your system down. Only thing I could think of is comparing all the fax numbers to one another, unset any that match, and do not do the move yet on any matching ones....let the cron get it the next cycle.
  18. <?php include 'connect.php'; $query = "SELECT Balance FROM Users WHERE ID = '$userid'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ //use your values echo $row['ID'] . "<br />"; echo $row['Balance'] . "<br />"; } ?>
  19. That's hilarious......and true.
  20. I made that just to show how $_GET works really. But you would query your database for any results would want, grab the id from each post and make a hyperlink linking to a view page, on the view page would use $_GET['id']; , then from there query mysql for just that one id and all the results in a while loop. Depending on how much time I have today, I may make a simple php starter site along with pagination.
  21. There is more than one type of indexing, and also multiple indexing. Pretty much any WHERE,AND,OR helps greatly, you can even improve on that doing specific groups of keys. http://dev.mysql.com/doc/refman/5.6/en/mysql-indexes.html Using explain can help you determine what you need. explain select * from table where a=1 or b=1; http://dev.mysql.com/doc/refman/5.6/en/using-explain.html
  22. Your query is failing. did you edit it? mysql username and password your database name in the SELECT the proper table and if has an id I just tried it again and it works
  23. I guess it could be limits involving memory for those large images. as for the wordwrap: use this: $warpText = wordwrap($bodyText, 85, "<br />", true);
  24. Just made a post answering the same question. http://www.phpfreaks.com/forums/index.php?topic=335866.msg1582283#msg1582283
  25. Although you may have adequate memory, it's never a good thing to run out of memory. You can try upping the query cache, also the key cache. http://dev.mysql.com/doc/refman/5.6/en/query-cache.html http://dev.mysql.com/doc/refman/5.6/en/myisam-key-cache.html Make indexes in mysql on any WHERE,AND,OR statements in queries. http://dev.mysql.com/doc/refman/5.6/en/create-index.html Page caching will eliminate many calls to the database and display pages faster. can look into this: http://memcached.org/ or see here: http://php.net/manual/en/book.memcache.php
×
×
  • 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.