v2.5.2
Giriş yap

PHP döngü yapmadığım halde kendinden döngü oluyor

omerfarukbicer
987 defa görüntülendi ve 1 kişi tarafından değerlendirildi

hocalarım merhaba benim php de basicdb ile bir kayıt ekleme
sayfam var daha doğrusu kayıt olma Cibza Kayit Olma Sayfası
buradan kayıt olusanız sonsayfada kendiliğinden bir dönguye giriyor ve 40 defa aynı kisiyi kaydediyor
nedenini anlamadım

ilgili kod

<?php

  session_set_cookie_params(360000,'/','.cibza.com');
  session_start();
  ob_start();
  require 'basicdb.php';
  $db = new CibzaDB('localhost' , 'cibzacom_accounts' , 'cibzacom_accounts' , '05302280aA05302280');
  if(isset($_GET['contiune'])){
    $contiune = '?contiune='.$_GET['contiune'];
  }else {
    $contiune = '';
  }

  if (!isset($_SESSION['createpassword_next'])) {
    header('Location: https://www.cibza.com/');
  }
    // BURASI HATALI KODUN BAŞLANGICI
  if (isset($_SESSION['cibza_accounts_pass']) && isset($_SESSION['cibza_accounts_repass'])) {
    $password = sha1(md5(sha1($_SESSION['cibza_accounts_pass'])));
    $repassword = sha1(md5(sha1($_SESSION['cibza_accounts_repass'])));

    if ($password == $repassword) {
      $name = $_SESSION['signup_form_value']['cibza_accounts_name'];
      $surname = $_SESSION['signup_form_value']['cibza_accounts_surname'];
      $email = $_SESSION['signup_form_value']['cibza_accounts_email'];

      // $color = substr(md5(uniqid()) ,0 ,6);
      // $url = 'https://ui-avatars.com/api/?size=128&font-size=0.6&length=1&background='.$color.'&bold=true&color=ffffff&name=' . $name . ' ' . $surname;
      // // Resim Yolu(Kayıt yolu)
      // $uniqid = uniqid();
      // $img = '../../assets/usercontent/'.sha1(md5(sha1(md5($uniqid)))).'.png';
      // // Resmi Kaydet
      // file_put_contents($img, file_get_contents($url));

      $insert_accounts = $db->insert('accounts')
                            ->set([
                              'accounts_first_name' => $name,
                              'accounts_last_name' => $surname,
                              'accounts_email' => $email,
                              // 'accounts_user_images' => sha1(md5(sha1(md5($uniqid)))).'.png',
                              'accounts_password' => $password
                            ]);

        if ($insert_accounts){
          if ($contiune == '') {
            header('Location: https://www.cibza.com');
          }else {
            header('Location: ' . $contiune);
          }
        }else {
          $_SESSION['sc_error'] = true;
          header('Location: createpassword.php' . $contiune);
        }
    }else {
      $_SESSION['createpassword_error'] = true;
      header('Location: createpassword.php' . $contiune);
    }

  }else {
    header('Location: createaccount.php' . $contiune);
  }
  unset($_SESSION['createpassword_next']);
 ?>

tayfun hocam siz yapıştirdıysanız teşekkürler

omerfarukbicer
1272 gün önce

yok bu createpassword 2 sayfadan oluşuyor biri controller-createpassword.php biri ise createpassword.php email isim ve soyisim createaccount.php den geliyor yani tüm bilgiler sessiondan geliyor hocam kayıt eklemede bir sıkıntı yok sadece aynı kayıdı 40 kere ekliyor ve sayfa hata veriyor