Yokmu yardımcı olacak birileri arkadaşlar
İstediğim Açılan pencerede elimde olan session değerlerini önceki sayfaya aktarıp popup penceresini kapatmak ön sayfada otomatik refresh yapacak.
<% Option Explicit %><!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=iso-8859-9" />
<title>Facebook Giriş</title>
</head><script language="javascript" runat="server" src="fb/json2.asp"></script>
<!--#include file="fb/fb_app.asp"-->
<body><%
main
Function BlogDateFunc(varDate)
dim dd
dim mm
dim hh
dim mi
dim se
If day(varDate) < 10 then
dd = "0" & day(varDate)
Else
dd = day(varDate)
End If
If month(varDate) < 10 then
mm = "0" & month(varDate)
Else
mm = month(varDate)
End If
If hour(varDate) < 10 then
hh = "0" & hour(varDate)
Else
hh = hour(varDate)
End If
If minute(varDate) < 10 then
mi = "0" & minute(varDate)
Else
mi = minute(varDate)
End If
If second(varDate) < 10 then
se = "0" & second(varDate)
Else
se = second(varDate)
End If
BlogDateFunc = ""& year(varDate) &"-"& mm &"-"& dd &" "& hh &":"& mi &":"& se &""
End Function
function main
dim app_id
dim app_secret
dim my_url
dim dialog_url
dim token_url
dim resp
dim token
dim expires
dim graph_url
dim json_str
dim user
dim code
dim strLocation
dim strEducation
dim strEmail
dim strFirstName
dim strLastName
dim strID
dim strLink
dim DatabaseServer
dim Port
dim DatabaseName
dim DatabaseUser
dim DatabasePass
dim conn
dim FBKontrol
dim IDKontrol
token = cookie("token")
if token = "" then
response.write "Facebook login error"
exit function
end if
graph_url = "https://graph.facebook.com/me?access_token=" & token
json_str = get_page_contents( graph_url )
set user = JSON.parse( json_str )
'' These properties should always be there provided
'' we ask the right questions user.id & user.name
strFirstName = user.first_name
strLastName = user.last_name
strID = user.id
strLink = user.link
'' Handling properties that might not be there
on error resume next
strLocation = user.location.name
strEducation = user.education.get(0).school.name
strEMail = user.email
strEmail = replace( strEmail, "\u0040", "@")
on error goto 0
'Response.Write "<!--"
'response.write "Facebook ID: " & strID & "<br/>"
'response.write "Ad: " & strFirstName & "<br/>"
'response.write "Soyad: " & strLastName & "<br/>"
'response.write "Avatar: http://graph.facebook.com/"& strID &"/picture<br/>"
'response.write "Education: " & strEducation & "<br/>"
'response.write "E-Posta: " & strEMail & "<br/>"
'response.write "Link: " & strLink & "<br/>"
'response.write "Token: " & token & "<br/>"
'response.write "<p/>"
'response.write "JSON String: <br/>"
'Response.Write "-->"
'response.write json_str
DatabaseServer = "xxx.xxx.xx.xx"
DatabaseName = "xx"
DatabaseUser = "xxxxxxxxx"
DatabasePass = "xxxxxxx"
Port = "1455"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open = "DRIVER={MySQL ODBC 3.51 Driver};database="& DatabaseName &";server="& DatabaseServer &";Port="& Port &";uid="& DatabaseUser &";password="& DatabasePass &";Pooling=false; stmt=SET NAMES 'Latin5'; option=16387"
Set FBKontrol = Conn.Execute("SELECT ID,FBID FROM tbl_uyelik WHERE FBID = '"& strID &"'")
If FBKontrol.Eof Then
Conn.Execute("INSERT INTO tbl_uyelik(FUSER,FBID,AD,SOYAD,EMAIL,SIFRE,FBPROFIL,AVATAR,FBTOKEN,SONGIRIS,UYEKAYIT,KAYITIP) VALUES(1,"& strID &",'"& strFirstName &"','"& strLastName &"','"& strEMail &"','**nopass**','"& strLink &"','http://graph.facebook.com/"& strID &"/picture','"& token &"','"& BlogDateFunc(Now()) &"','"& BlogDateFunc(Now()) &"','"& Request.ServerVariables("REMOTE_ADDR") &"')")
Set IDKontrol = Conn.Execute("SELECT MAX(ID) FROM tbl_uyelik")
Session("adsoyad") = strFirstName &" "& strLastName
Session("UserID") = IDKontrol(0)
Session("email") = strEMail
Session("Login") = True
Session("Avatar") = "http://graph.facebook.com/"& strID &"/picture"
Session("FaceToken")= token
Session("FBID") = strID
Else
Conn.Execute("UPDATE tbl_uyelik SET SONGIRIS = '"& BlogDateFunc(Now()) &"', FBTOKEN = '"& token &"', SONGIRISIP = '"& Request.ServerVariables("REMOTE_ADDR") &"' WHERE ID = "& FBKontrol("ID") &"")
Session("adsoyad") = strFirstName &" "& strLastName
Session("UserID") = FBKontrol("ID")
Session("email") = strEMail
Session("Login") = True
Session("Avatar") = "http://graph.facebook.com/"& strID &"/picture"
Session("FaceToken")= token
Session("FBID") = ""& FBKontrol("FBID")
End If
Response.Write "<br /><br /><center>Basariyla giris yaptiniz.<br /><a href=""javascript:void(0)"" onclick=""reloadParentAndClose();""><strong>Otomatik olarak kapanmadiysa buraya tiklayiniz.</strong></a></center>"
Response.Write "<script type=""text/javascript"" language=""javascript1.2"">function reloadParentAndClose(){window.opener.location.href=window.opener.location.href; self.close();} reloadParentAndClose();</script>"
Response.Write "<center>Eger tarayiciniz yinede bu pencereyi kapatmiyorsa, kendiniz bu pencereyi kapatip, cilgin dukkan´da gezinmeye devam edebilirsiniz. Uyeliginiz ile giris yapmis bulunmaktasiniz.</center>"
end function
%>
</body>
</html>