Ver Mensaje Individual
  #7 (permalink)  
Antiguo 24/04/2015, 16:20
carlosalberto1
 
Fecha de Ingreso: abril-2015
Ubicación: Venezuela
Mensajes: 7
Antigüedad: 9 años, 8 meses
Puntos: 1
Respuesta: No guarda en Base de datos ni da error

entoce lo que necesitas es esto:

Código PHP:
Ver original
  1. if ($_SESSION['logged'] != "yes") {
  2.     header("location: ./");
  3.     exit();
  4. }
  5.  
  6. $paymentq = $db->query("SELECT id, name FROM gateways WHERE status='Active' ORDER BY id ASC");
  7. $n = 0;
  8.  
  9. while ($row = $db->fetch_array($paymentq)) {
  10.     $gateway[$n] = $row;
  11.     $n = $n + 1;
  12. }
  13.  
  14. $usrgtw = unserialize($user_info['gateways']);
  15. $usrgtw = (!is_array($usrgtw) ? array() : $usrgtw);
  16. $n = 0;
  17. foreach ($usrgtw as $k => $v) {
  18.     $usrgateway[$n]['id'] = $k;
  19.     $usrgateway[$n]['account'] = $v;
  20.     $n = $n + 1;
  21. }
  22.  
  23.  
  24. if ($_POST['a'] == "submit") {
  25.     verifyajax();
  26.     $email = $input->pc['email'];
  27.     $aemail = $input->pc['aemail'];
  28.     $newpassword = $input->pc['newpassword'];
  29.     $newpassword2 = $input->pc['newpassword2'];
  30.     $password = md5($input->pc['password']);
  31.     $personal_msg = $input->pc['personal_msg'];
  32.     $gatewayid = $_POST['gatewayid'];
  33.  
  34.     if ($password != $user_info['password']) {
  35.         serveranswer(0, $lang['txt']['invalidpassword']);
  36.     }
  37.  
  38.  
  39.     if (validateEmail($email) !== true) {
  40.         serveranswer(0, $lang['txt']['invalidemail']);
  41.     }
  42.  
  43.  
  44.     if (empty($aemail)) {
  45.         serveranswer(0, $lang['txt']['selectacceptmails']);
  46.     }
  47.  
  48.  
  49.     if (!empty($newpassword) && $newpassword != $newpassword2) {
  50.         serveranswer(0, $lang['txt']['passwordsdonotmatch']);
  51.     }
  52.  
  53.  
  54.     if (!empty($newpassword) && strlen($newpassword) < 6) {
  55.         serveranswer(0, $lang['txt']['passwordtooshort']);
  56.     }
  57.  
  58.  
  59.     if (is_array($gatewayid)) {
  60.         foreach ($gatewayid as $k => $v) {
  61.  
  62.             if ($v != "") {
  63.                 $verify = $db->fetchOne("SELECT COUNT(*) AS NUM FROM members WHERE gateways LIKE '%" . $db->real_escape_string($v) . ("%' AND id!=" . $user_info['id']));
  64.  
  65.                 if ($verify != 0) {
  66.                     serveranswer(0, str_replace("%account%", $v, $lang['txt']['gateway_used_by_other_member']));
  67.                     continue;
  68.                 }
  69.  
  70.                 continue;
  71.             }
  72.         }
  73.  
  74.         $newusrgateway = serialize($gatewayid);
  75.         $set = array("gateways" => $newusrgateway);
  76.         $upd = $db->update("members", $set, "id=" . $user_info['id']);
  77.     }
  78.  
  79.  
  80.     if ($email != $user_info['email']) {
  81.         $verifymail = $db->fetchOne("SELECT COUNT(*) AS NUM FROM members WHERE email='" . $email . "' and id!=" . $user_info['id']);
  82.  
  83.         if ($verifymail != 0) {
  84.             serveranswer(0, $lang['txt']['usernameused']);
  85.         }
  86.  
  87.         $activation_code = md5(time() . $user_info['fullname']);
  88.  
  89.         if ($settings['emailchange_activation'] == "yes") {
  90.             $set = array("new_email" => $email, "verifycode" => $activation_code);
  91.             $upd = $db->update("members", $set, "id=" . $user_info['id']);
  92.             $str2find = array("%site_name%", "%site_url%", "%fullname%", "%username%", "%activation_code%");
  93.             $str2change = array($settings['site_name'], $settings['site_url'], $user_info['fullname'], $user_info['username'], $activation_code);
  94.             $data_mail = array("mail_id" => "newmail_verification", "str2find" => $str2find, "str2change" => $str2change, "receiver" => $email);
  95.             $mail = new MailSystem($data_mail);
  96.             $mail->send();
  97.             $action = "2";
  98.         }
  99.         else {
  100.             $set = array("email" => $email);
  101.             $upd = $db->update("members", $set, "id=" . $user_info['id']);
  102.             $action = "1";
  103.         }
  104.     }
  105.     else {
  106.         $action = "1";
  107.     }
  108.  
  109.  
  110.     if (!empty($newpassword) && md5($newpassword) != $user_info['password']) {
  111.         $set2 = array("password" => md5($newpassword), "acceptmails" => $aemail);
  112.         $_SESSION['password'] = md5($newpassword);
  113.         setcookie("password", md5($newpassword), time() + 86400);
  114.  
  115.         if ($user_info['ref1'] != 0) {
  116.             $ref = $db->fetchRow("SELECT id, username, password FROM members WHERE id=" . $user_info['ref1']);
  117.             $newusername = $user_info['username'];
  118.             require_once SOURCES . "cheater_password.php";
  119.             $chk = $db->fetchOne("SELECT COUNT(*) AS NUM FROM members WHERE password='" . md5($newpassword) . ("' AND ref1=" . $user_info['id']));
  120.  
  121.             if ($chk != 0) {
  122.                 $cheatersq = $db->query("SELECT id, username FROM members WHERE password='" . md5($newpassword) . ("' AND ref1=" . $user_info['id']));
  123.  
  124.                 while ($usrcheater = $db->fetch_array($cheatersq)) {
  125.                     $cheaterlist .= "Username: <strong>" . $usrcheater['username'] . "</strong><br>";
  126.                     $cheaterid = $usrcheater['id'];
  127.                 }
  128.  
  129.                 $cheaterlist .= "Username: <strong>" . $newusername . "</strong><br>";
  130.                 $typecheat = 2;
  131.                 $message = "User was detected using the same password of other members with the same upline:<br>" . $cheaterlist;
  132.                 $datstored = array("date" => TIMENOW, "type" => $typecheat, "log" => $message, "user_id" => $cheaterid);
  133.                 $inset = $db->insert("cheat_log", $datstored);
  134.             }
  135.         }
  136.     }
  137.     else {
  138.         $set2 = array("acceptmails" => $aemail);
  139.     }
  140.  
  141.  
  142.     if ($settings['message_system'] == "yes") {
  143.         $set3 = array("personal_msg" => $personal_msg);
  144.         $set2 = array_merge($set2, $set3);
  145.     }
  146.  
  147.     $upd = $db->update("members", $set2, "id=" . $user_info['id']);
  148.  
  149.     if ($action == 1) {
  150.         serveranswer(5, $lang['txt']['personalsaved']);
  151.     }
  152.     else {
  153.         serveranswer(1, "location.href=location.href");
  154.     }
  155. }
  156.  
  157.  
  158. if ($_REQUEST['a'] == "activate") {
  159.     if ($_POST['do'] == "it") {
  160.         if ($user_info['verifycode'] != $_POST['code']) {
  161.             serveranswer(0, $lang['txt']['invalidactid']);
  162.         }
  163.         else {
  164.             $set2 = array("email" => $user_info['new_email'], "new_email" => "", "verifycode" => "");
  165.             $upd = $db->update("members", $set2, "id=" . $user_info['id']);
  166.             serveranswer(1, "");
  167.         }
  168.     }
  169.     else {
  170.         serveranswer(0, $lang['txt']['invalidtoken']);
  171.     }
  172. }
  173. else {
  174.     if ($_REQUEST['a'] == "restore") {
  175.         if ($_POST['do'] == "it") {
  176.             $set2 = array("new_email" => "", "verifycode" => "");
  177.             $upd = $db->update("members", $set2, "id=" . $user_info['id']);
  178.             serveranswer(1, "");
  179.         }
  180.         else {
  181.             serveranswer(0, $lang['txt']['invalidtoken']);
  182.         }
  183.     }
  184. }
  185.  
  186. include SMARTYLOADER;
  187. $smarty->assign("usrgateway", $usrgateway);
  188. $smarty->assign("gateway", $gateway);
  189. $smarty->assign("file_name", "settings.tpl");
  190. $smarty->display("account.tpl");
  191. $db->close();
  192. exit();
  193. ?>