Tolong pilih kategori sesuai, jenis posting (pertanyaan atau bukan) dan sertakan tag/topik yang sesuai misal komputer, php, mysql, dll.
Promosi atau posting tidak pada tempatnya akan kami hapus.
Mencantumkan kode program di posting Anda, tolong ikuti aturan yang sesuai, baca http://diskusiweb.com/discussion/39204/aturan-cara-menyisipkan-kode-program-di-diskusiweb

Baca cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Help...Cek login tidak bekerja di host

Mohon petunjuk mastah...cek login sy mendadak tidak bekerja di hosting....awalnya bisa,,sebulan kemudian uda nggak jalan..

ni script cek loginnya

<?php
include "con.php";
error_reporting(0);
$pass=md5($_POST[password]);
$login=mysql_query("SELECT * FROM user WHERE id='$_POST[username]' AND pass='$pass'");
$ketemu=mysql_num_rows($login);
$r=mysql_fetch_array($login);

// Apabila username dan password ditemukan
if ($ketemu > 0){
  session_start();
  session_register("passuser");
  session_register("leveluser");

  $_SESSION[passuser] = $r[password];
  $_SESSION[leveluser]= $r[level];
  header('location:http://localhost/demo/admin/home.php?Wellcome');
}
else{
  echo "<script>window.alert('Username atau Password Salah!!!');
        window.location=('http://localhost/demo/admin/index.php?EROR=Login')</script>";
}
?>


kalu di localhost jalan....

mohon sarannya mastah...

