6 / 6 / 5
Регистрация: 29.01.2015
Сообщений: 456
1

Где хранится хеш лайков

04.01.2016, 12:56. Показов 1915. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте, просматривал исходный код вк и увидел, что при лайке в функцию передаётся id поста и хеш(что-то типа Anti-CSRF), при чём уникальный на каждую запись на странице. Если хеш подставить другой, то появится ошибка доступа. Как такое сделать?
Миниатюры
Где хранится хеш лайков  
0
Лучшие ответы (1)
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
04.01.2016, 12:56
Ответы с готовыми решениями:

Char*str = "Hello, world"; Указатель, указывающий на эту строку, хранится в стэке, а где хранится сама строка?
нужно ли освобождать память, выделенную под str?

Где взять код для лайков
Я начинающий веб-программист. И я не могу найти код для лайков. Пожалуйста помогите мне с ним! И...

Где хранится IP-адрес?
Добрый день! Про IP-адреса написано кругом и много. Читаю и везде по сути одно и то же: набор...

Где что хранится
Интересно, а вот такие объекты: int const a(5); char const * str("Hello world"); как...

1
5 / 5 / 9
Регистрация: 24.06.2015
Сообщений: 64
05.01.2016, 16:58 2
Лучший ответ Сообщение было отмечено qwertyyyyyw как решение

Решение

