} if ($success) { $ipaddr = $_SERVER['REMOTE_ADDR']; if (UserBanned::exists(0, array(), "(email='{$p_email}' OR ipaddr='{$ipaddr}')")) { $last = 666666; } else { $postedon = date("Y-m-d H:i:s", time()); $expiry = date("Y-m-d", time() + $p_expiry * 24 * 60 * 60); $code = md5(uniqid(rand(), true)); if (User::is_logged_in()) { $p_name = User::get_name(); $p_email = User::get_email(); } $last = Ad::create(array('user_id' => User::get_id(), 'name' => $p_name, 'email' => $p_email, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'picture' => $p_picture, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'expiry' => $expiry, 'webpage' => $p_webpage, 'code' => $code, 'ipaddr' => $ipaddr, 'postedon' => $postedon, 'lastmodified' => $postedon)); if (User::is_logged_in()) { Ad::activate($last); } else { if (!($user_exists = User::exists(0, array('email' => $p_email)))) { $p_em = explode('@', $p_email); $username = substr($p_em[0], 0, 6); $active = 0; $createdon = date("Y-m-d H:i:s", time()); $password = substr($code, 0, 6); $userid = User::create(array('email' => $p_email, 'username' => $username, 'password' => $password, 'name' => $p_name, 'active' => $active, 'createdon' => $createdon, 'ipaddr' => $ipaddr, 'code' => $code)); $registration_message = StaticContent::get_content('user-registration-email'); eval("\$registration_message = \"{$registration_message}\";"); } else { $user = User::get_one(0, array('email' => $p_email)); $username = $user['username']; } $ad_activation_message = StaticContent::get_content('ad-activation-email');
<?php /** * Classified-ads-script * * @copyright Copyright (c) Szilard Szabo * @license GPL v3 * @package Frontend */ include "./admin/include/common.php"; $g_id = isset($_GET['id']) ? (int) $_GET['id'] : 0; $g_code = isset($_GET['code']) ? trim(strip_tags($_GET['code'])) : ''; $success = true; $errors = array(); if ($g_id < 1) { $success = false; } if ($g_code == '') { $success = false; } if ($success) { if (!Ad::activate($g_id, $g_code)) { $success = false; } } include "./templates/ad-activation.php";