Jump to content
MakeWebGames

Recommended Posts

Posted

Due to i posted this in a topic here and got some feedback in my inbox about it.

I have decided to make it as a topic....

First this doesn't protect anything it just insures that a quick game backup could be restored to continue your

Game for players..

 

Name the file to anything you like "ensure its name isn't easily guessed to prevent people clicking it.

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

also i have tried this on numerous free sites and some paid sites.

You need to be able to use the command passthru()

as a few sites block its usage...

Posted

Re: [mccode all] sql backup

Already been posted here: http://criminalexistence.com/ceforums/i ... pic=1655.0

Also, It's so much easier to just stick this in a daily cron:

"/usr/local/bin/mysqldump -u user --password=password database | gzip > /home/*/backup/sql-`/usr/bin/date +\%Y\%m\%d`.sql.gz"

Just change the username, password, database name and location of backup folder on server. And kaboom its done, it's that easy!

The passthru() function is just executing the unix command and passing it back to the browser, all that really isn't needed...

http://uk2.php.net/passthru

Posted

Re: [mccode all] sql backup

 

Already been posted here: http://criminalexistence.com/ceforums/i ... pic=1655.0

Also, It's so much easier to just stick this in a daily cron:

"/usr/local/bin/mysqldump -u user --password=password database | gzip > /home/*/backup/sql-`/usr/bin/date +\%Y\%m\%d`.sql.gz"

Just change the username, password, database name and location of backup folder on server. And kaboom its done, it's that easy!

The passthru() function is just executing the unix command and passing it back to the browser, all that really isn't needed...

http://uk2.php.net/passthru

you got a point, but all that is also needed as he sends the gzipped dump to email :)

Posted

Re: [mccode all] sql backup

well all i know is that this is working doing its job..

i know some of you proved different ways on it

But this was the first way i came across and it doesn't create lag for me

or any hassles..

so thank you for providing alternative ways about this as well...

Posted

Re: [mccode all] sql backup

 

i have this running on my server and it's works fine using passthru

exec() & passthru() are almost the same, just passthru() shows raw output.

Both functions should be used with caution. This is why some host's may disable them, as when used incorrectly they can become very harmful.

The function escapeshellcmd() is recommended when using exec/passthru/system.

http://uk2.php.net/manual/en/function.e ... ellcmd.php

Posted

Re: [mccode all] sql backup

The escapeshellcmd() function is only necessary if the "user" is inputing a raw command. If the editor of the script or such is differntly using this. Then that should be his own fault if he screw's up the server.

Posted

Re: [mccode all] sql backup

 

The escapeshellcmd() function is only necessary if the "user" is inputing a raw command. If the editor of the script or such is differntly using this. Then that should be his own fault if he screw's up the server.

Lol true, kind of like the mres func when interacting with db. But most people prefer over-the-top-security to efficiency. I think its a very rare case that a user would need to interact with the passthru/exec/system func's. :?

Posted

Re: [mccode all] sql backup

 

Very rare to even interact with the passthru/exec/system func?

A visitor to your site should never be able to run such a command.

Yes I know, but they must have to in some cases, otherwise why would PHP even bother creating the escapeshellcmd() function.

Posted

Re: [mccode all] sql backup

Warning: file(backup-2009-02-09.sql.gz) [function.file]: failed to open stream: No such file or directory in C:\localhost\www\bla.php on line 16

Warning: implode() [function.implode]: Invalid arguments passed in C:\localhost\www\bla.php on line 16

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\localhost\www\bla.php on line 32

Warning: unlink(backup2009-02-09.sql.gz) [function.unlink]: No such file or directory in C:\localhost\www\bla.php on line 33

Posted

Re: [mccode all] sql backup

 

Warning: file(backup-2009-02-09.sql.gz) [function.file]: failed to open stream: No such file or directory in C:\localhost\www\bla.php on line 16

Warning: implode() [function.implode]: Invalid arguments passed in C:\localhost\www\bla.php on line 16

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\localhost\www\bla.php on line 32

Warning: unlink(backup2009-02-09.sql.gz) [function.unlink]: No such file or directory in C:\localhost\www\bla.php on line 33

I don't think this would run on wamp. lol

or a similar xamp or so..

  • 2 weeks later...
Posted

Re: [mccode all] sql backup

Warning: passthru() has been disabled for security reasons in /home/dothost.eu/vhosts/backup.php on line 14

Warning: file() [function.file]: Unable to access backup-2009-02-22.sql.gz in /home/dothost.eu/vhosts/backup.php on line 20

Warning: file(backup-2009-02-22.sql.gz) [function.file]: failed to open stream: No such file or directory in /home/dothost.eu/vhosts/backup.php on line 20

Warning: implode() [function.implode]: Invalid arguments passed in /home/dothost.eu/vhosts/backup.php on line 20

Warning: unlink(backup-2009-02-22.sql.gz) [function.unlink]: No such file or directory in /home/dothost.eu/vhosts/backup.php on line 41

Posted

Re: [mccode all] sql backup

I just done some more testing on a few hosting sites.

You may want to ask your hosting provider to let you have exec or passthru

Some hosting sites allow one or the other.,...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...