Javascript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
showTooltip(icon.parentNode, {
      url: 'like.php',
      params: {act: 'a_get_stats', 'object': like_obj},
      slide: 15,
      shift: [leftShift, opts.topShift || 5, 9],
      ajaxdt: 100,
      showdt: 400,
      hidedt: 200,
      tip: {
        over: function() {
          Wall.postOver(post);
          Wall.likeOver(post);
        },
        out: function() {
          Wall.likeOut(post);
          Wall.postOut(post);
        }
      },
      className: 'rich like_tt ' + (opts.cl || ''),
      onShowStart: function (tt) {
        if (!tt.container || pointerShift === false) return;
        var bp = geByClass1('bottom_pointer', tt.container, 'div');
        var tp = geByClass1('top_pointer', tt.container, 'div');
        setStyle(bp, {marginLeft: pointerShift});
        setStyle(tp, {marginLeft: pointerShift});
      }
    });
  },
  likeOut: function(post, opts) {
    var icon = ge('like_icon' + post);
    if (!icon) return;
    opts = opts || {};
    if (!hasClass(icon, 'my_like') && !hasClass(icon, 'fw_my_like')) {
      data(icon, 'likeoutTO', setTimeout(animate.pbind(icon, {opacity: opts.opacity || 0.4}, 200, false), 1));
    }
    if (opts.tthide) {
      triggerEvent(icon.parentNode, 'mouseout');
    }
  },
  postLikeOver: function(post, opts) {
    var icon = ge('like_icon' + post),
        link = ge('like_link' + post),
        count = ge('like_count' + post),
        hasShare = ge('share_icon' + post);
 
    if (!icon || cur.viewAsBox) return;
    opts = opts || {};
    var matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|market|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/)
        like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
        linkW = link.clientWidth || link.offsetWidth,
        leftShift = opts.leftShift || (link.parentNode == icon.parentNode ? 0 : linkW),
        pointerShift = false,
        ttW = 230,
        x = getXY(icon.parentNode)[0];
 
    if (opts.leftShift !== undefined) {
      leftShift = opts.leftShift;
    } else {
      if (x + ttW + 20 > lastWindowWidth) {
        leftShift = ttW - (icon.parentNode.clientWidth || icon.parentNode.offsetWidth) + 7;
        pointerShift = ttW - (count.clientWidth || count.offsetWidth) - 14;
      } else {
        leftShift = (link.parentNode == icon.parentNode ? 0 : linkW);
        pointerShift = linkW + 8;
      }
    }
 
    showTooltip(icon.parentNode, {
      url: 'like.php',
      params: {act: 'a_get_stats', 'object': like_obj, 'has_share': hasShare ? 1 : ''},
      slide: 15,
      shift: [leftShift, opts.topShift || 7, 7],
      ajaxdt: 100,
      showdt: 400,
      hidedt: 200,
      tip: {
        over: function() {
          Wall.postOver(post);
          Wall.postLikeOver(post);
        },
        out: function() {
          Wall.postOut(post);
          Wall.postLikeOut(post);
        }
      },
      className: 'rich like_tt ' + (opts.cl || ''),
      onShowStart: function (tt) {
        if (!tt.container || pointerShift === false) return;
        var bp = geByClass1('bottom_pointer', tt.container, 'div');
        var tp = geByClass1('top_pointer', tt.container, 'div');
        setStyle(bp, {marginLeft: pointerShift});
        setStyle(tp, {marginLeft: pointerShift});
      }
    });
  },
  postLikeOut: function () {
  },
  postShareOver: function(post, opts) {
    var icon = ge('share_icon' + post),
        link = ge('share_link' + post),
        count = ge('share_count' + post);
    if (!icon || cur.viewAsBox) return;
    opts = opts || {};
    var matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|market|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/)
        like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
        linkW = link.clientWidth || link.offsetWidth,
        leftShift = opts.leftShift || (link.parentNode == icon.parentNode ? 0 : linkW),
        pointerShift = false,
        ttW = 230,
        x = getXY(icon.parentNode)[0];
 
    if (opts.leftShift !== undefined) {
      leftShift = opts.leftShift;
    } else {
      if (x + ttW + 20 > lastWindowWidth) {
        leftShift = ttW - (icon.parentNode.clientWidth || icon.parentNode.offsetWidth) + 7;
        pointerShift = ttW - (count.clientWidth || count.offsetWidth) - 14;
      } else {
        leftShift = (link.parentNode == icon.parentNode ? 0 : linkW);
        pointerShift = linkW + 8;
      }
    }
 
    if (link.timeout) {
      clearTimeout(link.timeout);
      link.timeout = false;
    } else {
      addClass(icon.parentNode, 'post_share_over');
    }
 
    showTooltip(icon.parentNode, {
      url: 'like.php',
      params: {act: 'a_get_stats', 'object': like_obj, published: 1},
      slide: 15,
      shift: [leftShift, opts.topShift || 7, 7],
      ajaxdt: 100,
      showdt: 400,
      hidedt: 200,
      tip: {
        over: function() {
          Wall.postOver(post);
          Wall.postShareOver(post);
        },
        out: function() {
          Wall.postOut(post);
          Wall.postShareOut(post);
        }
      },
      className: 'rich like_tt ' + (opts.cl || ''),
      onShowStart: function (tt) {
        if (!tt.container || pointerShift === false) return;
        var bp = geByClass1('bottom_pointer', tt.container, 'div');
        var tp = geByClass1('top_pointer', tt.container, 'div');
        setStyle(bp, {marginLeft: pointerShift});
        setStyle(tp, {marginLeft: pointerShift});
      }
    });
  },
  postShareOut: function (post, event) {
    var icon = ge('share_icon' + post),
        link = ge('share_link' + post);
 
    if (!icon) return;
 
    if (!link.timeout) {
      link.timeout = setTimeout(function () {
        removeClass(icon.parentNode, 'post_share_over');
        link.timeout = false;
      }, 10);
    }
  },
  likeFullUpdate: function (like_obj, likeData) {
    // debugLog(like_obj, likeData);
    var matches = like_obj.match(/^(wall|photo|video|note|topic|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(-?\d+_)(\d+)/),
        post = matches ? (matches[2] + (matches[1] == 'wall' ? '' : matches[1]) + matches[3]) : like_obj;
 
    Wall.likeUpdate(post, likeData.like_my, likeData.like_num, likeData.like_title);
    Wall.likeShareUpdate(post, likeData.share_my, likeData.share_num, likeData.share_title);
  },
  likeUpdate: function(post, my, count, title) {
    // console.trace();
    // debugLog(post, my, count, title);
    count = intval(count);
 
    var m = post.match(/(-?\d+)(_?)(photo|video|note|topic|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/),
        like_obj = (m[3] || 'wall') + m[1] + '_' + m[4];
 
    var countInput = ge('like_real_count_' + like_obj) || {}, rows = ge('like_table_' + like_obj);
    var titleNode = ge('like_title_' + like_obj), countNode = ge('like_count' + post);
    if (!countNode) {
      return;
    }
    var icon = ge('like_icon' + post);
    var tt = countNode.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
 
    if (title && titleNode) {
      val(titleNode, title);
    }
    if (tt) {
      tt.likeInvalidated = true;
    }
    countInput.value = count;
    animateCount(countNode, count);
 
    if (my) {
      addClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like');
    } else {
      removeClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like');
    }
    if (count) {
      var styleName = vk.rtl ? 'right' : 'left';
      if (tt.el && !isVisible(tt.container) && !title) {
        rows.style[styleName] = newleft + 'px';
        tooltips.show(tt.el, extend(opts, {showdt: 0}));
      } else if (rows) {
        var params = {};
        params[styleName] = newleft;
        animate(rows, params, 200);
      }
      removeClass(icon, 'no_likes');
    } else {
      if (tt.el) tt.hide();
      addClass(icon, 'no_likes');
    }
  },
  likeShareUpdate: function (post, my, count, title) {
    // console.trace();
    // debugLog(post, my, count, title);
    count = intval(count);
 
    var m = post.match(/(-?\d+)(_?)(photo|video|note|topic|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/),
        like_obj = (m[3] || 'wall') + m[1] + '_' + m[4];
 
    var countInput = ge('like_real_countshares_' + like_obj) || {},
        rows = ge('like_tableshares_' + like_obj),
        titleNode = ge('like_titleshares_' + like_obj),
        countNode = ge('share_count' + post),
        icon = ge('share_icon' + post),
        classEl = icon && icon.parentNode,
        tt = (classEl || {}).tt || {},
        opts = clone(tt.opts || {}),
        shareCb = ge('like_share_' + like_obj),
        newleft = (my ? 0 : -36);
 
    if (!classEl) {
      return;
    }
 
    if (title && titleNode) {
      val(titleNode, title);
    }
    if (tt) {
      tt.likeInvalidated = true;
    }
    countInput.value = count;
    animateCount(countNode, count);
    toggleClass(classEl, 'my_share', my);
    checkbox(shareCb, my);
 
    if (count) {
      var styleName = vk.rtl ? 'right' : 'left';
      if (tt.el && !isVisible(tt.container) && !title) {
        rows.style[styleName] = newleft + 'px';
        tooltips.show(tt.el, extend(opts, {showdt: 0}));
      } else if (rows) {
        var params = {};
        params[styleName] = newleft;
        animate(rows, params, 200);
      }
      removeClass(classEl, 'no_shares');
    } else {
      if (tt.el) tt.hide();
      addClass(classEl, 'no_shares');
    }
  },
  like: function(post, hash) {
    if (!vk.id || cur.viewAsBox) return;
 
    var icon = ge('like_icon' + post),
        my = hasClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like'),
        matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|market|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/),
        like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
        ref = cur.module;
    if (cur.wallType) {
      if (cur.wallType == 'feed') {
        ref = 'feed_' + ((cur.section == 'news' && cur.subsection) ? cur.subsection : cur.section)
      } else {
        ref = 'wall_' + (cur.onepost ? 'one' : (!(cur.wallType || '').indexOf('full_') ? 'full' : 'page'))
      }
    }
 
    ajax.post('like.php', {act: 'a_do_' + (my ? 'un' : '') + 'like', 'object': like_obj, hash: hash, wall: 2, from: ref}, {
      onDone: Wall.likeFullUpdate.pbind(post)
    });
    var count = val(ge('like_real_count_wall' + post) || ge('like_count' + post));
    Wall.likeUpdate(post, !my, intval(count) + (my ? -1 : 1));
    if (cur.onWallLike) {
      cur.onWallLike();
    }
  },
  likeShare: function(post, hash) {
    if (!vk.id || cur.viewAsBox) return;
    var matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|market|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/),
        like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
        el = ge('like_share_' + like_obj), was = isChecked(el),
        ref = cur.wallType ? (cur.wallType == 'feed' ? 'feed_' + cur.section : ('wall_' + (cur.onepost ? 'one' : (!(cur.wallType || '').indexOf('full_') ? 'full' : 'page')))) : cur.module;
 
    checkbox(el);
    ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: like_obj, hash: hash, wall: 2, ref: ref}, {
      onDone: Wall.likeFullUpdate.pbind(post)
    });
    var count = val(ge('like_real_count_wall' + post) || ge('like_count' + post));
    var icon = ge('like_icon' + post), my = hasClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like');
    Wall.likeUpdate(post, true, intval(count) + (my ? 0 : 1));
  },
  likeShareCustom: function (post, params) {
    var matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|market|wall_reply|note_reply|photo_comment|video_comment|topic_comment|market_comment|)(\d+)/),
        like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4];
 
    showBox('like.php', extend({act: 'publish_box', object: like_obj}, params));
  }
1
05.01.2016, 16:58
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
05.01.2016, 16:58
Помогаю со студенческими работами здесь

Где хранится созданный файл ?
Доброго времени суток! Хочу задать дилетантский вопрос. ifstream infile("fdata.txt"); Где...

Где хранится временная таблица?
Доброго времени суток, ребята! Создал временную таблицу: create temporary table pogoda1...

где хранится имя файла
всем привет ) по заголовку темы думаю вопрос понятен но на всякий случай уточню ) скажем есть файл...

Где хранится текст на страничке?
Привет Всем! Подскажите пожалуйста, где хранится текст после её загрузки на страницу? Заранее...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru