Author Topic: [MOD] Limit of 20 images per day to unregistred users  (Read 17991 times)

0 Members and 1 Guest are viewing this topic.

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
[MOD] Limit of 20 images per day to unregistred users
« on: February 08, 2007, 02:59:46 AM »
Code: [Select]
Hi.
I want a modification that limits the views of images to 20 to all unregistred users.

I'm trying to adapt an other mod of this forum but I'm not a PHP guru... so I would need you to help me.

// Step 1

In root dir create : install_user_limits.php.

Insert :
[code]

<?php
session_start
();
define('ROOT_PATH''./');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'global.php');
include(
ROOT_PATH.'includes/constants.php');
require(
ROOT_PATH.'includes/sessions.php');

if (!isset(
$_SESSION[&#8216;count&#8217;]))
{
$_SESSION[&#8216;count&#8217;]=0;
}

$error_log = array();
$error_msg "";

if (
$action == "modinstall") {

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
  <link rel="stylesheet" href="admin/cpstyle.css">
  <title>4images Installer</title>
</head>
<body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20" bgcolor="#FFFFFF">
  <table cellpadding="0" cellspacing="0" border="0" width="500" align="center">
    <tr><td class="tableborder"><img src="admin/images/logo_installer.gif" width="500" height="45"><br />
        <table cellpadding="3" cellspacing="1" border="0" width="100%">
          <tr class="tablerow2"><td><b>User Upload Limits MOD</b>&nbsp;&nbsp;&nbsp;&nbsp;(by Silly Little Lamer)</td></tr>
          <tr class="tablefooter"><td align="center">&nbsp;</td></tr>
  </table>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
  <tr class="tablerow"><td colspan="2" align="right"></td></tr>
  <tr class="tablerow2"><td colspan="2"><br /><blockquote>

<?php
&#160; &#160; $sql = "INSERT INTO ".SETTINGS_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; (".get_user_table_field("", "setting_name").get_user_table_field(", ", "setting_value").")
&#160; &#160; &#160; &#160; &#160; &#160; VALUES
&#160; &#160; &#160; &#160; &#160; &#160; ('default_upload_limit', $default_limit".$additional_value_sql.")";
&#160; &#160; &#160; &#160;&#160; if (!$site_db->query($sql)) {
&#160; &#160; &#160; &#160;&#160; $error_log[] = $sql;
}
$fldname "user_limit";
&
#160; &#160; $sql = "ALTER TABLE ".USERS_TABLE."
&#160; &#160;  ADD $fldname SMALLINT(3) DEFAULT $default_limit NOT NULL";
&#160; &#160; &#160; &#160;&#160; if (!$site_db->query($sql)) {
&#160; &#160; &#160; &#160;&#160; $error_log[] = $sql;
&#160; &#160; &#160; &#160;&#160; }
&#160; &#160; if (empty($error_log)) { echo "<h4>Database update success!</h4>"; }
?>

  </blockquote></td></tr>
 <tr class="tablefooter"><td colspan="2">&nbsp;</td></tr>
        </table>
      </td>
    </tr>
  </table>
</table>
<p align="center"> Powered by <b>4images</b> <?php echo SCRIPT_VERSION ?><br />Copyright &copy; 2002 <a href=" " target="_blank"> </a>
</body>
</html>
<?php
exit;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
  <link rel="stylesheet" href="admin/cpstyle.css">
  <title>4images Installer</title>
</head>
<body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20" bgcolor="#FFFFFF">
<form action="install_user_limits.php" name="form" method="post">

  <table cellpadding="0" cellspacing="0" border="0" width="500" align="center">
    <tr><td class="tableborder"><img src="admin/images/logo_installer.gif" width="500" height="45"><br />
        <table cellpadding="3" cellspacing="1" border="0" width="100%">
          <tr class="tablerow2"><td><b>User Upload Limits MOD</b>&nbsp;&nbsp;&nbsp;&nbsp;(by Silly Little Lamer)</td></tr>
          <tr class="tablefooter"><td align="center">&nbsp;</td></tr>
  </table>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
  <tr class="tablerow"><td colspan="2" align="right"></td></tr>
  <tr class="tablerow2"><td colspan="2"><center>
  This script will modify your 4images database, so please<br><b>
  <font color="#FF0000">ALWAYS BACKUP YOUR DATABASE BEFORE RUNNING THIS MOD!</b></font><br><br>
  Please check out all fields shown below.<br>
  If they do not correspond to your settings, please<br><b>DO NOT START INSTALLER</b>!
  </center></td></tr>
  <tr class="tableheader"><td colspan="2"><b><span class="tableheader">Database configuration</span></b></td></tr>
  <tr class="tablerow"><td>Database server type</td><td><?php echo $db_servertype?></td></tr>
  <tr class="tablerow2"><td>Database server hostname</td><td><?php echo stripslashes($db_host); ?></td></tr>
  <tr class="tablerow"><td>Database name</td><td><?php echo stripslashes($db_name); ?></td></tr>
  <tr class="tablerow2"><td>Prefix for tables in database</td><td><?php echo stripslashes($table_prefix); ?></td></tr>
  <tr class="tableheader"><td colspan="2"><span class="tableheader">Limit settings</span></td></tr>

 <tr class="tablerow"><td>Default upload limit (number of images) to be assigned for all new and existing users.
  This could be changed in 4images Control Panel later.</td><td><input type="text" name="default_limit" value="5"></td></tr>
  <input type="hidden" name="action" value="modinstall">
 <tr class="tablefooter"><td colspan="2"><center><input type="submit" value="Start modify database" class="button" name="submit"></center></td></tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<p align="center"> Powered by <b>4images</b> <?php echo SCRIPT_VERSION ?><br />Copyright &copy; 2002 <a href="http://www.4homepages.de" target="_blank">4homepages.de</a>
</body>
</html>
// Step 2

In member.php,

find :
Code: [Select]

if ($action == "uploadform") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }

replace to :
Code: [Select]

//-----------------------------------------------------
// --- Check User Limits ------------------------------
//-----------------------------------------------------

$user_id = $user_info['user_id'];

$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['file_upload_error']."</span>";

$site_template->register_vars(array(
"clickstream" => $clickstream,
"lang_no_limits" => $lang['no_limits'],
"lang_no_limits_text" => $lang['no_limits_text'],
"lang_already_loaded" => $lang['already_loaded'],
"lang_show_my_images" => $lang['show_my_images'],
"url_show_user_images" => $site_sess->url(ROOT_PATH."search.php?search_user=".$user_info['user_name'])
));


function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);

$site_template->register_vars("upload_limit", $upload_limit);

$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);

// $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
// $result = $site_db->query($sql);
// $tmp_images_per_user = $site_db->get_numrows($result);
// $images_per_user = $tmp_images_per_user + $images_per_user;

// Uncomment above four lines if you also want to check uploaded but not yet validated images against the user limit

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

if ($action == "uploadform") {
 if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
  show_error_page($lang['no_permission']);
  exit;
 }

if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
// if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {

//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//

$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}
// Step 3

