Jump to content

toxicious

Members
  • Posts

    55
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://
  • ICQ
    0

toxicious's Achievements

Newbie

Newbie (1/7)

3

Reputation

  1. My website recently got suspended because it was causing high load on my shared hosts servers, and this is not the first time.Though they were kind and unsuspended it and told me to fix it. I am not sure what is causing the load so it would be awesome with some advice or a point in the right direction (maybe how I can test what script is the thief). A little about the website: It's built using PHP only, along with a MySQL DB. It relies heavily on the DB, a lot of queries are made to list stuff.There's basically only one file that is called directly by the user, index.php. That file then includes the right other files depending on the URL the user typed and so on (URL Rewriting is happening).So yeah, a lot of includes are made. The thing is, it didn't have a lot of visitors on it when it got suspended. I can't tell exactly how many were on the site at the moment they suspended it, but I can tell there were only 500 unique visitors that day (normally ~400) and a total of 800 visits. Not that much. I would love to improve the performance of my site, but as I said I have no idea where to start!Is there any program that could run through my site, checking which scripts causing high load so I then could analyze those files in particular?I have a local dev server I could do some testing on at least.
  2. You have an error in your css file. It is a good practice writing good-looking easy-readable files too: .photos {float:left;height:90px;width:110px;margin:30px;} h2 {color:green;text-weight:bold;font-family:times;} .sec {clear:both;margin-bottom:2px;} iframe {position:relative;padding:0px;top:10px;left:120px;border:5px groove orange;} h1 {position:relative;top:10px;left:220px;color:green;} .center {margin:auto;width:70%;background-color:#b0e0e6;} Your forgot the ending clam ( } ) on the h1 tag styles.
  3. I have written some rules in my .htaccess file but they don't work as I want them to. I have these: RewriteRule ^news/page/([0-9]+)/?$ news?page=$1 [NC,QSA]RewriteRule ^([0-9a-z-_]+)/?$ index.php?p=$1 [NC,QSA] Here are some scenarios: Url - Should go to - works? /news - /index.php?p=news - yes/news/page/2/ - /news?page=2 => /index.php?p=news&page=2 - no I have similar rules, with the exact same regex on my IIS server and there it works.If I change the first rule to be like this: RewriteRule ^news/page/([0-9]+)/?$ index.php?p=news&page=$1 [NC,QSA] It works. Which means that it succeeds in matching the first url, but the one that is created out of the first match isn't matched anymore...I don't have any logging possiblities since it is shared hosting.
  4. Do you want to find all of the invalid characters (and store them for example) or do you just want to validate if the string only contains numbers (returns true/false)? If you only want to validate, this regex would be fine:^[\d,]+$ It will also say that a string like this: "589,5523,523" is valid. If this is not what you are looking for, could you explain a little more
  5. I'm getting crazy about this. I've been trying for days and hours with different plugins to make AJAX navigation work like I want, or more like the plugins say that it should work. I'm gonna start to explain what I want: URLs without hash for browsers supporting history.pushState (example.com/news)Only fetch the part of the page that needs changing (for example I have a folder where I put files which contains content that can be fetched and inserted into a layout)If a user lands at example.com/news he should still see the whole layout including the content, not just the content of that "file" (which is just news...) Now please, can anyone tell me if this is possible?I stumbled upon this site: http://hypem.com/ Which seems to have acomplished that. If you inspect the site with Firebug you find this:When you click a link this happens: A short-version url is set in the browser with pushState (example.com/popular)An AJAX request is made to a longer version of that URL (example.com/popular?params=hereāˆ§=so&on)That response to that request is only the content of the page, not a "whole page".The new content is showed with JS. The most interesting thing here is probably the fetching part. How can the url popular show a complete page when you land at it, when they also can request it and only receive some content? It feels like all my spare time is going away into just getting this to work
  6. The settings will only be changed by me, so hardcoding them into a separate file is the easiest I think. Since I will use "include .../settings.php" or something like that I hardly doubt that it will affect the performance
  7. Hmm okay. Thanks a lot for a fast answer! I think having some variables in a file is enough for me then
  8. My website needs to do a lot of mysql connections to fetch and insert stuff into a db. In my last "version" of this website I have one file called dblogin.php in which I connect to the db. Then I just do an "include "dblogin.php" (kinda) and then I go on with the stuff. Is there any recommended way of doing this? I mean you want the address, username etc. in one file so you don't have to change it in multiple files if something changes.
  9. Thx a lot for the two examples! Interesting ways of doing it. Will go with example 1 since it was really simple
  10. This is the HTML: <div id="cellwrapper"><div id="leftcell"> </div><div id="midcell">Lots of content here</div><div id="rightcell"> </div></div> All of the columns should have a dynamic height. The midcell will contain different amounts of text, and the two side-columns should be the same height. With other words: I want the side columns (left & right) to be 100% height of their parent div (cellwrapper) without setting its height (cellwrappers height). Before I've used a table, but I've been told not to use it for designs so I want something with divs.Here is the CSS I have so far: #cellwrapper {background: yellow;display: table;}#leftcell {display: table-cell;width: 35px;float: left;background-image: url('img/col.gif');background-repeat: repeat-y;}#rightcell {display: table-cell;width: 35px;float: left;background-image: url('img/col.gif');background-repeat: repeat-y;}#midcell {display: table-cell;width: 470px;float: left;background: white;} As you can see, I've tried with the display: table thingy, but I didn't get it to work. The side columns are still only one image high (the col.gif is only 20px high). The display: table way seems like the easiest. Could someone please point out what is wrong?
  11. Yeah that would be a good idea. Did a quick calculation, for each tracked player there will be 24 hourly rows and 30 daily rows (aprox.). Which equals ~54 rows/player. If I split like you said it will pretty much be half of the data in each table.Also read a bit here: http://forums.mysql.com/read.php?24,240757,240757#msg-240757 He has 100 million rows plus and asks about performance. I beleive as long as I don't use wrong types for the columns, I can at least be safe until I reach 1 million rows or something like that. Though 1 million rows would equal about 40,000 tracked players, which I NEVER will reach anyway. Let's say it spreads and I get 100 players, that will only be tiny 2,500 rows/table (aprox.) So yeah, it probably won't matter. Anyway, it would be great if more people could give some input on what the pro's and con's are with JamesB's design VS my design (maybe it's just ineffective having lots of tables)
  12. @birbal, nicheI already know how to create a db and stuff, my problem is that I am not sure how to structure my new db (which I haven't created yet). @JamesBThat do sound like a solid design, how do you think the performance is with that one? Will it be slower because everything is stored in one table?
  13. I want to design a DB that should store stats for a game.A program will fetch stats from another website and put in the db every hour. It will also move/purge old stats into the correct place. The point is for the players to be able to see their stats the last hour, the last 5 hours, the last x hours etc. Also the last 3 days and so on.The DB will store hourly stats for the last 24 hours, and daily stats for the last 30 days. The design I came up with was this (beware, I'm no pro at designing DBs): Single DB, hourly_00 hourly_01 hourly_02 ... hourly_23 daily_01 daily_02 ... daily_30 players And when it comes to the design of the tables each table would contain a row with the players stats at that time (specified by the table name) and a player_id.The players table would contain ids and their playername. atm I do not track that many stats, just 3-4 integers. Also, it is worth noting that I won't go public with my little site. Only me, my friends and maybe if they tell their friends. Meaning that I won't buy a fancy domain name that attracts visitors, I won't advertise the site etc. I hardly think it would ever go over 20-100 players being tracked depending on how much work I put into it. If any SQL pro want to give me a tip or show me a completely different structure which is much more awesome, pleease do so
  14. Thanks for the script! I have studied it and now I understand things better :)Gonna play a little with it first, then I'll migrate my db using a script.
×
×
  • Create New...