| |
Forum PHP IndonesiaDapatkan pertolongan pertama pada kebingungan PHP dan sekitarnya |
|
|
|
|
|
| |
|
|
All times are GMT + 7 Hours
|
|
Tolong bermasalah sm session
 |
Sun Nov 15, 2009 21:35 |
 |
Author |
Message |
kunjato Anak Baru

Joined: 15 Nov 2009 Posts: 2 Location: Bandung
|
| Post subject: Tolong bermasalah sm session |
|
|
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... |
|
| |
|
|
 |
Sun Nov 15, 2009 21:55 |
 |
Author |
Message |
kunjato Anak Baru

Joined: 15 Nov 2009 Posts: 2 Location: Bandung
|
| Post subject: |
|
|
| tolong plis master" |
|
| |
|
|
 |
Mon Nov 23, 2009 02:57 |
 |
Author |
Message |
togireta_melody PHPnewbie

Joined: 23 Nov 2009 Posts: 8
|
| Post subject: |
|
|
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(); ?> ?> |
|
|
| |
|
|
 |
Thu Dec 17, 2009 10:27 |
 |
Author |
Message |
ipankaris PHPuser

Joined: 17 Dec 2009 Posts: 30
|
| Post subject: |
|
|
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.. |
|
| |
|
|
 |
Thu Dec 17, 2009 10:28 |
 |
Author |
Message |
ipankaris PHPuser

Joined: 17 Dec 2009 Posts: 30
|
| Post subject: |
|
|
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.. |
|
| |
|
|
 |
Fri Dec 18, 2009 14:23 |
 |
Author |
Message |
deni_aja Anak Baru

Joined: 18 Dec 2009 Posts: 3 Location: Makassar
|
| Post subject: |
|
|
| kyknya mslhnya disini <code><?php <?php session_start(); ?> </code> ... hilangkan spasi sebelum session_start atau sesion_startnya dibuat dibaris baru saja ... |
|
| |
|
|
 |
Sun Jul 18, 2010 00:11 |
 |
Author |
Message |
musicanda PHP Master


Joined: 02 Jun 2010 Posts: 263 Location: Rumahnya Angeline
|
| Post subject: |
|
|
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...  |
|
| |
|
|
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
|
|
|
|
|
|
|
|
Powered by phpBB © 2001, 2002 phpBB Group
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|