<?php
if (isset($_POST['daftar']))
{
include "./config/conn.php";
$nama=ucwords($_POST['nama']);
$kota_asal=$_POST['kota_asal'];
$foto=$_POST['foto'];
$user=$_POST['user'];
$email=$_POST['email'];
$password=md5($_POST['password']);
if (!empty($nama) && !empty($kota_asal) && !empty($foto) && !empty($user) && !empty($email) && !empty($password))
{
$cek=mysql_db_query($db,"select * from daftar where user='$user'",$koneksi);
$valid=mysql_num_rows($cek);
if ($valid){
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, USERNAME Anda sudah ada yang punya!!</font>'; </script>";
}else{
$insert=mysql_db_query($db,"insert into daftar(nama,kota_asal,foto,user,email,pass,tanggal) values('$nama','$kota_asal','$foto','$user','$email','$password','$tanggal')",$koneksi);
if ($insert)
{
echo "<script> document.location.href='signup.php?status=Selamat bergabung dengan situs kami.'; </script>";
}
}
}
else
{
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, Data yang anda kirim belum lengkap!!</font>'; </script>";
}
}
?>
<html>
<head>
<title>SignUp</title>
<script language="javascript">
<!--
function tutup()
{
top.window.close()
}
//-->
</script>
</head>
<body>
<center>
<table width="100%" cellspacing="2" cellpadding="2" >
<tr>
<td bgcolor='#0033FF' colspan="2"><div align="center">
<font color="#FFFFFF" face="Geneva, Arial, Helvetica, sans-serif"><strong>[DAFTAR SLANKER/SLANKY]</strong></font></div>
</td>
<tr>
<td> </td>
</tr>
<tr>
<td valign="top"> </td>
<td>
<form name="daftar" action="signup.php" method="post">
<table width="100%" cellspacing="2" cellpadding="2" >
<tr>
<td><font face="verdana" size="2">Nama Lengkap</font></td>
<td><input type="text" dir="ltr" size="25" name="nama"><td>
</tr>
<tr>
<td>Kota asal</td>
<td><label for="textfield"></label>
<input type="text" name="kota_asal" id="textfield"></td>
</tr>
<tr>
<td>Foto</td>
<td><input type="file" name="foto" size="20"></td>
</tr>
<tr>
<td><font face="verdana" size="2">User name</font></td>
<td><input type="text" size="10" name="user"></td>
</tr>
<tr>
<td><font face="verdana" size="2">Email</font></td>
<td>
<input type="text" size="25" name="email"></td>
</tr>
<tr>
<td height="30"><font face="verdana" size="2">Password</font></td>
<td><input type="password" size="10" name="password">
<font size="-1" color="#A0A0A4" face="verdana"> (Max 6 digit 0-9 a-z case sensitif)</font></td>
</tr>
<tr>
<td></td><td><p>
<input type="submit" value="Kirim" name="daftar">
<input type="button" onClick="tutup()" value="Keluar">
</p>
</td>
</tr>
</table>
</form><br>
<p align="center"><font color="#0033FF" face='verdana' size='2'><blink><? echo $_GET['status'] ?></blink></font><br></p>
</td>
</tr>
</tr>
</table>
</center>
</body>
</html>
<?php
$namafile = $_FILES['foto']['name'];
$size = $_FILES['foto']['size'];
$error = $_FILES['foto']['error'];
if($size > 0 && $error == 0){ //jika ukuran file lebih dari nol dan tidak terjadi error
move_uploaded_file($_FILES['foto']['tmp_name'], 'path/to/upload/'.$namafile); //upload file
}
pelajari lagi di http://www.myphptutorials.com/tutorials/20/upload-gambar-dengan-php atau http://www.myphptutorials.com/tutorials/39/membuat-galeri-foto<?php
if (isset($_POST['daftar']))
{
include "./config/conn.php";
$nama=ucwords($_POST['nama']);
$kota_asal=$_POST['kota_asal'];
$user=$_POST['user'];
$email=$_POST['email'];
$password=md5($_POST['password']);
//upload gambar
$foto = '';
if($_FILES['foto']['size'] > 0 && $_FILES['foto']['error'] == 0){
move_uploaded_file($_FILES['foto']['tmp_name'], 'foto/'.$_FILES['foto']['name']);
$foto=$_FILES['foto']['name'];
}
if (!empty($nama) && !empty($kota_asal) && !empty($foto) && !empty($user) && !empty($email) && !empty($password))
{
$cek=mysql_db_query($db,"select * from daftar where user='$user'",$koneksi);
$valid=mysql_num_rows($cek);
if ($valid){
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, USERNAME Anda sudah ada yang punya!!</font>'; </script>";
}else{
$insert=mysql_db_query($db,"insert into daftar(nama,kota_asal,foto,user,email,pass,tanggal) values('$nama','$kota_asal','$foto','$user','$email','$password','$tanggal')",$koneksi);
if ($insert)
{
echo "<script> document.location.href='signup.php?status=Selamat bergabung dengan situs kami.'; </script>";
}
}
}
else
{
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, Data yang anda kirim belum lengkap!!</font>'; </script>";
}
}
?>
<?php
if (isset($_POST['daftar']))
{
include "./config/conn.php";
$nama=ucwords($_POST['nama']);
$kota_asal=$_POST['kota_asal'];
$user=$_POST['user'];
$email=$_POST['email'];
$password=md5($_POST['password']);
//upload gambar
$foto = $_FILES['foto']['name'];
$size = $_FILES['foto']['size'];
$error = $_FILES['foto']['error'];
if($_FILES['foto']['size'] > 0 && $_FILES['foto']['error'] == 0){
move_uploaded_file($_FILES['foto']['tmp_name'], 'images/'.$_FILES['foto']['name']);
$foto=$_FILES['foto']['name'];
}
if (!empty($nama) && !empty($kota_asal) && !empty($foto) && !empty($user) && !empty($email) && !empty($password))
{
$cek=mysql_db_query($db,"select * from daftar where user='$user'",$koneksi);
$valid=mysql_num_rows($cek);
if ($valid){
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, USERNAME Anda sudah ada yang punya!!</font>'; </script>";
}else{
$insert=mysql_db_query($db,"insert into daftar(nama,kota_asal,foto,user,email,pass,tanggal) values('$nama','$kota_asal','$foto','$user','$email','$password','$tanggal')",$koneksi);
if ($insert)
{
echo "<script> document.location.href='signup.php?status=Selamat bergabung dengan situs kami.'; </script>";
}
}
}
else
{
echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, Data yang anda kirim belum lengkap!!</font>'; </script>";
}
}
?>
<html>
<head>
<title>SignUp</title>
<script language="javascript">
<!--
function tutup()
{
top.window.close()
}
//-->
</script>
</head>
<body>
<center>
<table width="100%" cellspacing="2" cellpadding="2" >
<tr>
<td bgcolor='#0033FF' colspan="2"><div align="center">
<font color="#FFFFFF" face="Geneva, Arial, Helvetica, sans-serif"><strong>[DAFTAR SLANKER/SLANKY]</strong></font></div>
</td>
<tr>
<td> </td>
</tr>
<tr>
<td valign="top"> </td>
<td>
<form name="daftar" action="signup.php" method="post" enctype="multipart/form-data">
<table width="100%" cellspacing="2" cellpadding="2" >
<tr>
<td><font face="verdana" size="2">Nama Lengkap</font></td>
<td><input type="text" dir="ltr" size="25" name="nama"><td>
</tr>
<tr>
<td>Kota asal</td>
<td><label for="textfield"></label>
<input type="text" name="kota_asal" id="textfield"></td>
</tr>
<tr>
<td>Foto</td>
<td><input type="file" name="foto" size="20"></td>
</tr>
<tr>
<td><font face="verdana" size="2">User name</font></td>
<td><input type="text" size="10" name="user"></td>
</tr>
<tr>
<td><font face="verdana" size="2">Email</font></td>
<td>
<input type="text" size="25" name="email"></td>
</tr>
<tr>
<td height="30"><font face="verdana" size="2">Password</font></td>
<td><input type="password" size="10" name="password">
<font size="-1" color="#A0A0A4" face="verdana"> (Max 6 digit 0-9 a-z case sensitif)</font></td>
</tr>
<tr>
<td></td><td><p>
<input type="submit" value="Kirim" name="daftar">
<input type="button" onClick="tutup()" value="Keluar">
</p>
</td>
</tr>
</table>
</form><br>
<p align="center"><font color="#0033FF" face='verdana' size='2'><blink><? echo $_GET['status'] ?></blink></font><br></p>
</td>
</tr>
</tr>
</table>
</center>
</body>
</html>
<?php
$user_name=ucwords($_SESSION['user_name']);
$time=date("G");
?><font face="verdana" size="2" color="#FFFF66">
<?php
if ($time<12)
{
$status= " Selamat pagi ";
}
else if ($time<15)
{
$status= " Selamat Siang ";
}
else if ($time<18)
{
$status= " Selamat Sore ";
}
else
{
$status= " Selamat Malam ";
}
echo "</font>";
?>
<html>
<script language="javascript">
<!--
function konfirmasi()
{
tanya=confirm("Apakah anda yakin akan keluar?")
if (tanya !="0")
{
top.location="logout.php"
}
}
//-->
</script>
<?php
include"./config/conn.php";
$query=mysql_db_query($db,"select * from daftar",$koneksi);
$data =mysql_fetch_array($sql);
$count=mysql_num_rows($query);
?>
<table width="15%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0033FF" align="center">
<tr>
<td width="22%" align="right"> </td>
<td width="70%" bgcolor="#0033FF" ><div align="center"><strong><font face="verdana" size="2" color="#FFFFFF"><?php echo $status.$user_name; ?></font></strong></div></td>
<td width="6%"> </td>
</tr>
<tr>
<td> </td>
<td>
<table width="165" align="center">
<tr>
<td width="157" align="center">
<img src="images/<?php echo $data['foto'];?>" width="100" height="100" border="0"/>
<a href="" style="text-decoration:none " title="Keluar" onClick="konfirmasi()">
<b><font face="verdana" size="2" color="#FF0000">Logout</font></b></a>
</td>
</tr>
</table>
</td>
<td> </td>
<td width="2%"></td>
</tr>
<tr>
<td align="right"> </td>
<td bgcolor="#0033FF" ><div align="center"><font face="verdana" size="2" color="#FFFFFF">Jumlah Member : <?php echo $count; ?></font></div></td>
<td> </td>
</tr>
</table>