Have you contacted your hosting provider about this? I'm sure they offer backups in some form. This is more of a hosting issue than a web development issue, so it isn't my expertise. It also has more to do with the hosting provider and what they offer than your php code.