-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameUpdate.asp
225 lines (203 loc) · 8.48 KB
/
gameUpdate.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!-- #include file="Assets/inc/conn.asp" -->
<!-- #include file="Assets/inc/system.asp" -->
<!-- #include file="Assets/inc/userControl.asp" -->
<%if user("Yetki")<>1 then response.Redirect("default.asp")%>
<%
Function Temizleyici(TMZ)
TMZ = replace(TMZ, ",", "'")
Temizleyici = TMZ
End Function
if isnumeric(Temizleyici(request.QueryString("gameID")))=false then
response.redirect "start.asp"
response.End
end if
if request.QueryString("gameID")<>"" and isnumeric(request.QueryString("gameID")) then
gameID = request.QueryString("gameID")
else
%>
<script language="javascript" type="text/javascript">
alert("Hatalı giriş. Lütfen bilgilerin doğruluğundan emin olun.");
location.href="start.asp";
</script>
<%
end if
set games = server.createobject("adodb.recordset")
sql="Select * From de_Game WHERE gameID=" & gameID
games.open sql,conn,1,3
if games.eof then
response.redirect "start.asp"
response.End()
end if
if request.ServerVariables("REQUEST_METHOD")="POST" then
Set Upload = Server.CreateObject("Persits.Upload")
Count = upload.save
dim uploadsDirVar
uploadsDirVar = server.MapPath("Game_swf_img") & "/"
if Upload.Form("gameName")<>"" and Upload.Form("puan")<>"" then
iname=""
iname1=""
if count <> 0 then
Randomize
Rast1 = int(RND*10)+0
Rast2 = int(RND*100)+0
Rast3 = int(RND*1000)+0
Rast4 = int(RND*10000)+0
Rast5 = int(RND*100000)+0
Rast6 = int(RND*1000000)+0
RAST = Rast1 & "_" & Rast2 & "_" & Rast3 & "_" & Rast4 & "_" & Rast5 & "_" & Rast6
if Not Upload.Files("upload") Is Nothing then
set f = upload.files("upload")
IF f.ext<>".jpg" and f.ext<>".png" and f.ext<>".gif" and f.ext<>".jpeg" and f.ext<>".JPG" then
%>
<script language="javascript" type="text/javascript">
alert("Istenmeyen dosya turu hatasi.\nDosya yukleme basarisiz.");
location.href="gameUpdate.asp?gameID=<%=gameID%>";
</script>
<%
ELSE
f.saveas uploadsDirVar & "DegerlerEgitimi_" & RAST & f.ext
iname = "DegerlerEgitimi_" & RAST & f.ext
END IF
end if
if Not Upload.Files("upload1") Is Nothing then
set f1 = upload.files("upload1")
IF f1.ext<>".swf" then
%>
<script language="javascript" type="text/javascript">
alert("Istenmeyen dosya turu hatasi.\nDosya yukleme basarisiz.");
location.href="gameUpdate.asp?gameID=<%=gameID%>";
</script>
<%
response.End()
ELSE
set f = server.CreateObject("Scripting.FileSystemObject")
f.deletefile Server.MapPath("Game_swf_img/"&games("gameFile"))
f1.saveas uploadsDirVar & "DegerlerEgitimi_" & RAST & f1.ext
iname1 = "DegerlerEgitimi_" & RAST & f1.ext
END IF
end if
end if
games("gameName")=Upload.Form("gameName")
games("puan")=Upload.Form("puan")
if iname<>"" then
games("gamePhoto")=iname
end if
if iname1<>"" then
games("gameFile")=iname1
end if
games.Update
%>
<script type="text/javascript">
alert("Basariyla guncellendi.");
location.href="games.asp";
</script>
<%
else
%>
<script type="text/javascript">
alert("Lutfen oyun adi ve puan alanlarini doldurun.");
location.href="gameUpdate.asp?gameID=<%=gameID%>";
</script>
<%
end if
end if
%>
<%
if request("Delete") <> "" then
if games("gamePhoto") <> "" then
set f = server.CreateObject("Scripting.FileSystemObject")
f.deletefile Server.MapPath("Game_swf_img/"&games("gamePhoto"))
games("gamePhoto") = ""
games.update
end if
response.Redirect "?gameID="&request.QueryString("gameID")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Değerler Eğitimi - Oyunlar</title>
<link href="Assets/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
function onlyNum(obj){
var kelime = obj.value;
obj.value = kelime.replace(/[(<>"'*\-+!\\"^\/_$çÇğĞıİöÖ şŞü.Ü{}\[\]¼#²¹¬<>|~%&'()=?,&A-z]/g,'') //Sayı kontrol
}
</script>
</head>
<body>
<div id="main">
<!-- #include file="Assets/inc/sidebar.asp" -->
<div id="panel">
<!-- #include file="Assets/inc/userbar.asp" -->
<div id="maincontent">
<!-- //ContentBox1 -->
<div class="contentpanel">
<div class="contenttitle">
<table width="698" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="349" align="left" valign="middle">Oyun Düzenle</td>
<td width="349" align="right" valign="middle"><a href="games.asp" class="backlink">Oyunlar</a></td>
</tr>
</table>
</div>
<div class="contentbox">
<form action="" method="POST" enctype="multipart/form-data">
<table width="696" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#DFF4FF">
<td width="200" height="30" align="right" valign="middle"><span style="font-size:14px;">Oyun Adı:</span></td>
<td width="493" height="30" align="left" valign="middle"><input type="text" name="gameName" class="formtext" value="<%=games("gameName")%>" /></td>
</tr>
<tr bgcolor="#CAEDFF">
<td height="30" align="right" valign="middle"><span style="font-size:14px;">Puan:</span></td>
<td height="30" align="left" valign="middle"><input type="text" name="puan" class="formtext" value="<%=games("Puan")%>" onKeyUp="onlyNum(this);" /></td>
</tr>
<tr bgcolor="#DFF4FF">
<td width="200" height="30" align="right" valign="middle"><span style="font-size:14px;">Oyun Resmi:</span></td>
<td width="493" height="30" align="left" valign="middle">
<%if games("gamePhoto")<>"" then%>
<br />
<img src="Game_swf_img/<%=games("gamePhoto")%>" width="110" height="110" border="0" />
<a href="?gameID=<%=gameID%>&Delete=ok" class="deletelink">Sil</a>
<br /><br />
<%else%>
<input type="file" name="upload" />
<span class="backlink">.jpg</span>
<span class="backlink">.png</span>
<span class="backlink">.gif</span>
<span class="backlink">.jpeg</span>
<%end if%>
</td>
</tr>
<tr bgcolor="#CAEDFF">
<td height="30" align="right" valign="middle"><span style="font-size:14px;">Oyun Dosyası:</span></td>
<td height="30" align="left" valign="middle"> <input type="file" name="upload1" />
<span class="backlink">.swf</span></td>
</tr>
<tr bgcolor="#DFF4FF">
<td width="200" height="250" align="right" valign="middle"><span style="font-size:14px;">Oyun Önizleme:</span></td>
<td width="493" height="250" align="left" valign="middle">
<object width="225" height="225" style="margin:5px;">
<param name="movie" value="Game_swf_img/<%=games("gameFile")%>">
<embed src="Game_swf_img/<%=games("gameFile")%>" width="225" height="225">
</embed>
</object>
</td>
</tr>
<tr>
<td height="30" align="right" valign="middle"> </td>
<td height="30" align="left" valign="middle"><input type="submit" value="Güncelle" class="formadd" /></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
<div id="clear"></div>
<!-- #include file="Assets/inc/footer.asp" -->
</div>
</body>
</html>