PHP - Url Problem With Facebook Social Login
Hi i have a facebook login social plugin made but my ? is why do i get symbols in my url link ?.
I login with the plugin to facebook but when page returns me back to my site i have symbols at the end of url. Like this http://www.games-flash.co.uk/#_=_ Ps sry if i have made this post in wrong section. Similar TutorialsI want a php mysql script that works like a facebook social networking . A user can add,update and delete other users to their circle in 3 privacy categories (e.g. Private, Limited, Public). So that a user can define what level of detail is visible based on the privacy categories, to other users. Hello guys, Is there on web any updated tutorial on how can I add Facebook login on my simple php login script? Hi, I am planning to integrate Facebook login into my site, I found this useful guide: Code: [Select] http://www.1stwebdesigner.com/tutorials/facebook-integrate/ Has anyone tried it before, if so how difficult would you say it is to do this? My site is operated by matching id numbers with username. How would I get a username from a Facebook login? hey all
i have a facebook connect script which is working fine, and after the user logs in, it returns your facebook data (name, id etc)
attached to this post is the script - which works great if anyone is looking for a good example
Once the user has logged in, I want to run on a seperate page, a script which pulls data about a specific pages
My question is, how much of the attached code can be removed once the user has logged in, i'd asume as the user is already logged in, there is a bunch of code which deals with the login processs which could be deleted
or do i have to use the whole script when accessing anything on the graph?
This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357535.0 I need some guidance in regards to adding Login with Facebook.
Is this something which is easily done? Currently, I'm using UserCake:
http://usercake.com/
How much testing and QA is necessary for this type of work?
http://pixpresso.mycyberlove.com/ This is my test hosting for this site I'm making. Navigation and facebook login are almost done. So, the problem is that after facebook login URL is http://pixpresso.mycyberlove.com/#_=_ Why is this? Is this bad, should I and can I remove this? I am creating a simple social network, and i want the post visible only on its circle of friends but the problem is... let say user_a, user_b, user_c already registered and user_a and user_c connected/friends already and all their posts and comments are visible on their circle but when user_b write a post oh his wall, it's also visible to user_a and user_c which i dont want to happen. I dont know what was wrong on codes below. CREATE TABLE IF NOT EXISTS `user`( `uid` INT(11) AUTO_INCREMENT PRIMARY KEY NOT NULL, `uname` VARCHAR(25) NOT NULL, `pword` CHAR(60) NOT NULL, `fullname` VARCHAR(30) NOT NULL, INDEX(`uname`) ) Engine = InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; CREATE TABLE IF NOT EXISTS `friend`( `fid` INT(11) AUTO_INCREMENT PRIMARY KEY NOT NULL, `friend_id` INT(11) NOT NULL, `my_id` INT(11) NOT NULL, `stat` ENUM('0','1') NOT NULL, INDEX(`friend_id`, `my_id`), FOREIGN KEY(`friend_id`) REFERENCES `user`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE ) Engine = InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; public function viewFriendIfExistOnTbl($uid) { $query = $this->mysqli->query("SELECT `friend_id` FROM `friend` WHERE `my_id` = '$uid' LIMIT 1"); if ($query->num_rows > 0) { return true; } } I have this code curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_URL, $link); $wall = curl_exec($ch); but the $link is a facebook wall page that takes a couple of seconds to load fully. and you have to scroll down the page before more loads or you have to click older posts when i run the script the $wall doesnt have the full page. Is there a way that i can delay the $link from saving the file so that it reads more of the page?? This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=309715.0 My game on facebook is being displayed in the facebook application iframe. When users register in firefox or google chrome everything is fine and to a certain extent in IE as well. However, when logging into the game, through the browsers the game loads fine except when loaded in IE.... Basically i am using a session to state that the game is currently in facebook mode: Code: [Select] <?php session_start(); $_SESSION['isface'] = 1; include("game.php"); ?> All is good until it hits this code: Code: [Select] <html> <frameset cols="130" noresize border=0> <frame src="nav.php" name="nav"> <frame src="hq.php" name="main"> </frameset> </html> The frames then output error message: Code: [Select] <?php if ($isface !="1") { if (sha1($info[4]) != $pass) { mysql_close(); echo $isface; die("<br><br><center><body bgcolor='#000000'><b><font color='#FFFFFF' face='Verdana' size='2pt'>{$isface} Your username cannot be found or password doesnt match</font></b></center></body></html>"); } } ?> essentially the game is using cookies for authentication on the main site, but since this is facebook this is not needed so it SHOULD skip this check and proceed with using the facebook details as the login. this is only happening in IE... i dont get it. any ideas? This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347238.0 Hey there I'm trying to gather a users Facebook info and use that to create a user account for them on my database. My code works perfectly for the first person who links his Facebook account with my site and adds all the user info to the database. After that with any other users it will display the logged in Facebook users name with their profile pic. The problem arises when it tries to add this person to the mysql database. It returns the error "An error has occurred and we are unable to sync your Facebook account." Before the <head> Code: [Select] <?php define('FACEBOOK_APP_ID', 'imagine_app_id_here'); define('FACEBOOK_SECRET', 'imagine_secret_here'); function get_facebook_cookie($app_id, $application_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET); ?> In the <body> Code: [Select] <?php if ($cookie) { //###cookie is set, user is logged in $user = json_decode(file_get_contents('https://graph.facebook.com/'.$cookie['uid'])); define('INCLUDE_CHECK',true); require("connect.php"); $fbookid = $user->{'id'}; $fbookname = $user->{'name'}; $query = mysql_query("SELECT * FROM tz_members WHERE facebook_id='$fbookid'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ echo "<font color='#FF0000'>You are logged in through Facebook.</font>"; } else { mysql_query("INSERT INTO tz_members(facebook_id,usr,regIP,dt) VALUES( '".$fbookid."', '".$fbookname."', '".$_SERVER['REMOTE_ADDR']."', NOW() )"); $query = mysql_query("SELECT * FROM tz_members WHERE facebook_id='$fbookid'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ echo "<font color='#FF0000'>Your Facebook account has been synced with our user database.</font>"; } else { echo "<font color='#FF0000'>An error has occured and we are unable to sync your Facebook account.</font>"; } mysql_close(); } echo '<img src="http://graph.facebook.com/'.$user->{'id'}.'/picture" alt="'.$user->{'name'}.'"/>'; echo $user->{'name'}; echo '<fb:login-button perms="email,user_birthday" onlogin="window.location.reload(true);" autologoutlink="true"></fb:login-button>'; } else { //###user is not logged in, display the Facebook login button echo '<fb:login-button perms="email,user_birthday" autologoutlink="true"></fb:login-button>'; } ?> Javascript: Code: [Select] <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); </script> Any help would be greatly appreciated! Hi, I'm a bit of a newbie when it comes to PHP. I'm a thirs year music/music tech student and for my disseration I took a very ambitious task. I want to create a sort of social networking site for musicians. But I wanted to create it dynamically using PHP and MySQL. I want to basically allow users to register and sign up with their details basically. But the first problem I came across was actually making a custom registration page, I wanted things such as post codes (zip codes) so that I would then have a Google Maps overlay showing where users were. So that you could 'see' you local music 'scene'. So far I've been playing around with Joomla, Drupal and WordPress. I tried writing the PHP from scratch but after following various tutorials, but I had no luck what-so-ever with that approach. So I started using content management systems, which got me a lot closer, but I found I couldn't really edit custom registration pages etc. And the I would have no idea how to get the Google maps idea working. If anyone could nudge me in the right direction and give me a few tips and ideas as to how I'm most likely to achieve this then please reply, I would be highly grateful for you responses. Thanks, Ewan Valentine. I'm writing a mini social network and I'm having trouble figuring out how to deal with privacy settings. I have established a range of privacy options (level 1-4): 1. Only Facebook friends can see profile (users connect via FB) 2. Only current classmates 3. Past + current classmates 4. All users in given group I am writing a function to return a list of available users based on a given parameter (eg. Find all classmates of a user). Obviously I have to respect users privacy settings, so I thought to query against all users with level 2 permissions, however I realise that I may miss out some classmates who are FB friends but have permission levels set to 1. Secondly, I'm looking to find out the relationship between two users (a function that I can plug in 2 user IDs and return their relationship...classmates, FB friends, past classmates, no relationship) which I can then use to determine whether a user has permission to view another users profile. I don't have much code as of yet, because I spent a long time exploring one avenue which I now realise to be the wrong one! Any suggestions/help would be greatly appreciated! Hi everone i am currently building a social network website, i have it mostly finished but one thing i am trying to do is instead of my members having the profile name of www.domain.com/ members.php?username=04836flfgkfifg84 for example, i want it to be like twitter or facebook where it is like www.facebook.com/Brendan Can someone help me out on doing this? Hi, below is the error and php that i used for my login page.
Error:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 11 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 11 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 12 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 12 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 13 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\htdocs\Sportify\admin\checkauthadmin.php on line 13 Php: <?php //session_start(); $today = date(Ymd); $_SESSION[username] = $_POST['username']; $_SESSION[password] = $_POST['password']; $_SESSION[id] = $_POST['id']; $username = stripslashes($_SESSION[username]); $password = stripslashes($_SESSION[password]); $username = mysql_real_escape_string($_SESSION[username]); $password = mysql_real_escape_string($_SESSION[password]); $id = mysql_real_escape_string($_SESSION[id]); include('connection.php'); $sql_login = "SELECT id FROM admin WHERE username = '$username' and password = '$password'"; $result_login = mysql_query($sql_login); $count_login = mysql_num_rows($result_login); //$row = mysql_fetch_assoc($sql_login); if($count_login == 1) { //session_register("user_email"); //session_register("user_password"); //echo "PASS"; header("location:../admin/main_admin.php"); } else { header("location:admin_login2.php"); } exit; ?> Hello there, The problem is that my login system isn't consistent. There's an option of staying logged in, and if you check that a cookie gets created with a hash. When you visit the site again, you should be logged in automatically. But the thing is, that when you load the page, you aren't! But after a refresh you are logged in. So I'm guessing a problem in the order of things that get done... Here's the script: Code: [Select] <?php session_start(); if(isset($_COOKIE['LoginCookie'])) { $hash = $_COOKIE['LoginCookie']; mysql_select_db('database'); $sql = "SELECT all the info of the people FROM people WHERE cookie_hash = '".$hash."'"; if($result = mysql_query($sql)) { $row = mysql_fetch_array($result); if(empty($row)) { setcookie('LoginCookie','',time()-3600); } if(mysql_num_rows($result) == 1) { $_SESSION['loggedin'] = true; $_SESSION['loggedinnick'] = $row['nick']; $_SESSION['loggedinvoornaam'] = $row['voornaam']; $_SESSION['loggedinachternaam'] = $row['achternaam']; $_SESSION['loggedinid'] = $row['id']; $_SESSION['loggedintype'] = $row['type']; } } } if(isset($_POST['login'])) { if(empty($_POST['username']) || empty($_POST['wachtwoord'])) { $_SESSION['melding'] = 'ERROR'; header('Location: index.php'); exit(); } $username = CleanMyDirtyData($_POST['username']); $wachtwoord = sha1(CleanMyDirtyData($_POST['wachtwoord'])); mysql_select_db('database'); $sqlmail = mysql_query("SELECT * FROM people WHERE email='$username' AND wachtwoord = '$wachtwoord'"); $sqlnaam = mysql_query("SELECT * FROM people WHERE nick='$username' AND wachtwoord = '$wachtwoord'"); if(mysql_num_rows($sqlmail) == 1 || mysql_num_rows($sqlnaam) == 1) { if(mysql_num_rows($sqlmail) == 1) { $row = mysql_fetch_array($sqlmail); } else { $row = mysql_fetch_array($sqlnaam); } if(isset($_POST['remember'])) { $hash = sha1($username . 'Some secret thingys for your safety'); setcookie('LoginCookie',$hash,time()+30000000); mysql_query("UPDATE leden SET cookie_hash='" . $hash . "' WHERE id='" . $row['id'] . "'")or die(mysql_error()); } $_SESSION['loggedin'] = true; $_SESSION['loggedinnick'] = $row['nick']; $_SESSION['loggedinvoornaam'] = $row['voornaam']; $_SESSION['loggedinachternaam'] = $row['achternaam']; $_SESSION['loggedinid'] = $row['id']; $_SESSION['loggedintype'] = $row['type']; $_SESSION['melding'] = 'You are logged in now.'; } else { $_SESSION['melding'] = 'ERROR'; header('Location: index.php'); exit(); } } So if the checkbox that you want to stay logged in, there is no cookie made but the $_SESSION['loggedin'] is set to true. Throughout the rest of the page, this parameter is used to show either content for guests of private content for people that are logged in. BUT the problem is that if it is checked on the first page load the $_SESSION['loggedin'] doesn't seem to get set even though the cookie is set. Another slight problem with my script is that when a user logs in on another pc, the hash get's changed in the database and the user gets logged out of the site on the previous page. What is the easiest way to do that? And do you guys think this script is safe? Or do you see some holes? Thanks in advance! arbitter i want help as i cant find that the reason that why registered members cant login, when user pass entered it does not process any thing any help will be appreciated Code: [Select] <?php session_start(); session_register("id_session"); session_register("password_session"); include "header.php"; include "config.php"; $a=""; $b=""; if ($_POST) { $a=trim($_POST["id"]); $b=trim($_POST["password"]); $a=str_replace("'","",$a); $b=str_replace("'","",$b); $a=str_replace("\"","",$a); $b=str_replace("\"","",$b); } if ($a=="" || $b=="") { if ($_SESSION["id_session"]=="" || $_SESSION["password_session"]=="") { ?> <form action=members.php method=post> <br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr> <tr><td>Member's ID</td><td><input type=text name=id></td></tr> <tr><td>Password</td><td><input type=password name=password></td></tr> <tr><td> </td><td> <a href="forgot.php" onclick="doexit=false;"><font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></a></td></tr> <tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr> </table></form> <? } else { middle(); } } else { $check=0; $id=$_POST["id"]; $rs = mysql_query("select * from members where ID='$id'"); if ($rs) { $arr=mysql_fetch_array($rs); $n2=$arr['Password']; if ($n2==$b) { $check=1; $_SESSION["id_session"]=$arr[0]; $_SESSION["password_session"]=$arr[9]; middle(); } } if ($check==0) { print "<h2>Invalid User Id or Password</h2>"; ?> <form action=members.php method=post> <br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr> <tr><td>Member's ID</td><td><input type=text name=id></td></tr> <tr><td>Password</td><td><input type=password name=password></td></tr> <tr><td> </td><td> <a href="forgot.php" onclick="doexit=false;"><font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></a></td></tr> <tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr> </table></form> <? } } function middle() { $id=$_SESSION["id_session"]; $rs = mysql_query("select * from members where ID=$id"); $arr=mysql_fetch_array($rs); $check=1; $id=$arr[0]; $password=$arr[9]; $name=$arr[1]; $address=$arr[2]; $city=$arr[3]; $state=$arr[4]; $zip=$arr[5]; $country=$arr[6]; $phone=$arr[7]; $email=$arr[8]; $password=$b; $paymentoption=$arr[10]; $refby=$arr[11]; $l1=$arr[12]; $l2=$arr[13]; $l3=$arr[14]; $l4=$arr[15]; $l5=$arr[16]; $l6=$arr[17]; $l7=$arr[18]; $l8=$arr[19]; $l9=$arr[20]; $l10=$arr[21]; $leader=$arr[22]; $total=$arr[23]; $unpaid=$arr[24]; $paid=$arr[25]; ?> <table border="0" width="650"> <tr> <td width="150" valign="top"> <table width="140"> <tr> <td align="left"><br><br><br><br> <ul><font face="verdana" size="1"> <a href="stats.php">Statistics</a><br><br> <a href="update_pf.php">Edit Personal Information</a><br><br> <a href="sample_e.php">Referral Code & Links</a><br><br> <a href="logout.php">Logout</a><br><br> </td></tr></table> </td> <td VALIGN="top"> <table> <tr> <td> <font face="verdana" size="3"><b> <p>Account Center</b></font></p> <br> </td> </tr> <tr> <td> <div align="center"> <table border="0" cellpadding="3" cellspacing="0" width="400"> <tr> <td colspan="2"><b> <hr><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><center> Account Details for <?echo $name;?></font></center></b><hr> </td> </tr> <tr> <td valign="center" align="left"><strong><font face="Verdana" size="-1">Total Commisions Earned: </font></strong><br></td> <td valign="center"> <font face="Verdana" size="-1">$<? echo $total;?></font><br></td> </tr> <tr> <td valign="center" align="left"><strong><font face="Verdana" size="-1">Commisions Due: </font></strong><br></td> <td valign="center"> <font face="Verdana" size="-1">$<? echo $unpaid;?></font><br></td> </tr> <tr> <td valign="center" align="left"><strong><font face="Verdana" size="-1">Commisions Paid: </font></strong><br></td> <td valign="center"> <font face="Verdana" size="-1">$<? echo $paid;?></font><br></td> </tr> <tr> <td valign="center" align="left" colspan=2> </td> </tr> <tr> <td valign="center" align="left"><strong><font face="Verdana" size="-1">Direct Referrals: </font></strong><br></td> <td valign="center"> <font face="Verdana" size="-1"><? $rsd=mysql_query("select * from members where Leader=".$id); echo mysql_num_rows($rsd); ?></font><br></td> </tr> <tr> <td valign="center" align="left" colspan=2> </td> </tr> <tr> <td valign="center" align="left" colspan=2><strong><font face="Verdana" size="3">Downline Information </font></strong><br></td> </tr> <tr> <td valign="center" align="left"><strong><font face="Verdana" size="-1">Total Downline Size: </font></strong><br></td> <td valign="center"> <font face="Verdana" size="-1"><? echo ($l1+$l2+$l3+$l4+$l5+$l6+$l7+$l8+$l9+$l10); ?></font><br></td> </tr> <tr><td colspan=2> <Table width=100%> <tr><td bgcolor=#000000><strong><font face="Verdana" size="-1" color=#ffffff>Level</font></strong></td> <td bgcolor=#000000><strong><font face="Verdana" size="-1" color=#ffffff>Number of Members</font></strong></td> </tr> <? include "config.php"; ?> <? for($i=1;$i<=$levels;$i++) { ?> <tr><td><strong><font face="Verdana" size="-1"><? echo $i; ?></font></strong></td> <td ><font face="Verdana" size="-1"> <? if($i==1) { echo $l1; } elseif($i==2) { echo $l2; } elseif($i==3) { echo $l3; } elseif($i==4) { echo $l4; } elseif($i==5) { echo $l5; } elseif($i==6) { echo $l6; } elseif($i==7) { echo $l7; } elseif($i==8) { echo $l8; } elseif($i==9) { echo $l9; } elseif($i==10) { echo $l10; } ?> </font></td> </tr> <? } ?> </table> </td></tr> <tr><td colspan=4><hr></td><tr> </table> </div> </td> </tr> </table> <font face="verdana" size="3"><b> <p>Download Center</b></font></p> <? include "download.php"; ?> </td> </tr> </table> <br><br> <? } include "footer.php"; ?> edit: added [code][/code] blocks |