Code Duplication    Length = 26-29 lines in 2 locations

admin/country_manager.php 1 location

@@ 250-278 (lines=29) @@
247
 * @param $country_code
248
 * @param $country_name
249
 */
250
function countrySave($country_id, $country_code, $country_name)
251
{
252
    global $xoopsDB;
253
254
    $myts = MyTextSanitizer::getInstance();
255
    //$country_code=$myts->makeTboxData4Save::$country_code;
256
    //$country_name=$myts->makeTboxData4Save::$country_name;
257
    echo $country_code;
258
    if (!empty($country_id)) {
259
        $sql = 'UPDATE ' . $xoopsDB->prefix('xfguestbook_country') . " SET country_code='$country_code', country_name='$country_name'";
260
        $sql .= " WHERE country_id=$country_id";
261
        $xoopsDB->query($sql);
262
        $messagesent = _AM_XFGB_COUNTRY_UPDATED;
263
    } else {
264
        $sql = sprintf("SELECT COUNT(*) FROM  %s WHERE country_code = '%s'", $xoopsDB->prefix('xfguestbook_country'), $country_code);
265
        list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql));
266
        if ($count > 0) {
267
            $messagesent = '<font color="#FF0000">' . _AM_XFGB_COUNTRY_EXIST . '</font>';
268
        } else {
269
            $country_id = $xoopsDB->genId('country_id_seq');
270
            $sql        =
271
                sprintf("INSERT INTO %s (country_id, country_code, country_name) VALUES (%s, '%s', '%s')", $xoopsDB->prefix('xfguestbook_country'), $country_id, $country_code, $country_name);
272
            $xoopsDB->query($sql);
273
            $messagesent = _AM_XFGB_COUNTRY_ADDED;
274
        }
275
    }
276
    redirect_header('country_manager.php', 2, $messagesent);
277
    exit();
278
}
279
280
function countryShow()
281
{

admin/ip_manager.php 1 location

@@ 101-126 (lines=26) @@
98
 * @param $ip_id
99
 * @param $ip_value
100
 */
101
function badIpSave($ip_id, $ip_value)
102
{
103
    global $xoopsDB;
104
105
    $myts = MyTextSanitizer::getInstance();
106
    //$ip_value=$myts->makeTboxData4Save($ip_value);
107
    if (!empty($ip_id)) {
108
        $sql = 'UPDATE ' . $xoopsDB->prefix('xfguestbook_badips') . " SET ip_id='$ip_id', ip_value='$ip_value'";
109
        $sql .= " WHERE ip_id = $ip_id";
110
        $xoopsDB->query($sql);
111
        $messagesent = _AM_XFGB_BADIP_UPDATED;
112
    } else {
113
        $sql = sprintf("SELECT COUNT(*) FROM  %s WHERE ip_value = '%s'", $xoopsDB->prefix('xfguestbook_badips'), $ip_value);
114
        list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql));
115
        if ($count > 0) {
116
            $messagesent = '<font color="#FF0000">' . _AM_XFGB_BADIP_EXIST . '</font>';
117
        } else {
118
            $country_id = $xoopsDB->genId('ip_id_seq');
119
            $sql        = sprintf("INSERT INTO %s (ip_id, ip_value) VALUES (%s, '%s')", $xoopsDB->prefix('xfguestbook_badips'), $ip_id, $ip_value);
120
            $xoopsDB->query($sql);
121
            $messagesent = _AM_XFGB_BADIP_ADDED;
122
        }
123
    }
124
    redirect_header('ip_manager.php', 2, $messagesent);
125
    exit();
126
}
127
128
function badIpShow()
129
{