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 ApplicationSee 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"
". $ Key ." | \ N "; // define idecho"
". $ 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" | \ N "; echo"
\ N ";}?>
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
?
?