Small-scale Twitter system streaming + zookeeper, PHP

Source: Internet
Author: User
Small Twitter system source code: Ghost + ghost, PHP? Today, let's repeat the source of the small twitter System. I have studied the idea that I am familiar with php? What are the plans for the next month's career design? Lower limit dl. vmall. comc0nkwafdqz? Index? & Lt ;? Phpsession_start (); include_once (header. php); I small Twitter system source region + zookeeper, PHP

?

Today, let's repeat the source of the small twitter System. I have studied the idea that I am familiar with php?

Plans for future career design in the next month

?

Lower limit

Http://dl.vmall.com/c0nkwafdqz

?

Index

?

 
 Microblogging Application

See list of users

". $ _ SESSION ['message'].""; Unset ($ _ SESSION ['message']);}?>


Headers

?

?

 Please contact your system's admin for more help\n";exit ();}mysql_select_db ( $DATABASE );?>

Users

 
 Microblogging Application-UsersList of Users
 
 
 
  $ Value) {// => is used to obtain the content of elements in a cell in the array. echo"
  
  
     \ N "; echo" 
    \ N "; // define idecho" 
    \ N "; echo" 
   \ N ";}?> 
  
". $ Key ."". $ Value; // the value corresponding to the id, that is, valueif (in_array ($ key, $ following )) {// check whether the key is in following, and then display different values according to the status to display different information to generate different link to action echo"Unfollow";} Else {echo"Follow";} Echo"

There are no users in the system!



?

?

 0) {$ extra = "limit $ limit";} else {$ extra = '';} $ SQL =" select user_id, body, stamp from posts where user_id in ($ user_string) order by stamp desc $ extra "; echo $ SQL; $ result = mysql_query ($ SQL ); while ($ data = mysql_fetch_object ($ result) {$ posts [] = array ('stamp' => $ data-> stamp, 'userid' => $ data-> user_id, 'body' => $ data-> body);} return $ posts ;} /*** display user * if user_id = 0, all users are directly displayed * if user I D> 0. the user id * @ param unknown_type $ user_id * @ return multitype: | multitype: NULL */function show_users ($ user_id = 0) is displayed) {if ($ user_id> 0) {$ follow = array (); $ fsql = "select user_id from followingwhere follower_id = '$ user_id '"; // select the follower $ fresult = mysql_query ($ fsql) for the id from follow; while ($ f = mysql_fetch_object ($ fresult )) {// Convert the result as an object into array_push ($ follow, $ f-> user_id); // Set the user_id word in f Put segments in follow} if (count ($ follow) {$ id_string = implode (',', $ follow ", "As a separator to process this string, for the concatenated SQL $ extra =" and id in ($ id_string) ";}else {return array ();}} $ users = array (); $ SQL = "select id, username from users where status = 'active' $ extra order by username "; // select the follower id and name $ result = mysql_query ($ SQL) from the user table; while ($ data = mysql_fetch_object ($ result )) {$ users [$ data-> id] = $ Data-> username; // enter the user name in the user field.} return $ users ;} /*** search for the user's follow user id * @ param unknown_type $ userid * @ return multitype: */function following ($ userid) {$ users = array (); $ SQL = "select distinct user_id from followingwhere follower_id = '$ userid'"; $ result = mysql_query ($ SQL); while ($ data = mysql_fetch_object ($ result )) {array_push ($ users, $ data-> user_id);} return $ users;} function check_cou Nt ($ first, $ second) {$ SQL = "select count (*) from followingwhere user_id = '$ second' and follower_id =' $ first '"; $ result = mysql_query ($ SQL); $ row = mysql_fetch_row ($ result); return $ row [0];} function follow_user ($ me, $ them) {$ count = check_count ($ me, $ them); if ($ count = 0) {$ SQL = "insert into following (user_id, follower_id) values ($ them, $ me) "; $ result = mysql_query ($ SQL) ;}} function unfoll Ow_user ($ me, $ them) {$ count = check_count ($ me, $ them); if ($ count! = 0) {$ SQL = "delete from followingwhere user_id = '$ them' and follower_id = '$ me' limit 1 "; $ result = mysql_query ($ SQL) ;}}?>


Add

?

?

 


 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.