Tanggapan

  • edited July 2014
    elo sudah pernah diminta bikin script kecil buat testing seting server ...

    <?php
    echo 'display_errors = ' . ini_get('display_errors') . "<br>\n";
    echo 'error_reporting = ' . ini_get('error_reporting') . "<br>\n";
    echo 'register_globals = ' . ini_get('register_globals') . "<br>\n";
    echo 'output_buffering = ' . ini_get('output_buffering') . "<br>\n";
    ?>

    jalankan, posting kemari hasilnya



    btw ...

    header('location:http://localhost/demo/admin/home.php?Wellcome');

    window.location=('http://localhost/demo/admin/index.php?EROR=Login')</script>";

    localhost ?
    ini server online ? apa localhost elo ?

    kalo ini server online, elo tetep pake rujukan ke localhost,
    localhost nya siapa ?
  • header('location:http://localhost/demo/admin/home.php?Wellcome');
    window.location=('http://localhost/demo/admin/index.php?EROR=Login')</script>";

    itu localhost mastah...

    kalu yang di server online paswor & username salah dibaca (bekerja scriptnya) tapi kalu pass & username benar script nggak jalan...
  • edited July 2014
    kalu server online mucul ni mastah

    display_errors = 1

    error_reporting = 22519

    register_globals =

    output_buffering =


    yang localhost munculini

    display_errors = 1

    error_reporting = 230719

    register_globals =

    output_buffering =
    1


    mohon saran mastah..........
  • edited July 2014
    [1]
    22519 = 101011111110111

    E_NOTICE elo mati

    [2]
    error_reporting(0);

    tapi percuma juga,
    mau memeriksa ada error apa kalo error reportingnya elo matikan via script

    kalo mau tau ada error apa, hapus baris itu
    atau ganti jadi : error_reporting(E_ALL);
    supaya elo tau ada error di kodingnya
    lalu, posting kemari pesan error yg nungul
  • edited July 2014
    error_reporting(E_ALL); muncul ini mastah

    Notice
    : Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 5

    Warning: session_start(): Cannot send session cache limiter -
    headers already sent (output started at
    /home/gtlo/public_html/gudang/inc/log.php:5) in /home/gtlo/public_html/gudang/inc/log.php on line 13

    Fatal error: Call to undefined function session_register() in /home/gtlo/public_html/gudang/inc/log.php on line 14

    mohon sarannya mastah
  • edited July 2014
    <form> login elo, posting kemari



    dan ini ...

    Fatal error: Call to undefined function session_register() in /home/gtlo/public_html/gudang/inc/log.php on line 14

    ntah elo sudah pernah dikasih tau atau belum ...

    session_register() itu sudah deprecated, sudah kagak perlu dipake

    dan kayanya beneran di disable ama server elo
    jadi fungsi itu beneran jadi tidak ada
    otomatis beneran jadi error, bahkan fatal error, script bakalan mandeg disitu, dan langsung out

    hapus saja
  • edited July 2014
    FORM LOGIN

    <form  name="login" method="post" action="inc/log.php">
      <label>Username </label> : <input name="username" type="text" id="username" size="30" maxlength="30"  " /><br /><br>
      <label>Password </label> : <input name="password" type="password" id="password" size="30" maxlength="30" " /><br><br>
     <input name="btnLogin" type="submit" value="Login" class="button" /><input name="btnLogin" type="reset" value="Reset" class="button" />
    </form>

    ni halaman home bila uda login

    script cek user


    <?php
    include "con.php";
    error_reporting(0);
    session_start();
    if (empty($_SESSION[namauser]) AND empty($_SESSION[passuser])){
      echo "<script>window.alert('MAAF..!! Anda Belum Login..');
            window.location=('http://............//index.php?EROR=Login')</script>";           
    }
    else{
    ?>
  • edited July 2014
    session_register() sudah dihapus ?



    lalu ini :

    Notice: Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 5

    biasakan menulis index array berupa string pake '...' (quote)

    jadi : $_POST['index'] ... bener
    bukan cuma : $_POST[index] ... salah

    lalu jika digabung dgn string, biasakan pake operator DOT (titik)
    dan biasakan menulis string pake '...' (single quote), bukan "..." (double quote)

    jadi : 'ini string ' . $var . ' digabung dgn variable array ' . $array['index'] . ' pake operator dot'
    bukan : "ini string $var digabung dgn variable array $array[index] tanpa operator dot"



    kalo sudah kagak ada laporan error dari php
    silakan elo matikan lagi error reporting nya
  • yang di hapus session_register()
    apa yang sy tandai ini

    <?php
    include "con.php";
    error_reporting(0);
    $pass=md5($_POST[password]);
    $login=mysql_query("SELECT * FROM user WHERE id='$_POST[username]' AND pass='$pass'");
    $ketemu=mysql_num_rows($login);
    $r=mysql_fetch_array($login);

    // Apabila username dan password ditemukan
    if ($ketemu > 0){
      session_start();

      session_register("passuser");............yg ini

      session_register("leveluser");......yg ini

      $_SESSION[passuser] = $r[password];
      $_SESSION[leveluser]= $r[level];
      header('location:http://............../home.php?Wellcome');
    }
    else{
      echo "<script>window.alert('Username atau Password Salah!!!');
            window.location=('http://................/admin/index.php?EROR=Login')</script>";
    }
    ?>

    klau yg itu muncul pesan ni

    Notice: Use of undefined constant passuser - assumed 'passuser' in /home/gtlo/public_html/gudang/inc/log.php on line 16

    Notice: Use of undefined constant leveluser - assumed 'leveluser' in /home/gtlo/public_html/gudang/inc/log.php on line 17

    Warnin: Cannot modify header information - headers already sent
    by (output started at
    /home/gtlo/public_html/gudang/inc/log.php:16) in /home/gtlo/public_html/gudang/inc/log.php on line 18



  • edited July 2014
    ya pasti session_register() yg itu to mas ...
    emang di koding elo ada session_register() yg lain ?



    pertanyaan elo yg lain juga sudah gw jawab semua :
    lalu ini :

    Notice: Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 5

    biasakan menulis index array berupa string pake '...' (quote)

    jadi : $_POST['index'] ... bener
    bukan cuma : $_POST[index] ... salah

    lalu jika digabung dgn string, biasakan pake operator DOT (titik)
    dan biasakan menulis string pake '...' (single quote), bukan "..." (double quote)

    jadi : 'ini string ' . $var . ' digabung dgn variable array ' . $array['index'] . ' pake operator dot'
    bukan : "ini string $var digabung dgn variable array $array[index] tanpa operator dot"
  • edited July 2014
    ADUH MASTAH TETAP NGGAK JALAN

    BILA DIHAPUS session_register()
    MUNCUL PESAN

    Notice: Use of undefined constant passuser - assumed 'passuser' in /home/gtlo/public_html/gudang/inc/log.php on line 14

    Notice: Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 14

    Notice: Use of undefined constant leveluser - assumed 'leveluser' in /home/gtlo/public_html/gudang/inc/log.php on line 15

    Notice: Use of undefined constant level - assumed 'level' in /home/gtlo/public_html/gudang/inc/log.php on line 15

    Warning: Cannot modify header information - headers already sent
    by (output started at
    /home/gtlo/public_html/gudang/inc/log.php:14) in /home/gtlo/public_html/gudang/inc/log.php on line 16


    MOHON sarannya mastah..thank
  • edited July 2014
    MUNCUL PESAN

    Notice: Use of undefined constant passuser - assumed 'passuser' in /home/gtlo/public_html/gudang/inc/log.php on line 14

    Notice: Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 14

    Notice: Use of undefined constant leveluser - assumed 'leveluser' in /home/gtlo/public_html/gudang/inc/log.php on line 15

    Notice: Use of undefined constant level - assumed 'level' in /home/gtlo/public_html/gudang/inc/log.php on line 15

    Warning: Cannot modify header information - headers already sent
    by (output started at
    /home/gtlo/public_html/gudang/inc/log.php:14) in /home/gtlo/public_html/gudang/inc/log.php on line 16


    MOHON sarannya mastah..thank
    yg elo tanyakan itu sudah gw jawab semuaaaaaaaaaa ...
    masa kagak paham to maaaassss ????
    Notice: Use of undefined constant password - assumed 'password' in /home/gtlo/public_html/gudang/inc/log.php on line 5

    biasakan menulis index array berupa string pake '...' (quote)

    jadi : $_POST['index'] ... bener
    bukan cuma : $_POST[index] ...
    salah

    lalu jika digabung dgn string, biasakan pake operator DOT (titik)
    dan biasakan menulis string pake '...' (single quote), bukan "..." (double quote)

    jadi : 'ini string ' . $var . ' digabung dgn variable array ' . $array['index'] . ' pake operator dot'
    bukan : "ini string $var digabung dgn variable array $array[index] tanpa operator dot"
    elo baca apa to dari yg gw BOLD dan besarkan huruf nya ?
  • Mohon maaf Mastah
    ane  cuma ini aja
     $_SESSION['passuser'] = $r[password];
      $_SESSION['leveluser']= $r[level];

    nanti semuanya di pakai quote

     $_SESSION['passuser'] = $r['password'];
      $_SESSION['leveluser']= $r['level'];

    terima kasih atas sarannya mastah ...script udah jalan THANKS

    =D> =D> :)>-
  • ya, sudah bener
  • ya, sudah bener
    Thanks MASTER BADAK
Sign In or Register to comment.