Jump to content

drifter

Members
  • Posts

    189
  • Joined

  • Last visited

    Never

Posts posted by drifter

  1. I have all of my rules working good except this one...

     

    RewriteRule ^([^?]+)/?([^/]+)/([^/]+)$ $1?$2=$3 [L]

     

     

    My goal is to get

     

    app.php?t/5 => app.php?t=5

    app.php?mode/test => app.php?mode=test

     

    this works fine and does it, but it also messes up things that do not have a ? like

     

    includes/style.css

     

    So is there a way to get it to only work when the is a ? - do i need a conditional for this? If I take this line out, the css files will work so I know it is this line messing it up.

     

    Thanks for any help.

    Scott

  2. I am thinking for username - not related to mysql.

     

    like if you look at myspace your page might be at myspace.com/corelevel

     

    obviously there is words that they do not want people using such as profanities. They also do not want people using names that will indicate that they have authority over the site like myspace.com/administrator

     

    So I was looking for a list of common words like this - I am sure there has to be one, I know I can write one, but I would probably miss a lot of words.

  3. Is there a way with PHP or the web server to limit the FTP speed?

     

    I am using ftp download functions and I download several hundred MB of data a day and when it is in a download, I get extremely high IO wait, and them my server load skyrockets and everything bogs down.

     

    I do have these scripts running with a proc_nice(10), This only seems to make it play nice on the processing parts and still overloads on the FTP parts of the scripts.

     

    Thanks

    Scott

  4. I have an open source app that I run that does a lot of data processing. The problem is that I need to run this thing a total of 8 times with different variables.

     

    I was just going to write a program and say include(); whenever I needed it.

     

    THe problem is looking at it, it uses lots of defined constants... since these are global scope and can not be changed, I will not be able to run it a second time and change the variables.

     

    So is there any way to isolate this extra script in a class or something that will limit the scope of the define.

     

    I could put eight cron jobs in, but I would rather them run sequentially since I have no idea how long they will take to run at any given time.

     

    Is there a way I can right a shell or something that will run one php script and when that is done run the next?

     

    Thanks

    Scott

  5. OK  have someone spamming my site through a form.

    I do not have any header injection going on, so this is only annoying inhouse...

    I am not sure what they are doing. I was trying to track IPs, but this morning they submitted 7 spam requests in 20 seconds from 7 different IPs - So I am guessing that they did not just write a simple program to just send requests from a single IP

    All the hidden inputs and stuff were in place so I can not use something like that to flag them as spam.

    I would really not like to go captcha, so I was just wondering if I could find out how they are spamming me, maybe I can flag some as spam.
  6. is there a way to delete a line from a file without rewriting it?

    I have a 300K file with about 20000 lines - each line takes about 1.5 seconds to process. (images and such)

    the problem is, this runs for hours - then it fails and It starts over.

    I would like to remove a line on sucess so that the next time it runs it does not rerun the same lines.

    rewriting the file that large, that many times seems like it would be really hard on the server.

    Thanks
    Scott
  7. I know how to make a color selector in javascript  - I am looking to make one where people can upload an image and I use an input type image to get an X,Y and then I want to get the color of that point.

    I did find imagecolorat() just now.

    My other question that I can not find an awnser to is if I can take an image and return the top 3 most used colors in the image???
  8. I want to create a color selector from an image. Basically I want people upload a logo. I want to put something that I can select colors off of that.

    I know I can use HTML custom cursors to make an eye dropper. I know I can use the input type image to get x and y coords. but how is there a way using GD or something to get the color of an spot of an image and return the RGB?

    Also, does anyone know where a script like this might be so I can avoid reinventing the wheel if possible?

    Thanks
    Scott
  9. First of all, this is not a php question.

    look at your headers. if you use things like spam assassin, there are points assigned to your email to determine spam.

    you get points for things like sending too much html, not enough html, not enough text, from a .biz email address,etc - there are thousands of criteria that can be found on Spam Assassins website - write your emails to get less points.
  10. if you say you know some php and have not even started a table or any code, you will probably not get too much help. These are all mostly php professionals that get paid for writing peoples code for them - You may want to post in the freelance board
  11. is there a way to show all variables that are set at a given time? I have a lot of memory usage, and I just want to see what variables are used and that I can unset... some them my be buried in 3rd part classes or included conditionally, so just looking at the script may not tell me everything.

    Thanks
    Scott
  12. big break through - I added an extra where for the first table. According to explain, that lowered the number of possible matches from 80,000 to about 5,000 - this cut the time down to .3 seconds, but not the first table has a range and using filesort - This I can work on more.

    My bigger concern is what happens when my DB grows and I am back at 80,000 possible matches - will I be back this slow again?
  13. Another benefit of running this through the class, to day I wrote a line in the query function to add every  call to the database to a string. Then in my disconnect function right before disconnect, I dump all the string into the DB -

    wrote like a 20 line little script to read that table and tell me how many queries and what they are for every page on my site.

    Then I can see what ones can be cached and such to cut down on extra stuff as much as possible.

    I could take this a step farther and wrap the mysql_query statement with a timer and log all the calls and see what ones are slow. Doing this in my class would be WAY easier then filling my entire site with timers.
  14. well I have been working on this all day - the query is a bit better - 1.5 seconds - Still terrible though. Using explain, all my joins are on PRIMARY except one that is a UNIQUE. - so they are all listed as eq_ref - I have no file sorts under the extra.

    In the 4th table I add when I say where id=34 - It shows in explain as "using where" at that point it is all over. I even tried adding an index to that id column with no difference.
  15. OK I have this table set up...

    franshises ->agency ->office->agent->listing

    where every listing has an id that relate to an agent. every agent related to an office.....and so on.

    now when I query listings, I join them all (indexes on all the join columns - unique where possible.) Most of my statements in my where clause are from listings - no problem. But sometimes I need to do something like t10.agency_id=4 or t7.franchise_id=3 - as soon as I do this my query bombs. With out this, queries in .001 seconds - with in 4-5 seconds. NOT GOOD.

    So i had the idea to take the 6 columns from them 4 tables that I ever use in the query and copy them to the listings table and use that for this query. so every listing has a franshise_id, agency_id, etc.

    Now to me this just sounds like bad structure, is there another way?

  16. really the reason comes down to that fact that I do not know everything there is to know about databases. I may not want to be using mysql in the future as I get more traffic. Maybe oracle or maybe something else.

    Most of what is in this function is the basic mysql functions anyway. For example my function $db->insert_id() is just

    function insert_id(){
      return mysql_insert_id();
    }

    Some are a little bit more complex, but like I have it set up so I do
    [code]
    $rows=$db->get_results($sql);
    foreach($rows AS $row){

    }
    [/code]
    and that returns and assoc array I can just loop through. All in one step rather then
    [code]
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    }
    mysql_free_result($result);
    [/code]

    Now if I deside to move to say Oracle, I only have to write the equivalent code in my functions rather then rewrite my application.

    My understanding is that is the major benefit to classes like MBD2 and BD - the problem is they are so big and there is so much stuff, they are hard to work on and are slow. (IMO)

×
×
  • 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.