Author Topic: Big delete and new option for rate limiter  (Read 2568 times)

pourkoipas78

  • Prime Member
  • ****
  • Posts: 107
  • Karma: +1/-0
Big delete and new option for rate limiter
« on: August 14, 2015, 03:36:26 AM »
Hello,

It should be added batch processing for removing a lot of pictures , a lot of feedback from members who do not follow the instructions or spammers

It would also add the option Member photo in to rate limit such that only members can comment with a photo or other photos other profiles , or only members with profile photos can create a blog or can use private messaging

It would be a good idea , right?
Thank you

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: Big delete and new option for rate limiter
« Reply #1 on: August 14, 2015, 04:07:15 AM »
Hello,

It should be added batch processing for removing a lot of pictures , a lot of feedback from members who do not follow the instructions or spammers

It would also add the option Member photo in to rate limit such that only members can comment with a photo or other photos other profiles , or only members with profile photos can create a blog or can use private messaging

Totally agree!

The first option will make it a bit easier to keep the site clean.

Especially the second option is great idea to force members to upload their profile photo to get access to some predefined features. It will make the user feel they will get rewarded when upload their profile photo.


KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 501
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: Big delete and new option for rate limiter
« Reply #2 on: August 14, 2015, 08:23:56 AM »
Your second suggestion isn't something that could be achieved through the rate limiter.

To restrict certain features to only members who have a profile picture you'd be better off adding a new site option.

Heres an something which should help achieve it.

NOTE! This guide is based on accessing the database with phpMyAdmin. If you don't use phpMyAdmin then things might be different

1) Access your database and choose the table you use for your etano site

2) Click the dsb_site_options3 table

3) Click the SQL tab

copy and paste this into the textarea and click Save/Go
Code: [Select]
INSERT INTO `dsb_site_options3` (`config_id`, `config_option`, `config_value`, `config_diz`, `option_type`, `choices`, `fk_module_code`, `per_user`) VALUES (NULL, 'photo_required', '0', 'Users must have a profile picture for certain features', '9', '', 'core', '0')

If successful you will now have a new option on your "Features and Options" page in your admin panel. Check it to turn it on and uncheck it to turn it off.


4) Now, decide what features you want to be restricted to members with profile photos and locate the relevant php files

And you could use:

Code: [Select]
$config=get_site_option(array('photo_required'),'core');
if (!empty($config['photo_required'])) {
if (isset($_SESSION[_LICENSE_KEY_]['user']['user_id'])) {
$query="SELECT `_photo` as `photo` FROM `{$dbtable_prefix}user_profiles` WHERE `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' ";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
if (mysql_num_rows($res)) {
$photo_check=mysql_fetch_assoc($res);
if (empty($photo_check['photo'])) {
$topass['message']['type']=MESSAGE_ERROR;
$topass['message']['text']='Your profile is incomplete. Please upload a profile picture to use this feature.';
redirect2page('photos_upload.php',$topass);
}
}
} else {
$topass['message']['type']=MESSAGE_ERROR;
$topass['message']['text']='Please login first.';
redirect2page('login.php',$topass);
}
}

NOTE! If the user tries to access a page which you require a profile picture for and they don't have one it will redirect them to the photo upload page with a message "Your profile is incomplete. Please upload a profile picture to use this feature."


For example, only members with profile pictures can send messages/flirts:

You would place the above code in the main php files

ROOTDIRECTORY > message_send.php
ROOTDIRECTORY > flirt_send.php


The placement of the photo check code should be near the top of the file (ideally after the inclusion of files).

Example - Send Flirts Page
Code: [Select]

require 'includes/common.inc.php';
require _BASEPATH_.'/includes/user_functions.inc.php';
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/mailbox.inc.php';


##### PHOTO CHECK CODE HERE #######


////Rest of page coding here////


And that should be it.

pourkoipas78

  • Prime Member
  • ****
  • Posts: 107
  • Karma: +1/-0
Re: Big delete and new option for rate limiter
« Reply #3 on: August 14, 2015, 09:48:21 AM »
Great, thank you , I just tried it and it works fine ...

I put to flirt_send.php and blog_addedit.php by cons I do not see how to comments profiles, photos and reviews comments blogs because the process is different ...

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 501
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: Big delete and new option for rate limiter
« Reply #4 on: August 14, 2015, 10:18:37 AM »
To restricting adding comments to members with a profile picture you just add the code to

ROOTDIRECTORY > processors > comment_addedit.php

Just put it above

Code: [Select]
require '../includes/common.inc.php';
require _BASEPATH_.'/includes/user_functions.inc.php';
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/comments.inc.php';

#### PHOTO CHECK HERE ######

//// Rest of code here //////

check_login_member('write_comments');

Around line 17..

pourkoipas78

  • Prime Member
  • ****
  • Posts: 107
  • Karma: +1/-0
Re: Big delete and new option for rate limiter
« Reply #5 on: August 14, 2015, 10:25:12 AM »
The problem is that members will be writing and posting once they go will see the redirect ... but it does not matter

Big thank you to you KHDev

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Big delete and new option for rate limiter
« Reply #6 on: August 16, 2015, 02:18:29 PM »
Great, thank you , I just tried it and it works fine ...

