Jump to content

Azaz

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Azaz's Achievements

Member

Member (2/5)

0

Reputation

  1. HI everyone, Here is my code: $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 55); fclose($fh); $pices=explode(' ', $theData); And it opens up newuser.txt which is: "I love girls LOL 77" The "I Love GIRLS LOL" is the username of the user and the 77 is the id of the user! But when I echo it out like this: <a href=".?act=Profile&id='.$pices[1].'">'.$pices[0].'</a> It shows only the letter "i"? How do I make it show the full username even if it has spaces?
  2. Yea, I got that, thank you!! I am just curious on why he thinks the other way is faster and it'snot finding like it's finding the exact which i don't need in the first place,lol How old are you? 12yo? SELECT * FROM `table` WHERE `row` LIKE '%Silvin%' OR `row` LIKE '%wts%' and SELECT * FROM `table` WHERE MATCH `row` AGAINST( 'Silvin wts') Will produce the same result....except MATCH doesnt have to scan the database to find a like and it IS faster BOOYA! I wasn't asking for MATCH RESULTS BUDDY, I am asking for LIKE RESULTS. Do you really think people are perfect and say everything EXACTLY The same on forums? Even if i was 12, And learning php i'll be smarter then you when I hit your age so don't come to conclusions just yet .
  3. Thanks!! But my id has more then 1 character it currently only shows 1 digit from my 2digit id any cause why? My id is 73, it only shows 7 hmm?
  4. For example: I am using this code: $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 5); fclose($fh); echo $theData; and it displays: Bob 2 Which I am reading from my newuser.txt file! Which corresponds to the username bob, and he has the ID of 2. Now I want to make that linkable like this: <a href=.?act=Profile&id=$IDFROMTEXTFILE(2)>$NAMEFROMTEXTFILE(BOB)</a> this is possible? If so, Thanks!
  5. Sweet, Solved. Gotta love people like you here, I hope to hear from you in the future,
  6. MYIASM, but i heard you can use COUNT("pid") or just count 1 row instead of using * still possible faster ? thanks[/code]
  7. SELECT count(*) as total FROM forum_replies My forum_replies has over 30,000 rows... how would mysql handle this on a forum on the main index, is there a better/simplified way ? I just need to grab posts not *... ?
  8. Ok thanks, and this query isn't working can u find out why? mysql_query("UPDATE friends SET accepted='1' WHERE friend_id='$id' AND id='{$_SESSION['user_id']}"); Redirect( "You have Successfully accepted this user", './?act=Friends&m=Pending' ); It's for my friend system for my forum I am creating... It doesn't pop any errors but I cannot see it change in my database table hmm... ROFL I FORGOT THE " ' " after } ZZ..my bad delete this post, lol ok thx 4 ur script zzzzzzzz
  9. if ( $r['warn'] >= 100 ) { $warn = '<img src=\'images/10.gif\'>'; $precent = "<font color=red>100</font>"; } else if ( $r['warn'] >= 90 ) { $warn = '<img src=\'images/9.gif\'>'; $precent = "90"; } else if ( $r['warn'] >= 80 ) { $warn = '<img src=\'images/8.gif\'>'; $precent = "80"; } else if ( $r['warn'] >= 70 ) { $warn = '<img src=\'images/7.gif\'>'; $precent = "70"; } else if ( $r['warn'] >= 60 ) { $warn = '<img src=\'images/6.gif\'>'; $precent = "60"; } else if ( $r['warn'] >= 50 ) { $warn = '<img src=\'images/5.gif\'>'; $precent = "50"; } else if ( $r['warn'] >= 40 ) { $warn = '<img src=\'images/4.gif\'>'; $precent = "40"; } else if ( $r['warn'] >= 30 ) { $warn = '<img src=\'images/3.gif\'>'; $precent = "30"; } else if ( $r['warn'] >= 20 ) { $warn = '<img src=\'images/2.gif\'>'; $precent = "20"; } else if ( $r['warn'] >= 10 ) { $warn = '<img src=\'images/1.gif\'>'; $precent = "10";} else if ( $r['warn'] <= 9 ){$warn = '<img src=\'images/0.gif\'>';$precent = "0";} I need to find a program that automatically squishes everything into 1 line of code, because I will not need to edit this code ever again, lol! Thanks! and it's taking to much space in my coding area
  10. Ok sweet Masterprice, I was thinking of that too! but now I have 1 other problem, What if I want to make it so they have to accept them to be a friend? Would I need a table called friend_reqs or is it simplilar? Thanks for your response tho if you could chime in here 1 more time i would love it.
  11. So I make a colum in my table called "friends" Is there a way to update using mysql that colum for each user, so let's say friend 1 adds friends 2 with the id of 25 so the query puts the id "25" into the friends column, then if friend 1 adds friend 5 with the id of 26 it puts "26" into the friends column and so on... So it would have like commas in the colum, 25,26,30,31,31 and all those represent the id's of the person who is wanting to add people to his friends list! If so how do I accomplish that, and then what If I want to use mysql to list all those id's and SELECT name,avatar,etc from userstable WHERE id = "25,26,3,31,31" Is this even possible or am i thinking to harD?
  12. EDIT: This query is run each time a user refreshes mysql_query("DELETE FROM ibf_sessions WHERE running_time < UNIX_TIMESTAMP(now())-{$GLOBALS['offline']}"); This is for the afk 5minutes, your gone! {$GLOBALS['offline']}") = 300.
  13. So like When somones enter my site it shows them as a guest, but then if they havn't clicked anywere for about 5minutes and then refresh or if somone else refresh it will delete from the active users list because it's been over 5 minutes, but then if that same person refreshes again my script wont catch them as a GUEST AGAIN!! It just shows no one online, none of my if's catch him and put him in the ibf_session table! //check for cookies //If no username, Is a Guest, Has COOKIE_ID and cookie USER_NAME and COOKIe PASSWORD if(!isset($_SESSION['user_name']) && !isset($_SESSION['is_guest']) && isset($_COOKIE['user_id']) && isset($_COOKIE['user_name']) && isset($_COOKIE['password'])){ $user_cond = "user_name='{$_COOKIE['user_name']}'"; $sql = "SELECT `id`,`user_name`,`approved` FROM users WHERE $user_cond AND `pwd` = '{$_COOKIE['password']}' AND `banned` = '0' "; $result = mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($result); // Match row found with more than 1 results - the user is authenticated. if ( $num > 0 ) { list($id,$full_name,$approved) = mysql_fetch_row($result); if(!$approved) { echo "YOU FREAKING HACKER"; exit(); } $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $lol = session_id(); //$minute5 = 30 ? (time() - 30) : (time() - 3600); // mysql_query("DELETE FROM ibf_sessions WHERE running_time < {$minute5}"); mysql_query("INSERT INTO ibf_sessions (id, member_name, member_id, ip_address, running_time, location, member_group) ". "VALUES ('".$lol."', '{$_SESSION['user_name']}', '{$_SESSION['user_id']}', '{$_SERVER['REMOTE_ADDR']}', '".time()."', ". "'Index', '1')") or die(mysql_error()); unset($_SESSION['is_guest']); } } $lol = session_id(); //Thanks if (!$id) { //Create Guest Session ~ if (!isset($_SESSION['user_id']) && @(!$_SESSION['is_guest']) && !isset($_COOKIE['password'])) { //$minute5 = 39 ? (time() - 30) : (time() - 3600); //echo $minute5; // mysql_query("DELETE FROM ibf_sessions WHERE running_time < {$minute5}"); mysql_query("INSERT INTO ibf_sessions (id, member_name, member_id, ip_address, running_time, location, member_group) ". "VALUES ('".$lol."', 'Guest', '0', '{$_SERVER['REMOTE_ADDR']}', '".time()."', ". "'Index', '0')") or die(mysql_error()); $_SESSION['is_guest'] = 'yes'; } } if (isset($_SESSION['user_id']) && !isset($_SESSION['is_guest'])) { mysql_query("UPDATE ibf_sessions SET member_name='{$_SESSION['user_name']}',member_id='{$_SESSION['user_id']}',member_group='1', running_time='".time()."', in_forum='".$f."', in_topic='".$topicid."', location='".$act."' WHERE id='".$lol."'") or die(mysql_error()); } else { mysql_query("UPDATE ibf_sessions SET member_name='Guest',member_id='0',member_group='0', running_time='".time()."', in_forum='".$f."', in_topic='".$topicid."', location='".$act."' WHERE id='".$lol."'") or die(mysql_error()); } Thanks, it might be confusing but re read
  14. Well yea but what if I have 300,000 posts and selecting all those??? take forever?
×
×
  • 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.