Jump to content

Doctor_Cox

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Doctor_Cox's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. From the looks off this will save a file to the server, which is not really what we want. I want a download backup option. This performs backups the same way I do - but selecting all the lines then building insert queries with them. Works OK on small tables, but not when you are trying to download a series of tables containing no less than 249204 lines total, you need something a bit more efficient. Thanks for the effort though, will keep looking.
  2. Gentlemen, The problem of how to generate a MySQL backup quickly via PHP quickly and efficiently has been stumping me for a while. I know the mysqldump trick, but for some reason under cPanel it generates needlessly bloated SQL I cannot even feed into phpMyAdmin. I have examined phpMyAdmin's code, but cannot figure out the exact part which enables it to export SQL so quickly. So I have been left with no choice to write code that generates insert statements one at a time. Very inefficient, and now my boss is getting maximum execution timeouts on one particularly large database. Any insight that you might be able to offer would be much appreciated.
  3. Thanks Wildbug, this is a good piece of code with logic I can follow. The problem with mod_rewrite is that if I make a change to a module that requires a filename change, I have to go and change every .htaccess in our many sites. And the problem with a central .conf is not only do I not have access to it, but not every site is configured exactly the same way. Some of the them do not use index.html as a "container file" for the system's content, and indeed some use more than one container file. This why I want PHP code level control of the whole thing, rather than manual stuffing around which has cost me many hours as it is. I agree a pure PHP solution would be faster, but MySQL would let me access and edit things easily. I suppose it makes no never mind really, it is not like I will be changing things every day, and the having to have to different patterns does not thrill. We have a pretty powerful server that doesn't even break a sweat with our current load. Performance is not that big of an issue. When I refer to a module I refer to a specific set of code - Shopping Cart, Photo Gallery, Links Manager, whatever - not an individual page. So for example, the Links Manager uses 2 rules - one for the main entry page, one for the page that lists the links in the visitor's selected category. There are no "rules within rules" pages. Thanks again for your help.
  4. Wildbug - I am an experienced PHP programmer but a complete noob when it comes to Regex, bare with me OK? My content management system is well established, and has grown in capabilities and sophistication as I have learned new things. Because it is so well established, I need to keep the internally linked filenames the same, as I do not have time to go back and apply this new technique to every site. It will only apply to new sites. The new sites will have an .htaccess like this... RewriteEngine On RewriteRule ^(.*) filehandler.php?%{QUERY_STRING} filehandler.php will then figure out what to do with the request by checking the $_SERVER['REQUEST_URI'] variable. .shtml files, for example, are prepared by my page editor module, so it would include the file that gets and renders those pages. Some preliminary tests using string hacking (substr, strpos et al) have proven the soundness of the basic theory. However, given my system contains about 2 dozen different modules, some with up to half a dozen rewrite rules, I do not want to have to write manual hacking code for each one. So I figured if I put the original expressions in the rewrite rules into a database, I could perform some kind of lookup. Obvious the expressions can be changed if need be. I suppose MySQL regex and PCRE are both needed. Let's see if I can concoct a brief, simplified example code sequence of how I think it might/should work. Say we have a database line with two fields. Expression and Destination Filename. Imagine the following example row. Expression - "^links(.*)-(.*).html" Destination - "index.html?page=links_manager/listings&Category_ID=#1&Start=#2" Now the following code. I'll spell out where I do not what should happen, what functions to use etc. with caps and comments. <?php $Requested_File = "links1-1.html"; // this would ordinarily be derived from $_SERVER['REQUEST_URI'], simplifying here $result = mysql_query("select * from rewrite_rules where Expression = REGEX COMPARISON TO $Requested_File HERE"); if ($row = mysql_fetch_array($result) { // code to get variables from $Requested_File by applying $row['Expression'] here // preg_split probably the way to go $Variable_Counter = 1; $File_to_Include = $row['Destination']; foreach($Preg_Split_Returned_Values as $Value) { $File_to_Include = str_replace("#{$Variable_Counter}", $Value, $File_to_Include); $Variable_Counter++; } // now do something with $File_to_Include to present content } else echo "File not found"; ?> My initial experiments with preg_split did not work. Looking at the documentation it does not look like the reg exs in the rewrite rules are directly compatible with the function. So they can of course be changed. I hope this makes it clearer.
  5. The values need to be available to PHP to decide what to do, what files to include. The means by which it gets them are of no consequence.
  6. Gentlemen, I need to create what essentially amounts to an interpretor of Apache Rewrite Rules in PHP. I use Rewrite Rules extensively in my content management system, but they become to unwieldy, and now I am working on something which basically routes all calls through a file handing script. This will take the requested filename, then figure out what needs to be included to present the requested file. So I need it to be able take a request filename of say, links1-1.html Then using the original rewrite rule pattern of ^links(.*)-(.*).html Conclude I need index.html?page=links_manager/listings&Category_ID=1&Start=1 In other words, does the requested file meet any of the patterns (which I will store in a database with the "destination") then if so, isolate the variables for inserting into the destination for the final, actual URL. Hope this makes sense, thanks.
  7. Greetings all, I'm trying to create a mysql backup script. The dump has been generated, but now I want to be able to save it to a file to FTP it to another server away from my company's primary one. But because we are running in safe mode, file creation is severly restricted. Reviewing things, the only solution I could come to was to create a folder, assign it to the nobody user, and then use that for writing the files to before FTP'ing them. Will doing so be a possible security risk?
×
×
  • 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.