I put to flirt_send.php and blog_addedit.php by cons I do not see how to comments profiles, photos and reviews comments blogs because the process is different ...

Does this work? I mean are members submitting their photo, by pressuring them like this? Or do they just give up and not participate in the site?
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

pourkoipas78

  • Prime Member
  • ****
  • Posts: 107
  • Karma: +1/-0
Re: Big delete and new option for rate limiter
« Reply #7 on: August 17, 2015, 07:53:58 AM »
Yes it works, there is more to validate profile pictures... I advise you to only for flirting and comments profile and pictures if they will not participate in website

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Big delete and new option for rate limiter
« Reply #8 on: August 22, 2015, 02:58:24 PM »
I tried doing this with flirts. I works, but recently I've been getting this recurring error..

Undefined index: user_id

Array
(
   
  • => Array

        (
            [file] => /home/server/public_html/mysite.com/flirt_send.php
            [line] => 23
            [function] => error_handler
            [args] => Array
                (
                   
  • => 8
  • [1] => Undefined index: user_id
                        [2] => /home/server/public_html/mysite.com/flirt_send.php
                        [3] => 23
                        [4] => Array
                            (
                               
[GLOBALS] => Array

line 23 has this code
Code: [Select]
$query="SELECT `_photo` as `photo` FROM `{$dbtable_prefix}user_profiles` WHERE `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' ";
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 501
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: Big delete and new option for rate limiter
« Reply #9 on: August 22, 2015, 04:04:41 PM »
I tried doing this with flirts. I works, but recently I've been getting this recurring error..

Undefined index: user_id

Array
(
   
  • => Array

        (
            [file] => /home/server/public_html/mysite.com/flirt_send.php
            [line] => 23
....................................

Hey,

Sorry about that. Its caused by the placement of the code for the photo check. That error will appear when a non-logged in user tries to send a flirt.

To solve it move the photo check code below the check_login_member section:

Code: [Select]
$flirt_type=sanitize_and_format_gpc($_GET,'ft',TYPE_INT,0,0);
if ($flirt_type==FLIRT_INIT) {
check_login_member('flirt_send');
} else {
check_login_member('flirt_reply');
}


######## PHOTO CHECK CODE HERE ########


//// REST OF THE FLIRT CODING HERE ////
$flirts=array();
$query="SELECT `flirt_id`,`flirt_text` FROM `{$dbtable_prefix}flirts` WHERE `flirt_type`=$flirt_type";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
while ($rsrow=mysql_fetch_row($res)) {
$flirts[$rsrow[0]]=$rsrow[1];
}



So essentially by default the photo check code should go below the check_login_member blocks on pages you use it.

pourkoipas78

  • Prime Member
  • ****
  • Posts: 107
  • Karma: +1/-0
Re: Big delete and new option for rate limiter
« Reply #10 on: August 26, 2015, 08:45:39 AM »
Me, these links are not visible to the non-logged  ;)

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Big delete and new option for rate limiter
« Reply #11 on: August 30, 2015, 11:41:27 AM »
I noticed from trying this out that the instructions for message_send.php should be the same as the ones for comment_addedit.php
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: Big delete and new option for rate limiter
« Reply #12 on: August 31, 2015, 12:28:34 AM »
I've added the code into /message_send.php and it works well for me:

Code: [Select]
check_login_member('message_send', 0);
check_login_member('message_write');

[b]######## PHOTO CHECK CODE HERE ########[/b]

$check['friend_only_mess']=get_user_settings($output['fk_user_id'],'def_user_prefs','friend_only_mess');

Members without profile pics will be redirected to photo upload page when they try to send message..

Added the contribution with send messages, flirts, winks and friend request few days ago and until yet can say there are far more new members who complete their profile with photo.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Big delete and new option for rate limiter
« Reply #13 on: August 31, 2015, 07:08:07 AM »
I've added the code into /message_send.php and it works well for me:

Code: [Select]
check_login_member('message_send', 0);
check_login_member('message_write');

[b]######## PHOTO CHECK CODE HERE ########[/b]

$check['friend_only_mess']=get_user_settings($output['fk_user_id'],'def_user_prefs','friend_only_mess');

Members without profile pics will be redirected to photo upload page when they try to send message..

Added the contribution with send messages, flirts, winks and friend request few days ago and until yet can say there are far more new members who complete their profile with photo.

I tried it at that location in message_send.php, but it didn't work on my end. Instead, I had to place it under this line of code:
Code: [Select]
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/comments.inc.php';

When I tried to place it under
Code: [Select]
check_login_member('message_send', 0);
check_login_member('message_write', 0);
check_login_member('message_reply');

Nothing happened
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: Big delete and new option for rate limiter
« Reply #14 on: August 31, 2015, 08:51:11 AM »

I tried it at that location in message_send.php, but it didn't work on my end. Instead, I had to place it under this line of code:
Code: [Select]
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/comments.inc.php';

When I tried to place it under [code]check_login_member('message_send', 0);
check_login_member('message_write', 0);
check_login_member('message_reply');

Nothing happened

will try out your solution, may be its the better option.