creating SQL string 'on-the-fly' for backups purposes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mr_burns

    #1

    creating SQL string 'on-the-fly' for backups purposes

    hi,

    i have recently used a system (oscommerce store) where you can backup
    your database. what happens is that when you click 'backup database',
    it creates an SQL string, stores it in a text file and lets you
    download it to your hard drive.

    is there a simple means of creating this SQL file? if not, are there
    any free scripts available that can be used on any database/table and
    create a SQL string to be stored in a text file?

    also, how do you (once the SQL file has been created) then prompt the
    user to save the file onto their computer? cheers

    burnsy
  • Anders K. Madsen

    #2
    Re: creating SQL string 'on-the-fly' for backups purposes

    On 20 Jul 2004 06:45:20 -0700
    bissatch@yahoo. co.uk (mr_burns) wrote:
    [color=blue]
    > hi,
    >
    > i have recently used a system (oscommerce store) where you can backup
    > your database. what happens is that when you click 'backup database',
    > it creates an SQL string, stores it in a text file and lets you
    > download it to your hard drive.
    >
    > is there a simple means of creating this SQL file? if not, are there
    > any free scripts available that can be used on any database/table and
    > create a SQL string to be stored in a text file?
    >
    > also, how do you (once the SQL file has been created) then prompt the
    > user to save the file onto their computer? cheers[/color]

    Simple.
    If you're on a *nix system, you can use the shell-command "mysqldump"
    for dumping the content and forcing a download of the file is just a
    simple http-header.

    Example: Dump database "test" and offer download.
    <?php
    // username and password for the database
    $db_user = "someuser";
    $db_pass = "somepass";
    $db = "test";

    // Filename to suggest to the user.
    $filename = "db_backup.sql" ;

    // shell command
    $cmd = "mysqldump -u $db_user -p $db_pass $db";

    // send headers, forcing download:
    header("Content-type: text/html");
    header("Content-Disposition: attachment; filename=\"$fil ename\"");

    // Run $cmd and pass the output directly to the browser.
    passthru($cmd);
    ?>

    Now you can just modify this to suit your needs (set the vars
    dynamically perhaps) and point users to that for backing up their db.
    If you're not on a *nix box I'm not sure how it's done, sorry. :(

    Madsen

    --
    Anders K. Madsen --- http://lillesvin.linux.dk

    "There are 10 types of people in the world.
    Those who understand binary - and those who don't."

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFA/SfdlNHJe/JASHcRAnIKAJ93b EAUl1INTgl+QQsm z5OSKUfw3QCaA0t y
    qyxf+1yhgSLX1iM FNkuCcfI=
    =2x3b
    -----END PGP SIGNATURE-----

    Comment

    • Michael Fesser

      #3
      Re: creating SQL string 'on-the-fly' for backups purposes

      .oO(Anders K. Madsen)
      [color=blue]
      >If you're on a *nix system, you can use the shell-command "mysqldump"
      >for dumping the content and forcing a download of the file is just a
      >simple http-header.[/color]

      mysqldump is part of the MySQL distribution, it should also be available
      on Windows systems.

      Micha

      Comment

      • Anders K. Madsen

        #4
        Re: creating SQL string 'on-the-fly' for backups purposes

        On Tue, 20 Jul 2004 16:25:41 +0200
        Michael Fesser <netizen@gmx.ne t> wrote:
        [color=blue]
        > .oO(Anders K. Madsen)
        >[color=green]
        > >If you're on a *nix system, you can use the shell-command "mysqldump"
        > >for dumping the content and forcing a download of the file is just a
        > >simple http-header.[/color]
        >
        > mysqldump is part of the MySQL distribution, it should also be
        > available on Windows systems.[/color]

        Great! :)
        Nice to know. Thanks!

        Madsen


        --
        Anders K. Madsen --- http://lillesvin.linux.dk

        "There are 10 types of people in the world.
        Those who understand binary - and those who don't."

        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.2.4 (GNU/Linux)

        iD8DBQFA/UbclNHJe/JASHcRAnkBAJ4t9 5hYu9dOAXKEgpUt MZVaMQp1jwCff0G D
        O1G2+Kq4h4B9vwP GWyPfRW4=
        =zCIy
        -----END PGP SIGNATURE-----

        Comment

        • Default User

          #5
          Re: creating SQL string 'on-the-fly' for backups purposes

          "Anders K. Madsen" wrote:
          [color=blue]
          > ------------------------------------------------------------------------
          > Part 1.2Type: application/pgp-signature[/color]


          What's with the attachments?



          Brian Rodenborn

          Comment

          • Anders K. Madsen

            #6
            Re: creating SQL string 'on-the-fly' for backups purposes

            On Tue, 20 Jul 2004 17:48:46 GMT
            Default User <first.last@boe ing.com.invalid > wrote:
            [color=blue]
            > "Anders K. Madsen" wrote:
            >[color=green]
            > > -----------------------------------------------------------------
            > > -------
            > > Part 1.2Type: application/pgp-signature[/color]
            >[/color]

            It's simply a PGP signature identifying me as ... well... me...
            http://gnupg.org or http://fuckinggoogleit.com :-p

            Madsen

            --
            Anders K. Madsen --- http://lillesvin.linux.dk

            "There are 10 types of people in the world.
            Those who understand binary - and those who don't."

            -----BEGIN PGP SIGNATURE-----
            Version: GnuPG v1.2.4 (GNU/Linux)

            iD8DBQFA/XCwlNHJe/JASHcRArI6AJ9oO Rd4aYIY7gcBl3O5 d7Ka8P/SqgCfZL4w
            ZeUXuRehHHV/VX+zG5dk0+c=
            =6E6D
            -----END PGP SIGNATURE-----

            Comment

            • Tim Van Wassenhove

              #7
              Re: creating SQL string 'on-the-fly' for backups purposes

              In article <20040720212118 .5d381c31@lapsv in>, Anders K. Madsen wrote:[color=blue][color=green]
              >> "Anders K. Madsen" wrote:
              >>[color=darkred]
              >> > -----------------------------------------------------------------
              >> > -------
              >> > Part 1.2Type: application/pgp-signature[/color]
              >>[/color]
              >
              > It's simply a PGP signature identifying me as ... well... me...
              > http://gnupg.org or http://fuckinggoogleit.com :-p[/color]

              And what exactly is the added value of knowing that a posting is yours
              in this group? And how can we validate that the public key really
              belongs to the person you pretend to be?





              --
              Tim Van Wassenhove <http://home.mysth.be/~timvw>

              Comment

              • Anders K. Madsen

                #8
                OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' for backupspurposes )

                On 20 Jul 2004 19:30:49 GMT
                Tim Van Wassenhove <euki@pi.be> wrote:
                [color=blue]
                > In article <20040720212118 .5d381c31@lapsv in>, Anders K. Madsen wrote:[color=green][color=darkred]
                > >> "Anders K. Madsen" wrote:
                > >>
                > >> >[/color]
                > >-----------------------------------------------------------------> >
                > > -------[color=darkred]
                > >> > Part 1.2Type: application/pgp-signature
                > >>[/color]
                > >
                > > It's simply a PGP signature identifying me as ... well... me...
                > > http://gnupg.org or http://fuckinggoogleit.com :-p[/color]
                >
                > And what exactly is the added value of knowing that a posting is yours
                > in this group? And how can we validate that the public key really
                > belongs to the person you pretend to be?[/color]

                Well, the added value is protection from posts being modified on it's
                way (by malicious crax0rs or by malfunctioning software).

                Read: http://fortytwo.ch/gpg/intro and

                Or once again... http://fuckinggoogleit.com

                --
                Anders K. Madsen --- http://lillesvin.linux.dk

                "There are 10 types of people in the world.
                Those who understand binary - and those who don't."

                -----BEGIN PGP SIGNATURE-----
                Version: GnuPG v1.2.4 (GNU/Linux)

                iD8DBQFA/Zw0lNHJe/JASHcRAgUmAJ9Vh HoPhRDcTqgHF/524xAiyv0XPQCeN Tm1
                kUyHUUTEIqWuwXX D3hUcmiU=
                =b4OC
                -----END PGP SIGNATURE-----

                Comment

                • Tim Van Wassenhove

                  #9
                  Re: OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' for backups purposes)

                  In article <20040721002656 .0e5bb987@lapsv in>, Anders K. Madsen wrote:[color=blue]
                  > Tim Van Wassenhove <euki@pi.be> wrote:[color=green]
                  >>
                  >> And what exactly is the added value of knowing that a posting is yours
                  >> in this group? And how can we validate that the public key really
                  >> belongs to the person you pretend to be?[/color]
                  >
                  > Well, the added value is protection from posts being modified on it's
                  > way (by malicious crax0rs or by malfunctioning software).[/color]
                  [color=blue]
                  > Read: http://fortytwo.ch/gpg/intro and
                  > http://www.rubin.ch/pgp/weboftrust[/color]

                  My question remains: How can we be sure the public key really belongs to
                  you? Even if this newsgroup would have a keysigning party, how would
                  newcomers be able to verify it? And no, hear-say solutions (public key
                  servers) are not a solution.

                  --
                  Tim Van Wassenhove <http://home.mysth.be/~timvw>

                  Comment

                  • Anders K. Madsen

                    #10
                    Re: OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' forbackups purposes)

                    On 21 Jul 2004 07:26:00 GMT
                    Tim Van Wassenhove <euki@pi.be> wrote:
                    [color=blue]
                    > In article <20040721002656 .0e5bb987@lapsv in>, Anders K. Madsen wrote:[color=green]
                    > > Tim Van Wassenhove <euki@pi.be> wrote:[color=darkred]
                    > >>
                    > >> And what exactly is the added value of knowing that a posting is[/color]
                    > >yours> in this group? And how can we validate that the public key
                    > >really> belongs to the person you pretend to be?
                    > >
                    > > Well, the added value is protection from posts being modified on
                    > > it's way (by malicious crax0rs or by malfunctioning software).[/color]
                    >[color=green]
                    > > Read: http://fortytwo.ch/gpg/intro and
                    > > http://www.rubin.ch/pgp/weboftrust[/color]
                    >
                    > My question remains: How can we be sure the public key really belongs
                    > to you? Even if this newsgroup would have a keysigning party, how
                    > would newcomers be able to verify it? And no, hear-say solutions
                    > (public key servers) are not a solution.
                    >[/color]

                    My answer remains: http://www.rubin.ch/pgp/weboftrust
                    How can I be sure you are who you claim to be?
                    Right, I can't... 'cause anybody can put whatever name they desire in
                    the From header.
                    At least signing ones mail allows for some trust.

                    If you don't believe I am who I am, then fine... Don't sign my key...
                    Wait till more people have signed it and see if you'll believe it
                    then... That IS the way it works, no matter what you want it to be.

                    --
                    Anders K. Madsen --- http://lillesvin.linux.dk

                    "There are 10 types of people in the world.
                    Those who understand binary - and those who don't."


                    -----BEGIN PGP SIGNATURE-----
                    Version: GnuPG v1.2.4 (GNU/Linux)

                    iD8DBQFA/u1JlNHJe/JASHcRAkoMAJ4mF ANyKA/C1/7x55WRkSEcJQ/4twCdGi5l
                    2zu+8mK6CvDh5Cn 3xS1RPBY=
                    =Lwmj
                    -----END PGP SIGNATURE-----

                    Comment

                    • Gordon Burditt

                      #11
                      Re: OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' forbackups purposes)

                      >> My question remains: How can we be sure the public key really belongs[color=blue][color=green]
                      >> to you?[/color][/color]

                      In this situation, an identity *IS* a key.

                      Assuming that the key is not compromised (or shared), all the posts
                      signed by the same key are from the same person, with high probability.
                      Posts signed by a different key MIGHT be from different people, or
                      possibly the same person. (A person can have more than one key,
                      especially if he soils his reputation badly using that key, or likes
                      to use sock puppets).

                      Human names on USENET posts are essentially useless if you've
                      got something better. And there's not much point in bothering
                      to worry about someone's human name unless you need to tie
                      it to a credit rating or bank account.

                      Gordon L. Burditt

                      Comment

                      • Tim Van Wassenhove

                        #12
                        Re: OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' for backups purposes)

                        In article <cdn9r5$cc3@lib rary1.airnews.n et>, Gordon Burditt wrote:[color=blue]
                        > In this situation, an identity *IS* a key.[/color]
                        [color=blue]
                        > Human names on USENET posts are essentially useless if you've
                        > got something better. And there's not much point in bothering
                        > to worry about someone's human name unless you need to tie
                        > it to a credit rating or bank account.[/color]

                        I agree that for this newsgroup (which is not about credit rating/bank
                        accounts) one should not bother much about identity/name. And that is
                        exactly why i don't see the use of signing usenet posts.


                        --
                        Tim Van Wassenhove <http://home.mysth.be/~timvw>

                        Comment

                        • Anders K. Madsen

                          #13
                          Re: OT: GnuPG (Was: Re: creating SQL string 'on-the-fly' forbackups purposes)

                          On 22 Jul 2004 08:51:13 GMT
                          Tim Van Wassenhove <euki@pi.be> wrote:
                          [color=blue]
                          > In article <cdn9r5$cc3@lib rary1.airnews.n et>, Gordon Burditt wrote:[color=green]
                          > > In this situation, an identity *IS* a key.[/color]
                          >[color=green]
                          > > Human names on USENET posts are essentially useless if you've
                          > > got something better. And there's not much point in bothering
                          > > to worry about someone's human name unless you need to tie
                          > > it to a credit rating or bank account.[/color]
                          >
                          > I agree that for this newsgroup (which is not about credit rating/bank
                          > accounts) one should not bother much about identity/name. And that is
                          > exactly why i don't see the use of signing usenet posts.
                          >[/color]

                          Well, ok...
                          I'll keep signing them though, since I like people to know that I am in
                          fact me. If you don't believe it or find it useless, ok - your
                          problem. It's not like you're forced to sign my signature. And
                          besides... My mailer is configured to sign by default, which I kinda
                          happen to like...

                          Madsen

                          --
                          Anders K. Madsen --- http://lillesvin.linux.dk

                          "There are 10 types of people in the world.
                          Those who understand binary - and those who don't."

                          -----BEGIN PGP SIGNATURE-----
                          Version: GnuPG v1.2.4 (GNU/Linux)

                          iD8DBQFA/4OAlNHJe/JASHcRAmTOAJ9ls asILBVqIsxWMapN PlQJjj/6DwCfdrsL
                          R75ebxHaHSD1Jom sBnveRPQ=
                          =5qUY
                          -----END PGP SIGNATURE-----

                          Comment

                          Working...