Jump to content
php.lv forumi

register.php


ziedinjsh

Recommended Posts

Vai kāds varētupateikt kas īsti viņam nepatīk:

<?php
include "misc/config.php";
$status = (isset($_GET['status'])) ? $_GET['status'] : '';

// savaac datus
$submit = $_POST['register'];
$username = strip_tags($_POST['username']);
$email = strip_tags($_POST['email']);
$password = strip_tags($_POST['passwords']);
$password2 = strip_tags($_POST['passwords2']);
$date = date("y-m-d");

if ($submit){

//paarbauda vai kkas nav tuksh
if ($username&&$email&&$password&&$password2) 
{

// vai paroles ir pareizas
if ($password == $password2)
{

// username un email garums
if (strlen($username)>50||strlen($email)>50)
{
echo "In username and email faild max is 50 sybols";
}
else
{

//password garums
if (strlen($password)>25||strlen($password)<6)
{
echo "Password most be between 6 and 25 characters";
}
else
{
//user register


//paroli nokodee uz md5
$password = md5($password);
$password2 = md5($password2);

$query = mysql_query ("INSERT INTO users VALUES ('','$username','$email','$password','$date')");

die ("You are registed");

}


}

else 
echo "Youre password do not match!";




}
else echo "Please fill all feilds";


echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
echo "<table>";
echo "<tr>";
echo "<td>username</td><td><input type='text' name='username' value='$username'></td>";
echo "</tr><tr>";
echo "<td>email</td><td><input type='email' name='email' value='$email'></td>";
echo "</tr><tr>";
echo "<td>password</td><td><input type='password' name='password'></td>";
echo "</tr><tr>";
echo "<td>password2</td><td><input type='password' name='password2'></td>";
echo "</tr><tr>";
echo "<td></td><td><input type='submit' name='register' value='register'></td>";
echo "</tr>";
echo "</table>";

?>

 

Parse error: syntax error, unexpected T_ELSE in /home/produc/public_html/mp3/1/register.php on line 54

 

es nesaprotu kas ar to else man jādara.. acis jau nerāda kur ir kļūda rāda 54 rindiņu.. bet ko lai es ar viņu daru?

Link to comment
Share on other sites

provēju jau..skatījos tur tās figūriekavas.. kur ir + un - bet es nesaprotu kā es varu zināt kad ķēde noslēdas un kur nē

 

Ja ķēde noslēdzas, tad viņš izceļ iekavas, ja nē, tad neizceļ.

 

Galu galā, tak raksti normāli visur ar tām iekavām nevis vietām ar, vietām bez.

 

..un liec tab'us veidojot jaunus blokus, piem

 

if(){
//lalal
}else{
if(){
	//lalal
}else{
	if(){
		//lalal
	}else{
		if(){
			//lalal
		}
	}
}else{
	if(){
		//lalal
	}
}
}

nevis

if(){
//lalal
}else{
if(){
//lalal
}else{
if(){
//lalal
}else{
if(){
//lalal
}
}
}else{
if(){
//lalal
}
}
}

Edited by briedis
Link to comment
Share on other sites

Ja nemaldos, tad tev trūkst aizverošā figūriekava trešajam ifam, bet tajā haosiņā ir grūti kaut ko saprast. Vai tiešām tu neliec tabus nekur? Kā arī, ja pēc nosacījuma seko tikai viena darbība, tad tā nav jāliek figuriekavās - tas nebūtu īpaši jāizmanto, sevišķi, ja ir tik daudz sazarojumi.

if($one) {
 echo "One";
}
elseif($two) {
 echo "Two";
}
elseif($three) {
 echo "Three";
}
else {
 echo "Four";
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...