Welcome To SMK TI PEMBANGUNAN
Sebelum Masuk Forum , Log in terlebih dahulu
Pencarian
 
 

Display results as :
 


Rechercher Advanced Search

translator

User Yang Sedang Online
Total 2 uses online :: 0 Terdaftar, 0 Tersembunyi dan 2 Tamu

Tidak ada

User online terbanyak adalah 224 pada Sat Aug 21, 2010 12:24 pm

Register script with Upload Picture

Topik sebelumnya Topik selanjutnya Go down

Register script with Upload Picture

Post by cukdus on Tue May 18, 2010 2:29 am

Ne gw Copas dari web gw... Cekidot.
Sebelumnya buat file koneksi1.php yg isinya tentang konfigurasi db yg lo buat
Register.php
Spoiler:

Code:

<HTML>
<HEAD>
<TITLE>Sign Up</TITLE>
</HEAD>

<BODY>
<body bgcolor="#000000″>
<div style="position:absolute; width: 949px; height: 563px; left: 160px; top: 47px; background-color: #9999CC">
<font size=6><br>
<center>Form Pendaftaran<br><br></center></font>
<form action=signup.php method=post enctype=multipart/form-data>
<table align=center>
<tr>
<td>Username</td>
<td>:</td>
<td><input type=text name=usename size=20></td></tr>
<tr><td></td><td></td><td><font size=2>Username must least 5 character</font><br><br></td></tr>
<tr>
<td>Nama</td>
<td>:</td>
<td><input type=text name=nama size=20></td></tr>
<tr>
<td>Tanggal Lahir </td>
<td>:</td>
<td><select name=tanggal>
<option value=0>Tanggal
<?php
for($i=1;$i<32;$i++)
echo "<option value=$i>$i "; ?></option value></select>
<select name=bulan><option value=0>bulan
<option value=Januari>Januari
<option value=Pebruari>Pebruari
<option value=Maret>Maret
<option value=April>April
<option value=Mei>Mei
<option value=Juni>Juni
<option value=Juli>Juli
<option value=Agustus>Agustus
<option value=September>September
<option value=Oktober>Oktiber
<option value=Nopember>November
<option value=December>Desember
</option></select>
<select name=tahun>
<option value=0>Tahun
<?php
for($a=1945;$a<2011;$a++)
echo "<option value=$a>$a"; ?>
</option></select>
</td></tr>
<tr>
<td>Jenis Kelamin </td>
<td>:</td>
<td><input type=radio name=jk value=male>Cowok
<input type=radio name=jk value=female>Cewek</td></tr>

<tr>
<td>Alamat</td>
<td>:</td>
<td>
<input type=text name=alamat size=50></td></tr>
<tr><td>Password</td><td>:</td>
<td>
<input type=password name=pas1 size=20></td></tr>
<tr><td></td><td></td><td><font size=2>Password must least 5 character</font><br></td></tr>
<tr><td>Reenter Password</td><td>:</td>
<td><input type=password name=pas2 size=20></td></tr>
<tr><td>Email</td><td>:</td>
<td><input type=text name=email size=30></td></tr>
<tr>
<td>Telepon</td>
<td>:</td>
<td><input type=text name=telepon size=20></td></tr>
<tr>
<td>Foto</td>
<td>:</td>
<td><input type=file name=foto size=20></td></tr>
<tr><td></td><td></td><td><input type=submit name=submit value=sumit>
<input type=reset name=reset value=reset>
</table></form>
</div>
</BODY>
</HTML>
SignUp.php
Spoiler:

Code:

<?php
include "koneksi1.php";
$username=$_POST["username"];
$nama=$_POST["nama"];
$tanggal=$_POST["tanggal"];
$bulan=$_POST["bulan"];
$tahun=$_POST["tahun"];
$sex=$_POST["jk"];
$alamat=$_POST["alamat"];
$pas1=$_POST["pas1"];
$pas2=$_POST["pas2"];
$email=$_POST["email"];
$telepon=$_POST["telepon"];
$foto=$_FILES['foto']['name'];

if (empty ($nama) || empty ($jk) || empty ($alamat) || empty ($pas1) || empty ($pas2) || empty($email) || empty($telepon) ||
$tanggal==0 || $bulan==’0′|| $tahun==0 || empty ($username) || empty ($foto)) {

if (empty ($nama)){
echo"<li> nama kamu masih kosong</b></li>";
}
if (empty ($username)){
echo"<li>username kamu masih kosong</li>";}

if (empty ($jk)){
echo"<li>Pilih jenis kelamin anda</li>";
}
if(empty($pas1)){
echo"<li>Password masih kosong</li>";
}
if (empty ($alamat)){
echo"<li>Alamat anda masih kosong</li>";
}
if (empty ($email)){
echo"<li>Email anda masih kosong</li>";
}
if(empty ($telepon)){
echo"<li>Nomor telepon anda masih kosong</li>";}
if(empty ($foto)){
echo"<li>Anda belum upload<b>foto</b></li>";}
}
else if(strlen($username) <5){
echo"<li>Username must least 5 characters</li>";}
else if(strlen($username) <5){
echo"<li>password must least 5 characters</li>";}
else if($pas1!=$pas2){
echo"Password not required";
}
else if(mysql_num_rows(mysql_query("SELECT username FROM daftar WHERE username = ‘$username’"))){
echo"<li>Username udah ada, coba yang lain</li>";}
else if (!stristr($email,"@") OR !stristr($email,".")) {
echo"<li>Email is not correct</li>";}
else {
function uploadFoto($fileFoto) {
$photo=$_file["file"]["name"];
$folder = ‘./foto_user/’;
$fileTujuan = $folder.$fileFoto['name'];
if (move_uploaded_file($fileFoto['tmp_name'], $fileTujuan)) {
return true;
} else {
return false;
}
}

$prosesUpload = uploadFoto($_FILES[foto]);
$perintah="insert into daftar(username, nama, tanggal, bulan, tahun, jk, alamat, password, email, telepon, foto)
values(\"$username\",\"$nama\", \"$tanggal\", \"$bulan\", \"$tahun\", \"$jk\", \"$alamat\", \"$pas1\", \"$email\", \"$telepon\", \"$foto\")";}
$hasil=mysql_query($perintah);

if ($hasil){
echo("
<br><br><font size=4><b><center>Signup Success,<br> please Login</b><br>
<br>
");
}
else {
echo("
<br>Error entering data<br>
<br>
<a href=\"javascript:history.go(-1)\">Back</a>
");
}
?>

cukdus
Senior Trainee
Senior Trainee

Jumlah posting : 9
Join date : 18.05.10

Kembali Ke Atas Go down

Topik sebelumnya Topik selanjutnya Kembali Ke Atas


 
Permissions in this forum:
Anda tidak dapat menjawab topik