آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

یک کد json

سجاد زهره ای  11 سال پیش  11 سال پیش
0 0

سلام ایا این کد جسیون  هست؟

اگر نیس چی هس؟یه برنامه دارم داره اینو دریافت میکنه!چجوری؟

 <data><user userKey='16' /><friend  username = 'test2' 
status='offline' IP='5.22.50.176' userKey = '17' port='15145'
authenticationTime ='2014-11-14 17:19:57' wall='love' /></data>

+1 0
نه دوست عزیز این کجاش شبیه جیسونه؟ بیشتر شبیه xml ه. (11 سال پیش)
0 0
خب یه برنامه دارم داره اینو دریافت میکنه و چاپ میکنه!اطلاعاتی در موردش دارین؟ (11 سال پیش)
0 0
مثلا چه اطلاعاتی؟ این که چطوری دریافت میکنه و چاپش میکنه؟ (11 سال پیش)
0 0
داره اطلاعات کاربر رو میخونه و در یک لیست ویو نشون میده الان کد php هم میزارم (11 سال پیش)
0 0
داره اطلاعات کاربر رو میخونه و در یک لیست ویو نشون میده الان کد php هم میزارم if ($userId = authenticateUser($db, $username, $password)) { لینک providerId and requestId is Id of a friend pair, لینک providerId is the Id of making first friend request لینک requestId is the Id of the friend approved the friend request made by providerId لینک fetching friends, لینک left join expression is a bit different, لینک it is required to fetch the friend, not the users itself $sql = "select u.Id, u.username, (NOW()-u.authenticationTime) as authenticateTimeDifference, u.IP,u.authenticationTime,u.wall, f.providerId, f.requestId, f.status, u.port from friends f left join users u on u.Id = if ( f.providerId = ".$userId.", f.requestId, f.providerId ) where (f.providerId = ".$userId." and f.status=".USER_APPROVED.") or f.requestId = ".$userId." "; لینک = "SELECT * FROM messages WHERE touid = ".$userId." AND read = 0 LIMIT 0, 30 "; $sqlmessage = "SELECT m.id, m.fromuid, m.touid, m.sentdt, m.read, m.readdt, m.messagetext, u.username from messages m \n" . "left join users u on u.Id = m.fromuid WHERE touid = ".$userId." AND read = 0 LIMIT 0, 30 "; if ($result = $db->query($sql)) { $out .= ""; $out .= ""; while ($row = $db->fetchObject($result)) { $status = "offline"; if (((int)$row->status) == USER_UNAPPROVED) { $status = "unApproved"; } else if (((int)$row->authenticateTimeDifference) < TIME_INTERVAL_FOR_USER_STATUS) { $status = "online"; } $out .= ""; لینک to increase security, we need to change userKey periodically and pay more attention لینک receiving message and sending message } if ($resultmessage = $db->query($sqlmessage)) { while ($rowmessage = $db->fetchObject($resultmessage)) { $out .= ""; $sqlendmsg = "UPDATE messages SET read = 1, readdt = '".DATE("Y-m-d H:i")."' WHERE messages.id = ".$rowmessage->id.";"; $db->query($sqlendmsg); } } $out .= ""; } else { $out = FAILED; } } else { لینک exit application if not authenticated user $out = FAILED; } (11 سال پیش)
0 0
داره اطلاعات کاربر رو میخونه و در یک لیست ویو نشون میده الان کد php هم میزارم (11 سال پیش)
+1 0
بهتر بود کد رو در توی یک پاسخ جدید میگذاشتید.البته نیازی به گذاشتن کد ها نیست.این رشته که گذاشتید json هست و xml نیست. نیاز دارید که xml رو پردازش کنید و اطلاعاتی که می خواهید رو از واکشی کنید. به این لینک مراجعه کنید. (11 سال پیش)
+1 0
بخشید می خواستم بنویسم این رشته که گذاشتید xml هست و json نیست. اشتباه شد. (11 سال پیش)
0 0
شرمنده بخدا لطف کردین (11 سال پیش)
0 0
خواهش میکنم:) (11 سال پیش)
 برای این سوال 1 پاسخ وجود دارد.
پاسخ به سوال 
سجاد زهره ای  11 سال پیش
0 0

 if ($userId = authenticateUser($db, $username, $password))
{

// providerId and requestId is Id of a friend pair,
// providerId is the Id of making first friend request
// requestId is the Id of the friend approved the friend request made by providerId

// fetching friends,
// left join expression is a bit different,
// it is required to fetch the friend, not the users itself

$sql = "select u.Id, u.username, (NOW()-u.authenticationTime)
as authenticateTimeDifference, u.IP,u.authenticationTime,u.wall,

f.providerId, f.requestId, f.status, u.port
from friends f
left join users u on


u.Id = if ( f.providerId = ".$userId.", f.requestId, f.providerId )

where (f.providerId = ".$userId." and f.status=".USER_APPROVED.") or

f.requestId = ".$userId." ";

$sqlmessage = "SELECT m.id, m.fromuid, m.touid, m.sentdt, m.read, m.readdt,
m.messagetext, u.username from messages m \n"
. "left join users u on u.Id = m.fromuid WHERE `touid` = ".$userId." AND `read` = 0
LIMIT 0, 30 ";


if ($result = $db->query($sql))
{
$out .= "<data>";
$out .= "<user userKey='".$userId."' />";
while ($row = $db->fetchObject($result))
{
$status = "offline";
if (((int)$row->status) == USER_UNAPPROVED)
{
$status = "unApproved";
}
else if (((int)$row->authenticateTimeDifference) < TIME_INTERVAL_FOR_USER_STATUS)
{
$status = "online";

}
$out .= "<friend username = '".$row->username."' status='".$status."' IP='".$row->IP."' userKey = '".$row->Id."' port='".$row->port."' authenticationTime ='".$row->authenticationTime."' wall='".$row->wall."' />";

// to increase security, we need to change userKey periodically and pay more attention
// receiving message and sending message

}
if ($resultmessage = $db->query($sqlmessage))
{
while ($rowmessage = $db->fetchObject($resultmessage))
{
$out .= "<message from='".$rowmessage->username."' sendt='".$rowmessage->sentdt."' text='".$rowmessage->messagetext."' />";
$sqlendmsg = "UPDATE `messages` SET `read` = 1, `readdt` = '".DATE("Y-m-d H:i")."' WHERE `messages`.`id` = ".$rowmessage->id.";";
$db->query($sqlendmsg);
}
}
$out .= "</data>";
}
else
{
$out = FAILED;
}
}
else
{
// exit application if not authenticated user
$out = FAILED;
}
0 0
چرا سایت اینجور شده؟؟؟؟؟ببخشید من نمیدونسم سایت تغییر کرده! (11 سال پیش)

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .