Jump to content

JohnOP

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

Everything posted by JohnOP

  1. Im trying to rewrite my urls to look more pretty http://example.com/profile.php?id=username to look like http://example.com/username When testing i can get it too work as http://example.com/username.html RewriteEngine On RewriteRule ^([^/]*).html$ profile.php?id=$1 [L] but when i remove the .html from the rewrite rule, the page works with /username but it doesnt pick up the variable to show the respective profile like it does with the .html, im not sure what the problem is.
  2. I am trying to code a php, mysql and jquery pagination much like the way twitter's pagination works. Page 1 i have <div id="load_more"> <?php $query = mysql_query("SELECT * FROM comments ORDER BY id DESC LIMIT 5"); while($row = mysql_fetch_assoc($query)){ $id = $row['id']; // show comments code } ?> </div> <script type="text/javascript"> $(function() { $('.showmore').live("click",function() { var ID = $(this).attr("id"); if(ID) { $("#more"+ID).html('<img src="ajax-loader.gif" />'); $.ajax({ type: "POST", url: "comments_more.php", data: "lastmsg="+ ID, cache: false, success: function(html){ $("#load_more").append(html); $("#more"+ID).remove(); // removing old more button } }); } else { $(".morebox").html('No more comments.');// no results } return false; }); }); </script> <div id="more<?php echo $id; ?>" class="morebox"> <a href="javascript:;" style="text-decoration: none; font-size: 12px; color: #ffffff; font-weight: bold; " class="showmore" id="<?php echo $id; ?>">Load More Comments</a> </div> So i am only showing 5 rows untill the link is clicked and then i want it to load more comments from comments_more.php which is the same page as above just it checks for the lastmsg id and alters the query to WHERE id < '$lastmsg'. Everything works ok for clicking the link and showing more results but it only works once. even if there is more than 10 rows it will show as "no more comments" after 10. Any help will be appreciated thanks.
  3. I see what you mean though how could i write "If two rows with time span of under 2 minutes that have the same id, username" within the while loop which gets all different users, post at the same time.
  4. Same place you have it just add the new text beside the row data <?php echo "Location". $row['Location'] . "<br>\n"; // Where 'location' is the column/field title in the database echo "Property". $row['Property_type'] . "<br>\n"; // as above echo "Bedrooms". $row['Number_of_bedrooms'] . "<br>\n"; // .. echo "Purchase". $row['Purchase_type'] . "<br>\n"; // .. echo "Price". $row['Price_range'] . "<br>\n"; // .. ?>
  5. Whats wrong with just printing the names? echo "Location".$row['Location'] . "<br>\n";
  6. Yes preferably i could make a stream_id in the table and check it against there recent posts but i can't update the row in the stream to show more images as the stream table only holds one column for a photo. I looked up using multiple values in one column but i seen it was looked upon.
  7. I am creating a stream for my website similar to facebook's news feed where users can post to, add photos too ect. When a user uploads a photo it gets added to the photos table and a new row to the stream mysql_query("INSERT INTO photos VALUES ('','$id','$username','$photo','$time')"); mysql_query("INSERT INTO stream VALUES ('','$id','$username','$time','No comment','$photo','')"); Which displays the image on the stream fine but what i am looking to do is if the user uploads more images one after another instead of adding a new post to the stream for every picture i want to show all of the new pictures in one post like what Facebook does. I can't figure out how i would do this.
  8. I have a comment type of system that i am building which is using jquery to post the comments. When posting a new comment, the div that holds all the comments gets the new post added to it without page refresh which is all good and how i want it. I noticed though if i sign in to my website on another computer and am on the same page as the comments, only the one whom posted the comments div will update because its only them who are firing the form so any other user would have to refresh the page to see the new comment. <script type="text/javascript"> $('form[name=feedUpdate3]').submit(function(){ var id = <?php echo ($id) ?>; var share = $('.expand'+id).val(); var post_id = $('.post_id'+id).val(); $.post('updateFeeds.php', { share: share, post_id: post_id }, function(data){ $('#show_comments'+id).load('post_comments.php?post_id='+id); }); </script> #show_comments is the comments div I have a working solution which is to poll the comments div every so many seconds so all users would get updated with any new comments without having to refresh the page though i know that would cause heavy load on the server. I am just looking for another solution to this.
  9. Oh its a dot and not a comma, thanks a lot that worked.
  10. It doesn't one is the table name and one is the column from that table.
  11. I'm re doing my private message system and im watching a video tutorial on it but have got this very strange error with the max() function code <?php $sql = "SELECT `conversations`,`conversation_id`, `conversations`,`conversation_subject`, MAX(`conversations_messages`,`message_date`) AS `conversation_last_reply` FROM `conversations` LEFT JOIN `conversations_messages` ON `conversations`,`conversation_id` = `conversations_messages`,`conversation_id` INNER JOIN `conversations_members` ON `conversations`,`conversation_id` = `conversations_members`,`conversation_id` WHERE `conversations_members`,`user_id` = {$id} AND `conversations_members`,`conversation_deleted` = 0 GROUP BY `conversations`,`conversation_id` ORDER BY `conversation_last_reply` DESC"; All the fields and tables are correct and i get this error
  12. Hi im looking for some help on the paypal IPN, i am creating a subscrtiption page on my forums and am having trouble with paypal. Here is the relevant part of the ipn code if ($payment_status=="Completed"){ if ($payment_currency=="USD"){ if ($payment_amount == "$5.00"){ define("IN_MYBB", "1"); require("./global.php"); $db->update_query("users", array("usergroup" => "8"), "`uid` = '$custom'"); } } } Now when i run that in the sandbox it works fine and upgrades the account however when i try it with a real payment from the form it doesnt work which is realy weird. <form action='https://www.paypal.com/cgi-bin/webscr' method='POST'> <input type='hidden' name='cmd' value='_xclick'> <input type='hidden' name='business' value='EMAIL' /> <input type='hidden' name='item_name' value='MyBB Subscription for USERNAME, [uID]'> <input type='hidden' name='custom' value='USERS UID' /> <input type='hidden' name='image_url' value='' /> <input type='hidden' name='no_shipping' value='1' /> <input type='hidden' name='notify_url' value='SITE ADDRESS' /> <input type='hidden' name='return' value='SITE ADDRESS /> <input type='hidden' name='cancel_return' value='SITE ADDRESS' /> <input type='hidden' name='bn' value='PP-SubscriptionsBF' /> <input type='hidden' name='amount' value='5.00'> <input type='hidden' name='currency_code' value='USD' /> <input type='image' src='https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif' border='0' alt='PayPal - The safer, easier way to pay online!'> <img alt='' border='0' src='https://www.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'> </form> I don't see why it would work in the sandbox and not on the real form any help will be much appreciated.
  13. Hi i am needing some help using jquery tabs i have one page with tabs on them and when the user goes to each tab it shows diffrent content for each tab without refresh. On one tabs content i have a reload button for the user to reload that tabs content but with just a normal reload it will go back to tab 1 and its content instead of the tab its on. <ul id="home-ul" class="idTabs"> <li id="home-li"><a href="#tab1">Subscribers</a></li> <li id="home-li"><a href="#tab2">Friends</a></li> <li id="home-li"><a href="#tab3">Video Views</a></li> <li id="home-li"><a href="#tab4">Channel Views</a></li> <li id="home-li"><a href="#tab5">Website Views</a></li> </ul> I cant reload the page to #tab2 because the #tabx does not get put in to the url when clicking as it doesnt refresh the page when moving through tabs. Is there anyway i can get it to reload to a certain tab.
  14. The images i have are resized in css and are pulled from the database for each user but when vieweing the page the image slowly loads in like its lagging in.
  15. Well mostly i want to cache images that never change.
  16. I have a question about caching files, the way i have seen people do it on tutorials is they save the file to a cache/ folder if non exists, then check if it exists when the page loads so if it doesn't then load the file normally or if it does then include the cache/file but what is the difference? if the browser has to load the file every time someone goes to it so you cache it for better performance isn't including the cache/file just the exact same thing? the server still has to download the included cached file.
  17. I think i understand what you mean but what would the $timeout variable be? i would still need to put the $website variable in the header refresh so it can refresh every 10 seconds but what would the $timeout declare as. I think i need something like this but i can't get the header() to push the 'Seperator' in to the TheNewWin popup that is already opened <?php header("resfresh 8; $seperator"); //Put that into TheNewWin header("refresh 10; websiteviewcontrol.php?id=$website"); // will put a new website in TheNewWin
  18. Hi i am looking for a bit of help on a script i am trying to make. Basically i have a page when onload it opens a popup with a random website pulled from the database <script language="JavaScript1.1"> <!-- function TheNewWin(url) { var popUp = window.open(url,'popup','height=700,width=700,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=200'); if (popUp == null || typeof(popUp)=='undefined') { var a = confirm('Please disable your pop-up blocker and click the "Open" link again.'); if (a){ window.location.href = 'popupwarn.php'; }else{ window.location.href = 'popupwarn.php'; } } else { popUp.focus(); } } //--> </script> <body onload="TheNewWin($website);"> After 10 seconds i have it refresh so the popup changes to a new website header("refresh: 10; websiteviewcontrol.php?id=$website"); What i want to happen is before it changes the popup to a new website i want it to redirect to some website of my choice for example Facebook. So on the 8th second it would go to Facebook then after the 10 it would just reload and get the random website again. The problem im having is i cant get "Some Website" to open in the popup for a few seconds before the reload.
  19. Turns out it was filezilla it put all the code on 1 line for some reason.
  20. Im getting a realy weird error i my page. <?php session_start(); include 'header.php'; include("connect.php"); $username = $_SESSION['username']; $id = $_SESSION['uid']; How on earth is there an error there lol?
  21. I'm looking for some help from someone who has used the Twitter API, basically i just want to check if i follow a certain user, i have the code set p to log in to my website and auth the user etc i just cant get the check to work correctly. if(isset($_GET['oauth_token']) || (isset($_COOKIE['oauth_token']) && isset($_COOKIE['oauth_token_secret']))) { // user accepted access if( !isset($_COOKIE['oauth_token']) || !isset($_COOKIE['oauth_token_secret']) ) { // user comes from twitter $Twitter->setToken($_GET['oauth_token']); $token = $Twitter->getAccessToken(); setcookie('oauth_token', $token->oauth_token); setcookie('oauth_token_secret', $token->oauth_token_secret); $Twitter->setToken($token->oauth_token, $token->oauth_token_secret); } else { // user switched pages and came back or got here directly, stilled logged in $Twitter->setToken($_COOKIE['oauth_token'],$_COOKIE['oauth_token_secret']); } $user= $Twitter->get_accountVerify_credentials(); echo " <p> Logged in to Twitter as: <strong>{$user->screen_name}</strong><br /> </p>"; //check if i follow someone $follows = $Twitter->get('friendships/exists', array('user_a' => $_SESSION['username'], 'user_b' => 'USERB')); if($follows){ echo 'You are following USERB '; } } I've tried a few different ways but can't seem to get this working.
  22. What i want is after the link is clicked it will call the sub.php page which enters the users id into the database without the page refreshing, to do that i need to pass the id to get to sub.php with refreshing the page.
×
×
  • 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.