Reseller Domain Murah dan termurah di Indonesia? ya di ResellerCamp.
         
 

Forum PHP Indonesia

 
Advanced Search
   
 
Home Register FAQ Memberlist Usergroups  
 
 

Forum PHP Indonesia Forum Index Session & Cookie Tolong bermasalah sm session
Display posts from previous:   
      All times are GMT + 7 Hours  

Tolong bermasalah sm session

Post new topic  Reply to topic

Sun Nov 15, 2009 21:35
Author Message
kunjato
Anak Baru
Anak Baru


Joined: 15 Nov 2009
Posts: 2
Location: Bandung

Post subject: Tolong bermasalah sm session Reply with quote

Cry
tolong sy ada masalah gini


hal cek.php nya
Code:
<?php <?php session_start(); ?>
<html>
<head>
</head>

<body background="images/menu_11.gif">
<?php
mysql_connect
("localhost","root","");
mysql_select_db("samadhi");
$vuser=$_POST['txtuser'];
$vpass=$_POST['txtpass'];

$kueri="select username from admin where username='$vuser' and password='$vpass'";
$hasil=mysql_query($kueri);

$_SESSION['user']=$vuser;
if(
mysql_num_rows($hasil)==1)
{    
    
$_SESSION['user']="admin";
    include(
"index2.php");
}
else
{
    if(
$_SESSION['user']!="")
    {
        include(
"index.php");
    }
    echo(
"<center>"."Login gagal, Periksa kembali Username dan Password anda..."."<center>");
}
?>
</body>
</html> ?>


index.php nya
Code:
<?php <?php session_start ?>
<html>
<head>
</head>
<link href="css/admin-css.css" rel="stylesheet" type="text/css">

<body background="images/menu_11.gif">
<p class="Judul_menu" align="center"><u>ADMINISTRATOR PAGE</u></p>
<?php echo("<a href=logout.php> <h6>Logout</h6> </a>"); ?>
<p>Selamat datang <strong><?php echo($_SESSION['user']); ?></strong></p>
<table border="1" align="left" cellpadding="17" cellspacing="5" class="judulkcl">
    <tr>
        <td align="center"><a href="index2.php?action=produk">Produk</a></td>
    </tr>
    <tr>
        <td align="center"><a href="index2.php?action=testi">Testimonial</a></td>
    </tr>
    <tr>
        <td align="center"><a href="index2.php?action=agen">Agen</a></td>
    </tr>
    <tr>
        <td align="center"><a href="index2.php?action=manfaat">Kandungan & Manfaat</a></td>
    </tr>
    <tr>
        <td align="center"><a href="index2.php?action=ahli">Analisa ahli</a></td>
    </tr>
    <tr>
        <td align="center"><a href="index2.php?action=pesan">Pesan</a></td>
    </tr>
</table>
<table>
    <tr>
        <td>
            <?php
                
if ($_GET['action']==produk)
                {                
                    include(
"admin_produk.php");
                }
                elseif(
$_GET['action']==testi)
                {
                    include(
"testi_admin.php");
                }
                elseif(
$_GET['action']==agen)
                {
                    include(
"agen_admin.php");
                }
                elseif(
$_GET['action']==manfaat)
                {
                    include(
"admin_kandungan-manfaat.php");
                }
                elseif(
$_GET['action']==ahli)
                {
                    include(
"admin_analisa-ahli.php");
                }
                elseif(
$_GET['action']==pesan)
                {
                    include(
"admin_pesan.php");
                }
            
?>
        </td>
    </tr>
</table>
</body>
</html> ?>

gambar di atas itu setelah klik pindah dari index.
halaman index ini banyak pake include untuk pindah halaman,
maaf klo pertanyaan saya ga berbobot,pemula bgt yang ga tau apa"..
mohon pencerahaan nya...
 
View user's profile Send private message
      Back To Top  

Sun Nov 15, 2009 21:55
Author Message
kunjato
Anak Baru
Anak Baru


Joined: 15 Nov 2009
Posts: 2
Location: Bandung

Post subject: Reply with quote

tolong plis master"
 
View user's profile Send private message
      Back To Top  

Mon Nov 23, 2009 02:57
Author Message
togireta_melody
PHPnewbie
PHPnewbie


Joined: 23 Nov 2009
Posts: 8

Post subject: Reply with quote

Masalah diatas gara2 ada output buffer dari session yang dikirim, untuk
ngatasinnya pake ob_start() sama end_ob_flust(), contohnya :


Tambahin aja di depan <? session_start() ?> dengan ob_start(), jadi kodenya :

Code:
<?php <? ob_start(); session_start(); ?> ?>


terus paling bawah web ( footer / pada tag <html> ) tambahin :

Code:
<?php <? end_ob_flush(); ?> ?>
 
View user's profile Send private message Visit poster's website
      Back To Top  

Thu Dec 17, 2009 10:27
Author Message
ipankaris
PHPuser
PHPuser


Joined: 17 Dec 2009
Posts: 30

Post subject: Reply with quote

itu session nya lum di register
harus nya
Code:
<?php session_start();
session_register("username");
session_register("password");

$_SESSION[username]=$vuser;
$_SESSION[password]=$vpass?>


truz tambahin if kalo user nya ber level..
 
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
      Back To Top  

Thu Dec 17, 2009 10:28
Author Message
ipankaris
PHPuser
PHPuser


Joined: 17 Dec 2009
Posts: 30

Post subject: Reply with quote

itu session nya lum di register
harus nya
Code:
<?php session_start();
session_register("username");
session_register("password");

$_SESSION[username]=$vuser;
$_SESSION[password]=$vpass?>


truz tambahin if kalo user nya ber level..

semoga membantu..
 
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
      Back To Top  

Fri Dec 18, 2009 14:23
Author Message
deni_aja
Anak Baru
Anak Baru


Joined: 18 Dec 2009
Posts: 3
Location: Makassar

Post subject: Reply with quote

kyknya mslhnya disini <code><?php <?php session_start(); ?> </code> ... hilangkan spasi sebelum session_start atau sesion_startnya dibuat dibaris baru saja ...
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Sun Jul 18, 2010 00:11
Author Message
musicanda
PHP Master
PHP Master


Joined: 02 Jun 2010
Posts: 263
Location: Rumahnya Angeline

Post subject: Reply with quote

ubah kayak gini kakak...

$arr=mysql_fetch_array($hasil);
$user=$arr['username'];

if(mysql_num_rows($hasil)==1)
{
$_SESSION['user']=$user;
include("index2.php");
}

kalo untuk admin cek terlebih dahulu levelnya... Big Smile
 
View user's profile Send private message Send e-mail Visit poster's website
      Back To Top  
Post new topic  Reply to topic

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


      Back To Top  

Page 1 of 1
Jump to:  
Powered by phpBB © 2001, 2002 phpBB Group
Toko Kaos Couple | Avalanche style by What Is Real © 2004 | Toko Baju Butik Online | Cara Pedia | Busana Baju Muslim