In register.php ,

find :
Code: [Select]

$sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
            VALUES
            ($user_id, $user_level, '$user_name', '".md5($user_password)."', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";
replace to :
Code: [Select]

$user_limit= $config['default_upload_limit'];
    $sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").(", ").('user_limit').$additional_field_sql.")
            VALUES
            ($user_id, $user_level, '$user_name', '".md5($user_password)."', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', $user_limit".$additional_value_sql.")";
// Step 4

In admin/users.php,

find :
Code: [Select]

$user_icq = (intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "";
Insert bellow :
Code: [Select]
$user_limit = intval($HTTP_POST_VARS['user_limit']);
Then, find :
Code: [Select]

$sql = "UPDATE ".USERS_TABLE."
            SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
            WHERE ".get_user_table_field("", "user_id")." = $user_id";

replace to :
[code]

$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq', user_limit='".$user_limit."'".$additional_sql."
            WHERE ".get_user_table_field("", "user_id")." = $user_id";
Then, find :
Code: [Select]

      $sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
                VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";
replace to :
Code: [Select]

      $sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").(", user_limit").$additional_field_sql.")
                VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', $user_limit".$additional_value_sql.")";
Then, find :
Code: [Select]

show_input_row($lang['field_icq'], "user_icq", $user_row['user_icq'], $textinput_size);
Insert above :
Code: [Select]

show_input_row($lang['field_limit'], "user_limit", $user_row['user_limit']);
// Step 4

In admin/settings.php,

find :
Code: [Select]

show_setting_row("max_media_size");
Insert above :
Code:

show_setting_row("default_upload_limit");

// Step 5

In lang/english/admin.php,

find :
Code: [Select]

$setting['max_media_size'] = "Max. image size in KB";
inserir to baixo :
Code: [Select]

$setting['default_upload_limit'] = "Maximum number of images to upload<br /><span class=\"smalltext\">This value will be assigned to all new users as a default limit.</span>";
Then, find :
Code: [Select]

$lang['field_usergroup_name'] = "Name of User Group";
add below :
Code: [Select]

$lang['field_limit'] = "Maximum number of images to upload";
// Step 5

In lang/english/main.php,

find :
Code: [Select]

//-----------------------------------------------------
//--- Admin Links -------------------------------------
//-----------------------------------------------------
Insert above :
Code: [Select]

//-----------------------------------------------------
//--- Over Limits -------------------------------------
//-----------------------------------------------------

$lang['show_my_images'] = "You have uploaded {images_per_user} images to this site. Show all images uploaded by you?";
$lang['already_loaded'] = "<span class=\"smalltext\"><b>For your information:</b> you have uploaded <b>{images_per_user}</b> images out of <b>{upload_limit}</b> allowed for you.</span>";
$lang['no_limits'] = "Limit exceeded";
$lang['no_limits_text'] = "You have the limit of {upload_limit} images to upload to this site, and unfortunately you have reached this limit already.
You are not allowed to upload new images, but you still have the possibility to delete one or more of the images,
already uploaded by you. After that you will be able to upoad images here again.<br /><br />
If you feel, that it's absolutely neccessary for you to upload more images, please contact the <a href=\"mailto:{site_email}\">
Site Administrator.</a> Probably, your limits would be reconsidered...";
// Step 6

In templates/<your_template> create: over_limit.html.

Inserir :
Code: [Select]

{header}
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td colspan="4"><img src="{template_url}/images/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="640" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="638" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td height="23" class="navbar">
                  <table width="636" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right"><a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;</td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="638" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" valign="top" class="row2">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box} </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" width="18" height="18" alt="" /></td>
                <td width="450" valign="top"><br />
                  <b class="title">{lang_no_limits}</b>
                  <hr size="1" />
                  <p>{lang_no_limits_text}</p>
         <$php         if ($_SESSION[‘count’]!=5)
{$>
<a href="{url_show_user_images}">{lang_show_my_images}</a>
$_SESSION[‘count’]++
<$php }$>
<br /><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>{category_dropdown_form}</td>
                      <td align="right">{setperpage_dropdown_form}</td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </td>
                <td width="20" valign="top"><img src="{template_url}/images/spacer.gif" width="19" height="19" alt="" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6"><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}
