Ratnikov310 Posted August 29, 2012 Report Share Posted August 29, 2012 (edited) Для своей соц сети хочу сделать свитч по значениям (0 или 1) для определения online, но почему-то не робит all.jswindow.load = function() { var xmlhttp = getXmlHttp();xmlhttp.open('GET', 'suggest.html?status=1', false);xmlhttp.send(null);};window.unload = function() { var xmlhttp = getXmlHttp();xmlhttp.open('GET', 'suggest.html?status=0', false);xmlhttp.send(null);};suggest.phpfunction is_online() { $dir='user/'.@$user; if($dir!='user/'){ $of=fopen($dir.'/online.txt', 'w'); fwrite($of, '1'); fclose($of); }}function is_offline() { $dir='user/'.@$user; if($dir!='user/'){ $of=fopen($dir.'/online.txt', 'w'); fwrite($of, '0'); fclose($of); }}if($_GET['status']=='0'){is_offline();}if($_GET['status']=='1'){is_online();}В чем проблема? Edited August 29, 2012 by Ratnikov310 Quote Link to comment Share on other sites More sharing options...
0 Great Rash Posted August 29, 2012 Report Share Posted August 29, 2012 window.onloadwindow.onunloadУ вас слишком много jQuery в голове Quote Link to comment Share on other sites More sharing options...
0 Ratnikov310 Posted August 29, 2012 Author Report Share Posted August 29, 2012 спс Quote Link to comment Share on other sites More sharing options...
0 Int Posted August 29, 2012 Report Share Posted August 29, 2012 function is_offline() { $dir='user/'.@$user;А откуда тут возьмётся $user?Почему не делаешь flock при записи?Надеюсь, папка user/ у тебя лежит на tmpfs, а то ты винт задёргаешь Quote Link to comment Share on other sites More sharing options...
0 Ratnikov310 Posted August 30, 2012 Author Report Share Posted August 30, 2012 А откуда тут возьмётся $user?: безется он из global.php с кук с последующим декодирование base64;Почему не делаешь flock при записи?: Какая разница? Надеюсь, папка user/ у тебя лежит на tmpfs, а то ты винт задёргаешь: Она лижит в корне сайта, там все данные юзеря тч и пароль. Кстати не подскажите, как еще кроме base64 можно зашифровать пароль, а то он в голом виде лижит)) Quote Link to comment Share on other sites More sharing options...
0 CalvinKlein Posted August 30, 2012 Report Share Posted August 30, 2012 (edited) base64 это не шифровашиевообще для проверки паролей используется хеш(md5, sha1 например) Edited August 30, 2012 by CalvinKlein Quote Link to comment Share on other sites More sharing options...
0 Ratnikov310 Posted August 31, 2012 Author Report Share Posted August 31, 2012 спасибо Quote Link to comment Share on other sites More sharing options...
Question
Ratnikov310
Для своей соц сети хочу сделать свитч по значениям (0 или 1) для определения online, но почему-то не робит
all.js
suggest.php
В чем проблема?
Edited by Ratnikov310Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.