Jump to content

Lucky2710

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://nodinelandscaping.com

Profile Information

  • Gender
    Male
  • Location
    SC

Lucky2710's Achievements

Member

Member (2/5)

0

Reputation

  1. I figured it out i ditched my first idea when i figured out people were doing this on a link with auto-redirect. Step 1: Initialize the javascript sdk Step 2: Put a link to logout Code for link -------------------- <a href="#" onclick="javascript:FB.logout(function() { window.location='PUT YOUR REDIRECT URL HERE' }); return false;">Logout</a> NOTE: I am running the facebook login as a parrallel login to my websites current php login system so my redirect url went to a page that runs (almost in the background) to destroy my php session and then again auto redirects back to my index page. By doing it this way in the users ONE click it logs them completely out of both facebook and my website Code for my redirect (aka. my website log out) -------------------------------------------------------------- <?php include_once('framework/checkuserlog.php'); ?> <script> function killSession(){ var code = "<?php session_destroy();?>"; return (code); } killSession(); </script> <script> location.href='index.php'; </script>
  2. I'm using facebook connect as an alternative login method for my users on my website. (ex forget your credentials to my website use your facebook credentials) Ive got the facebook login working and ive got it working in conjunction with my login system. In facebooks terms and conditions you have to include a facebook logoff if you have a facebook login on your website. I have managed to get it to logoff on a <button></button> But thats the oinly way i can get it to work! I need it to run automatically on my logout script page. My current Logout.php (NOTE: Only kills the session and logs out of my php login script THE JAVASCRIPT DOES NOT WORK CORRECTLY AND LOGOUT OF FACEBOOK LIKE ITS SUPPOSED TO) <?php include_once('framework/checkuserlog.php'); ?> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({appId: 'APP_ID_HERE', status: true, cookie: true, xfbml: true}); FB.logout(function(response) {}); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <?php session_destroy(); ?> <script> location.href='index.php'; </script> Working Script To Logout on a <button> <div id="fb-root"></div> <script type="text/javascript"> var button; var userInfo; window.fbAsyncInit = function() { FB.init({ appId: 'APP_ID_HERE', status: true, cookie: true, xfbml: true, oauth: true}); showLoader(true); function updateButton(response) { button = document.getElementById('fb-auth'); userInfo = document.getElementById('user-info'); if (response.authResponse) { //user is already logged in and connected FB.api('/me', function(info) { login(response, info); }); button.onclick = function() { FB.logout(function(response) { logout(response); }); }; } else { //user is not connected to your app or logged out button.innerHTML = 'Login with Facebook'; button.onclick = function() { showLoader(true); FB.login(function(response) { if (response.authResponse) { FB.api('/me', function(info) { login(response, info); }); } else { //user cancelled login or did not grant authorization showLoader(false); } }, {scope:'email,user_birthday'}); } } } // run once with current status and whenever the status changes FB.getLoginStatus(updateButton); FB.Event.subscribe('auth.statusChange', updateButton); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); function login(response, info){ if (response.authResponse) { var accessToken = response.authResponse.accessToken; userid = response.authResponse.userID; userInfo.innerHTML = ''; button.innerHTML = 'Logout'; showLoader(false); document.getElementById('other').style.display = "block"; } } function logout(response){ userInfo.innerHTML = ""; document.getElementById('debug').innerHTML = ""; document.getElementById('other').style.display = "none"; showLoader(false); } function showLoader(status){ if (status) document.getElementById('loader').style.display = 'block'; else document.getElementById('loader').style.display = 'none'; } </script> <button id="fb-auth">Login with Facebook</button> <div id="loader" style="display:none"></div> <div id="user-info"></div> <div id="debug"></div> <div id="other" style="display:none"></div> Stuff that might help with a solution ------------------------------------------------ All Facebook connect code is using facebooks javascript sdk loaded Asynchronously All my traditional custom built login script is built in php and is almost 100% mysql database driven Server:Apache/2.0.52 (Red Hat) MySQL Server: Version 5.1.42
  3. I've done this before I just can't remember how will someone point me in the right direction? Thanks Say you have this url http://myurl.com/page.php?code=AQBpGFUngD How can i pull the ''code" variable from the url back into a php variable that i can use it again on my page? Thanks ahead of time!
  4. I'm not sure if this question is better asked here or in the 'other' category in client side but that category of forums has less traffic so i'm posting here. I am trying to mix php, mysql, and flash all togather. In mysql ive got a table with information regarding my photo gallery (columns are like 'id' 'location' 'date' 'uploader' ect) I am using php to pick 5 random pictures and return those 5 picture locations into 5 different php variables. NOW MY ISSUE: How can I send those 5 php variables into flash (as3) as 5 as3 variables??? Any help would be appreciated!
  5. Thanks for the help i got it now
  6. Im working on a site and particularly the photo gallery section. I want to display 9 images on 3 rows (3 per row). And im stuck. Te only way i can get the images to show up not one on top of the other is by using a table. but how can i tell the table to only put 3 <td>'s then to <br> Heres my code so far... <?php $sql_images = mysql_query("SELECT * FROM photos ORDER BY upload_date DESC LIMIT 9"); while($row = mysql_fetch_array($sql_images)){ $photo_id = $row["id"]; $location = $row["location"]; $display_pics .= ' <td width="125px"> <a href="image.php?id='. $album_id .'" class="black"><img src="images/uploads/thumbs/' . $location . '" /></a> </td>'; } ?> Then to display it ... <table width="top" cellpadding="10" cellspacing="20"> <tr> <?php echo $display_pics; ?> </tr> </table> My goal is to do it as simple as possible! Can anyone help? If you don't think tables are the way to go im open to any suggestions. I've thought about <divs> but then the images show up one on top of the other and not beside each other. By the way all the images are a max of 100px heigh and 100px wide Thanks for any help or suggestions!
  7. I currently have a login script in place on my site and to get to certain pages you have to be logged in to get to. So when a user tries to go to one of those pages and is not logged in it sends them to the login page (which is great) But on the login page once they login it uses " header('Location: index.php') " to automatically send them to the index page logged in. How can i dynamically see what page they are coming from that way when they login I can send them back to where they where trying to get to to begin with. (like if they click on "Profile" and they are not logged in it sends them to "login" then they login and it currently sends them to "index" I want it to dynamically know to send them back to "profile" instead) If this doesn't make sense and i will try and explain it better But if you understand and know how to do this please help Thanks ahead of time!
  8. I have an upload system on my web site. On the server side of things it only accepts certain file types .gif, .jpg, .png, and .jpeg. How can I make it so that when they are browsing for files with the form <input type="file" name="file" /> that they can only select those same file types. I don't want people to be able to even try and upload anything besides my specified image types!
  9. Or is there a way to write a code that will automatically shrink it to fit inside 80px x 80px without making it look stupid by stretching it outa wack??
  10. Great I got it working almost perfectly! Thanks ONE LAST Question! How can I put a restriction for max height and max width. I need the file to be no larger than 80px x 80px How do I go about doing that? Heres my current WORKING code... (I just need some help with restrictions) <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) || ($_FILES["file"]["type"] == "image/png") && ($_FILES["file"]["size"] < 200000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("images/avatars/uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "images/avatars/uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "images/avatars/uploads/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?>
  11. On my website I currently have it set up so that each user can pick there "avatar" (little picture or icon) Each user has the same choices but they all can pick different ones. I want to make it where they can upload their own picture and have a custom avatar. Where Should I start?
  12. I am trying to incorporate a spry accordion into my site. I have the accordion exactly how i want it except, I don't want the first panel to be open when the page loads. I want the user to have to click which panel to open. Everything i've read online says this is in javascript but everything that i read has been wrong so far! Cause I'm still stuck!!! Thanks
  13. Thanks AbraCadaver Thats way shorter and does the same thing.
  14. Because it was quicker to create to begin with, and made the code way shorter, because instead of on the picks page having to specify each team for each game, all i had to do was say 1 = away and 2 = home. At the time it seemed like the best way to go. And now trying to make it user friendly to show them what they picked. Now its gonna be just as complicated, and long. But i'm not re doing all the stuff i've done so far. So im just gonna keep going with how it is. This thread, i had a code error. Problem solved! my if statements i forgot the { & }.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.