[/code][/code]
« Last Edit: February 08, 2007, 03:16:03 AM by son_gokou »

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #1 on: February 08, 2007, 09:58:16 AM »
i am gonna give this a try and can u tell me where is the :D limit we can change like 20 to may be 3 or something

Offline drastx

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #2 on: February 08, 2007, 12:55:46 PM »
Hey :)

I tried this one, and it doesn't work - don't show anything (in cp too) :|
I have 1.7.2 version of 4images.

I need this mod working  :oops:

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #3 on: February 08, 2007, 06:14:03 PM »
When installing this mod it appears the place where we can choose the number of images.

This was made originally for limit the upload to any users and I'm trying to adapt to limit the views of unregistred users.
Any help? Guess?

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistered users
« Reply #4 on: February 23, 2007, 10:03:35 AM »
CAN Any one can get this mod working please!!!
It is an great MOD as you force only those users who are really interested in going throughout the whole site rather than just a pass by visitors thus creating an database of genuine users .

Any one ??
V@no  :)

Offline drastx

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #5 on: February 23, 2007, 03:37:12 PM »
Yeah, please :)
This will be superb :)

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #6 on: February 23, 2007, 03:38:30 PM »
Really great. I think I canīt do it all alone :|

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #7 on: February 24, 2007, 12:24:45 PM »
 :( any PHP guru around this MOD looks very promising !!!
V@no where are you .....   :o

Offline drastx

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #8 on: February 27, 2007, 06:32:02 AM »
I've PM'ed to V@no but he did'nt answer yet  :cry:

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #9 on: March 01, 2007, 07:06:59 AM »
I've PM'ed to V@no but he did'nt answer yet  :cry:

V@no Last Active:     November 03, 2006
Probably because he was getting to many PM's   :wink:

Offline drastx

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #10 on: March 01, 2007, 02:16:00 PM »
I've PM'ed to V@no but he did'nt answer yet  :cry:

V@no Last Active:     November 03, 2006
Probably because he was getting to many PM's   :wink:

Yeah, i saw that before...
Why he left ?:(
Is there anybody who can write this ?

Offline drastx

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #11 on: March 03, 2007, 12:01:40 PM »
Refreshing.

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #12 on: March 20, 2007, 03:23:53 AM »
Ok... I've done it to limit to 5 images per day ;)


In details.php insert after include(ROOT_PATH.'includes/page_header.php');

The following code

Code: [Select]
if ($user_info['user_level'] == GUEST){
if(isset($_COOKIE['viz']))
{
$num_viz_actual = $_COOKIE['viz'];
$num_viz_acrescentar = $num_viz_actual + "1";
$duracao = 60 * 60 * 24 + time();
setcookie("viz","",time() -3600);
setcookie("viz",$num_viz_acrescentar, $duracao);
}
elseif(!isset($_COOKIE['viz'])){
setcookie("viz","1",$duracao);}

if($num_viz_actual >= "5"){
header("location:http://www.yoururl/index.php?template=Please%20Register");
}
}

Then create Please Register.html with a message saying that the user has to register to continue seeing images.

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #13 on: March 29, 2007, 02:46:22 PM »
Hui, very simpel, very good!

Thanks!!!!!!!!!!!!!!!!!!!!!!
4images in Benutzung/use seit/since 2002 / Version 1.7.6

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Limit of 20 images per day to unregistred users
« Reply #14 on: March 29, 2007, 04:13:11 PM »
Thanks thanks :)