%@language="VBScript"%>
<% Response.Expires = 0 %>
<%
'kontrola formuláře
chyba = ""
if trim(request("email")) = "" then
chyba = chyba & "
Zadejte email"
end if
'kontrola správnosti e-mailové adresy
if instr(request("email"),"@") = 0 or instr(request("email"),".") = 0 then
chyba = chyba & "
Zadaný e-mail má chybný formát"
end if
if chyba = "" then
zakaznik = false
Set rs = CreateObject("ADODB.RecordSet")
strSQL = "SELECT novinky FROM zakaznik WHERE email LIKE '" & sqlinjection2(trim(request("email"))) & "' AND id_shop = 0"
rs.Open strSQL, conn, 2, 3
if not rs.eof then
zakaznik = true
rs("novinky") = false
rs.update
elseif zakaznik = false then
chyba = chyba & "
Zadaný e-mail není v naší databázi"
end if
rs.close
Set rs = CreateObject("ADODB.RecordSet")
strSQL = "SELECT email FROM novinky_email WHERE email LIKE '" & sqlinjection2(trim(request("email"))) & "'"
rs.Open strSQL, conn, 2, 3
if not rs.eof then
rs.delete
rs.update
end if
rs.close
end if
if not chyba = "" then
chyba = right(chyba,len(chyba)-4)
Response.clear
response.redirect "odhlaseni-novinek.asp?" & request.form & "&chyba_dotaz=" & chyba
end if
conn.close
Response.clear
response.redirect session("cesta_web") & "odhlaseni-novinek.asp?odhlaseno=1"
%>