Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- Server.ScriptTimeOut = 25000
- Response.Charset="windows-1254"
- Const AppCharset = "ISO-8859-9"
- Const AppWinCharset = "Windows-1254"
- Const AppLanguage = "tr"
- Const AppName = "Foxxly MySQL Backup"
- Const AppTitle = "Foxxly MySQL Backup"
- strGun = Day(Date())
- strAy = Month(Date())
- strYil = Year(Date())
- strSaat = Hour(Now())
- strDakika = Minute(Now())
- strBackupFolder = "C:\Inetpub\vhosts\3gpindir.com\httpdocs\bekap\"
- strBackupFileName = mysqlvt & "_" & strGun & "." & strAy & "." & strYil & "_" & strSaat & "." & strDakika & "-yideh.fox"
- set bekapsize=sur.execute("select * from site where id='1'")
- koigbg=bekapsize("sonyedek")
- Dim fs,f
- Set fs=Server.CreateObject("Scripting.FileSystemObject")
- Set f=fs.GetFile("C:\Inetpub\vhosts\3gpindir.com\httpdocs\bekap\"&koigbg&"")
- kalanzaman=cint((f.Size / 1048576)*9 + 15)
- set f=nothing
- set fs=nothing
- %>
- <div id="content">
- <table class="tborder" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
- <tbody><tr>
- <td class="trow1" width="77%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tbody><tr valign="bottom">
- <td width="100%">
- <div class="navigation">
- <a href="/default.asp" title="3GP Forum Cepte film izleyin" alt="3GP Forum Cepte film izleyin">3gpindir.com Forum</a> Türkiye'nin En Büyük 3GP Film Sitesi
- </div>
- </td>
- </tr>
- </tbody></table>
- </div>
- </td>
- <!--#include file="menu.asp"-->
- </tr>
- </tbody></table>
- <br>
- <table width="100%" align="center" border="0">
- <tbody><tr>
- <td valign="top" width="180">
- <table class="tborder" border="0" cellpadding="6" cellspacing="1">
- <tbody><tr>
- <td class="thead"><strong>Menu</strong></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_category.asp">Kategoriler</a></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_thebot.asp">Robot ayarlari</a></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_system.asp">Sistem</a></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_mailsend.asp">Toplu Mail</a></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_backup.asp">DB Backup</a></td>
- </tr>
- <tr>
- <td class="trow1 smalltext"><a href="/admin_statics.asp">İstatistikler</a></td>
- </tr>
- <tr>
- <td class="tcat">
- <div><span class="smalltext"><strong>Uye Islemleri</strong></span></div>
- </td>
- </tr>
- <tr><td class="trow1 smalltext"><a href="/admin_users.asp?islem=ara">Uye Ara</a></td></tr>
- <tr><td class="trow1 smalltext"><a href="/uyeler.asp">Uye Listesi</a></td></tr>
- <tr><td class="trow1 smalltext"><a href="/admin_banned.asp">Cezali Uyeler</a></td></tr>
- <tr>
- </tr><tr>
- <td class="tcat">
- <div><span class="smalltext"><strong>Forum</strong></span></div>
- </td>
- </tr>
- <tr><td class="trow1 smalltext">
- <div><a href="/admin_forums.asp?getir=konu">Konular</a></div>
- </td></tr>
- <tr><td class="trow1 smalltext">
- <div><a href="/admin_forums.asp?getir=cevap">Cevaplar</a></div>
- </td></tr>
- </tbody>
- </table>
- </td>
- <td valign="top">
- <table class="tborder" border="0" cellpadding="6" cellspacing="1">
- <tbody><tr>
- <td class="thead" colspan="2"><strong>BackUP</strong></td>
- </tr>
- <tr>
- <td class="trow1" width="100%">
- <% If Request.QueryString("Action")="" then %>
- <form method="post" action="<%=Request.ServerVariables("script_name")%>?Action=DoBackup">
- <input type="hidden" name="strServer" value="<%=mysqlhost%>">
- <input type="hidden" name="strDatabase" value="<%=mysqlvt%>">
- <input type="hidden" name="strDBUser" value="<%=mysqlkadi%>">
- <input type="hidden" name="strDBPass" value="<%=mysqlsifre%>">
- <input type="hidden" name="strBackupFolder" value="<%=strBackupFolder%>">
- <input type="hidden" name="strBackupFileName" value="<%=strBackupFileName%>">
- <input type="submit" value="[ RUN BACKUP SYSTEM ]" onclick="Ac('bekleyin');">
- <br><br>
- İşlem Süresi : <%=kalanzaman%> saniye
- </form>
- <%
- elseif Request.QueryString("Action") = "DoBackup" Then
- Set edit=sur.Execute("update site Set durum=1,sonyedek='"&strBackupFileName&"',kalansure='"&kalanzaman&"' WHERE id ='1'")
- response.write("Islem boyunca gececek sure : "&kalansure&"<br>Son Yedek Adi : "&koigbg&"<br>Site Erisimi : Kapali<br><br>")
- strServer = Request.Form("strServer")
- strDatabase = Request.Form("strDatabase")
- strDBUser = Request.Form("strDBUser")
- strDBPass = Request.Form("strDBPass")
- strBackupFolder = Request.Form("strBackupFolder")
- strBackupFileName = Request.Form("strBackupFileName")
- Call BackupDatabase
- elseif Request.QueryString("Action") = "Download" Then
- Call DownloadFile(ConvertSlash(Request("FilePath")))
- end if
- Function BackupDatabase
- Set FSO = CreateObject("Scripting.FileSystemObject")
- Set nnFile = FSO.CreateTextFile(strBackupFolder & strBackupFileName)
- nnFile.WriteLine("/*")
- nnFile.WriteLine(AppName)
- nnFile.WriteLine("Source Host : " & strServer)
- nnFile.WriteLine("Source Database : " & strDatabase)
- nnFile.WriteLine("Date : " & Now())
- nnFile.WriteLine("*/")
- nnFile.WriteBlankLines(1)
- set Conn = server.CreateObject("ADODB.connection")
- Conn.Open "DRIVER={MySQL ODBC 3.51 Driver};server="& strServer &";uid="& strDBUser &";pwd="& strDBPass &";database="& strDatabase &";option=3;"
- Set DBTables = Conn.OpenSchema(20)
- Do While Not DBTables.Eof
- If DBTables("table_type")="TABLE" Then
- Set rs = Server.CreateObject("ADODB.RecordSet")
- rs.Open "SELECT * FROM "& DBTables("table_name") &" ", Conn, 1, 3
- 'Set rs = Conn.Execute("SELECT * FROM "& DBTables("table_name") &" ")
- '===========
- nnFile.WriteLine("drop table if exists "& DBTables("table_name") &";")
- nnFile.WriteLine("CREATE TABLE `"& DBTables("table_name") &"` (")
- TotalField = 0
- For Each Field in Rs.Fields
- If Field.Properties("ISAUTOINCREMENT") = True then
- PK_Name = Field.Name
- nnFile.WriteLine(Chr(9) & "`"& Field.Name &"` "& MySQLTypeDescription(Field.Type,Field.DefinedSize) &" NOT NULL auto_increment,")
- Else
- If CInt(Field.Type) = 204 Or CInt(Field.Type) = 205 Then
- nnFile.WriteLine(Chr(9) & "`"& Field.Name &"` "& MySQLTypeDescription(Field.Type,Field.DefinedSize) &",")
- Else
- nnFile.WriteLine(Chr(9) & "`"& Field.Name &"` "& MySQLTypeDescription(Field.Type,Field.DefinedSize) &" default NULL,")
- End If
- End If
- TotalField = TotalField + 1
- Next
- nnFile.WriteLine(Chr(9) & "PRIMARY KEY (`"& PK_Name &"`)")
- nnFile.WriteLine(Chr(9) & ") ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;")
- nnFile.WriteBlankLines(1)
- '============
- Do While Not rs.Eof
- nnFile.Write("INSERT INTO `"& DBTables("table_name") &"` VALUES (")
- ThisField = 0
- For Each Field in Rs.Fields
- If IsNumeric(Field.Value) Then
- nnFile.Write(Field.Value)
- ElseIf Field.Value <> "" Then
- nnFile.Write("'" & FormatData(Field.Value) & "'")
- Else
- nnFile.Write("NULL")
- End If
- ThisField = ThisField + 1
- If ThisField < TotalField Then nnFile.Write(",")
- Next
- nnFile.Write(");")
- nnFile.Write(vbNewLine)
- rs.MoveNext
- Loop
- nnFile.WriteBlankLines(1)
- rs.Close
- Set Rs = Nothing
- End If
- DBTables.MoveNext : Loop
- DBTables.Close : Set DBTables = Nothing
- nnFile.Close
- Set FSO = Nothing
- Set edit=sur.Execute("update site Set durum=0 WHERE id ='1'")
- Response.Write "<input type=""button"" value=""[ DOWNLOAD BACKUP FILE ]"" onclick=""location.href='?Action=Download&FilePath="& ConvertSlash(strBackupFolder & strBackupFileName) &"'"">"
- End Function
- '######################################
- Function FormatData(data)
- If data <> "" Then
- data = Replace(data,Chr(39),Chr(180))
- End If
- FormatData = data
- End Function
- Function MySQLTypeDescription(x,y)
- Select Case X
- Case 2 Y = "smallint"
- Case 3 Y = "int(11)" 'int yada mediumint yada integer
- Case 4 Y = "float"
- Case 5 Y = "double" 'double yada real
- Case 16 Y = "tinyint"
- Case 18 Y = "year"
- Case 20 Y = "bigint(20)"
- Case 129 Y = "enum" 'enum yada set
- Case 131 Y = "decimal(10,0)" 'decimal yada numeric
- Case 133 Y = "date"
- Case 134 Y = "time"
- Case 135 Y = "datetime" 'datetime yada timestamp
- Case 200 Y = "varchar("& y &") collate utf8_turkish_ci" 'varchar yada char yada tinytext
- Case 201 Y = "longtext collate utf8_turkish_ci" 'text yada mediumtext yada longtext => Accessteki NOT'un karşılığı aralarındaki farkı boyutları belirliyor
- Case 204 Y = "tinyblob"
- Case 205 Y = "longblob" 'blob yada mediumblob yada longblob => aralarındaki farkı sadece boyutları belirliyor.
- End Select
- MySQLTypeDescription = Y
- End Function
- Function DownloadFile(FilePath)
- Response.Clear
- Set FSO = CreateObject("Scripting.FileSystemObject")
- Set objFile = FSO.GetFile(FilePath)
- intFilelength = objFile.Size
- Set objStream = Server.CreateObject("ADODB.Stream")
- objStream.Open
- objStream.Type = 1
- objStream.LoadFromFile(FilePath)
- Response.AddHeader "Content-Disposition" , "attachment; filename=" & objFile.Name
- Response.AddHeader "Content-Length" , intFilelength
- Response.CharSet = "UTF-8"
- Response.ContentType = "application/octet-stream"
- Response.BinaryWrite objStream.Read
- Response.Flush
- Response.End
- objFile.Close : Set objFile = Nothing
- objStream.Close : Set objStream = Nothing
- Set FSO = Nothing
- End Function
- Function ConvertSlash(strURL)
- ConvertSlash = Replace(strURL,"\","/")
- End Function
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement