-
-
Save karimkhanp/74b81267c4ae870dd432 to your computer and use it in GitHub Desktop.
login.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ThenWat</title> | |
<link href="css/button.css" rel="stylesheet" type="text/css"> | |
<link href="css/rateit.css" rel="stylesheet" type="text/css"> | |
<script src="//connect.facebook.net/en_US/all.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<style> | |
.header{ | |
background-color:#0B6121; | |
border:2px solid #0B6121; | |
padding:10px 40px; | |
border-radius:5px; | |
} | |
.middle{ | |
background-color:Yellow; | |
} | |
.left{ | |
background-color:Green; | |
} | |
.url{ | |
box-sizing: border-box; | |
display: block; | |
} | |
.url:hover { | |
box-shadow: 2px 2px 5px rgba(0,0,0,.2); | |
} | |
html, body { margin: 0; padding: 0; border: 0 } | |
</style> | |
</head> | |
<body> | |
<div class="header" style=""> | |
<table style=""> | |
<tr> | |
<td><img src= "3.png" height="50" width="310"/></td> | |
</tr> | |
</table> | |
</div> | |
<table border="0" width="100%"> | |
<tr> | |
<div class="left"> | |
<td> | |
<input type="button" id="loginButton" class="button" onclick="authUser();" value="Login | ThanWat" style="display:none; left:500px; position:relative"/> | |
<lable id="lable1" style="display:none;" ><i> Please wait .. </i> </lable> | |
</td> | |
</div> | |
<div class="middle"> | |
<td style="width:40%"> | |
</td> | |
</div> | |
<div class="right"><td style="width:30%"></td></div> | |
</tr> | |
<tr> | |
<div class="left"> | |
<td style="width:30%"> | |
</td> | |
</div> | |
</tr> | |
</table> | |
<div id="fb-root"></div> | |
<script type="text/javascript"> | |
FB.init({ | |
appId: '178812232292862', | |
xfbml: true, | |
status: true, | |
cookie: true, | |
}); | |
FB.getLoginStatus(checkLoginStatus); | |
function authUser() | |
{ | |
FB.login(checkLoginStatus, {scope:'email'}); | |
} | |
function checkLoginStatus(response) | |
{ | |
if(response && response.status == 'connected') | |
{ | |
FB.api('/me?fields=movies,email,name', function(mydata) | |
{ | |
document.getElementById('lable1').style.display = 'block'; | |
console.log(mydata.email); | |
console.log(mydata.id); | |
myid=mydata.id; | |
var name=mydata.name; | |
//alert(name); | |
var email=mydata.email; | |
var json = JSON.stringify(mydata.movies.data); | |
var a = JSON.parse(json); | |
var picture="https://graph.facebook.com/"+myid+"/picture?type=small"; | |
// alert(picture); | |
$.post('movies_db.php',{'myd':a, name: name, email: email, myid:myid, picture:picture}, function(data) | |
{ | |
$.ajax({ | |
url:'start.php' | |
,async: true | |
,type : 'POST' | |
,cache: false | |
,data : 'myid=' + myid | |
,dataType: 'html' | |
,success: function(data) | |
{ | |
$('body').html(data); | |
FB.XFBML.parse(); | |
} | |
}); | |
}); | |
}); | |
document.getElementById('loginButton').style.display = 'none'; | |
console.log('Access Token: ' + response.authResponse.accessToken); | |
} | |
else | |
{ | |
document.getElementById('loginButton').style.display = 'block'; | |
} | |
} | |
</script> | |
<script src="js/jquery.rateit.js" type="text/javascript"></script> | |
</body> | |
<script> | |
var rate; | |
function GetSentiment(val) | |
{ | |
rate=$('#rateit99').rateit('value'); | |
var url = document.getElementById('url').value; | |
var ValUrl = is_valid_url(url); | |
if(ValUrl) | |
{ | |
var xmlhttp; | |
if (window.XMLHttpRequest) | |
{ | |
// code for IE7+, Firefox, Chrome, Opera, Safari | |
xmlhttp=new XMLHttpRequest(); | |
} | |
else | |
{ | |
// code for IE6, IE5 | |
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
xmlhttp.onreadystatechange=function() | |
{ | |
if (xmlhttp.readyState==4 && xmlhttp.status==200) | |
{ | |
document.getElementById("myDiv").innerHTML=xmlhttp.responseText; | |
} | |
} | |
xmlhttp.open("POST","data.php",true); | |
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
xmlhttp.send('url=' + url + '&rate=' + rate); | |
} | |
else | |
{ | |
//prompt error message | |
} | |
} | |
function is_valid_url(url) | |
{ | |
return url.match(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/); | |
} | |
function display() | |
{ | |
document.getElementById('GetSentiment').style.display='block'; | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment