Jump to content

i got some error


dean012

Recommended Posts

when i open this in chrome/browser it cam out this at the bottom

alert('Please enter your Username')"; exit(); } if($users_pass==''){ echo ""; exit(); } if($users_email==''){ echo ""; exit(); } $check_email="select*from users where users_email='$users_email'"; $run = mysql_query($check_email) or die(mysql_error()); if(mysql_num_rows($run)>0){ echo""; exit(); } $query = "insert into users (users_name,users_pass,users_email) values(' $users_name','$users_pass','$users_email')"; { $result = mysql_query($query) or die(mysql_error()); } echo""; } ?>

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--

 

 

-->


<head>

 

<meta name="keywords" content="" />

<meta name="description" content="" />

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Yakity Yak</title>

<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>

<link href="style.css" rel="stylesheet" type="text/css" media="screen" />

</head>

<body>

<div id="wrapper">

 

  <p><!-- end #header --></p>

  <div id="header" class="container">

    <div id="logo">

      <h1><a href="#">Yakity Yak</a></h1>

    </div>

    <div id="menu">

      <ul>

        <li class="current_page_item"><a href="file:///D:/blackpolish/index.html">Homepage</a></li>

        <li><a href="file:///D:/blackpolish/trip.html">Destinations</a></li>

        <li><a href="file:///D:/blackpolish/Contact.html">contact </a></li>

        <li><a href="file:///D:/blackpolish/login.html">Login</a></li>

<li><a href="#">Leader</a></li>

        <li></li>

        <li></li>

      </ul>

    </div>

  </div>

  <blockquote>

    <blockquote>

      <p> <center><img src="sd.jpg" width="999" height="300"  alt=""/></center>  </p>

    </blockquote>

  </blockquote>

  <div id="page">

    <div class="post">

      <h2 class="title"><a href="#">Welcome to Yakity yak club</a></h2>

 <form method='post' action='login.php'>

<table width='400' border='5' align='CENTER'>

 

<tr>

<td><h1>Login</h1></td>

 

</tr>

 

<tr>

<td>User Name:</td>

<td><input type='text' name='name'/></td>

</tr>

 

<tr>

<td>Password:</td>

<td><input type='password' name='pass'/></td>

</tr>

<tr>

<td>Email:</td>

<td><input type='text' name='email'/></td>

</tr>

<tr>

<td><input type='submit' name='login' value='login'/></td>

 

</tr>

 

</table>

</form>

 

</body>

</html>

 

<div class="entry">

 

</div>

    </div>

  </div>

 

</body>

</html>

 

 

<?php

$connect=mysql_connect("localhost","root","");

$db_selected = mysql_select_db("users_db", $connect); 

if(isset($_POST['submit'])){

 

$users_name = $_POST['name'];

$users_pass = $_POST['pass'];

$users_email = $_POST['email'];

 

if($users_name==''){

echo "<script>alert('Please enter your Username')</script>";

    exit();

}

 

if($users_pass==''){

echo "<script>alert('Please enter your password')</script>";

    exit();

}

 

if($users_email==''){

echo "<script>alert('Please enter your email')</script>";

    exit();

}

 

$check_email="select*from 

users where 

users_email='$users_email'";

 

$run = 

mysql_query($check_email) or

die(mysql_error());

 

 

 

if(mysql_num_rows($run)>0){

 

echo"<script>alert('Email $users_email 

is already exist in our databse, please try another 

one')</script>";  exit();

}

 

 

$query = "insert into users 

(users_name,users_pass,users_email) values('

$users_name','$users_pass','$users_email')";

 

 


$result = mysql_query($query) 

or die(mysql_error());

 

    

}

echo"<script>alert

window.open('','_self')</script>";

 

    

}

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/281800-i-got-some-error/
Share on other sites

Well you had a number of html errors that I fixed.  I did not experience the issue you are having, even loading your code as it was.  One issue in the php for sure was that you were trying to check for submit even though you didn't have a form field named "submit", you had the submit button named "login".  So I changed that too.  At this moment I don't get any specific errors with this fixed code, although it's not really coded very well, but I'm not going to recode the whole thing.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR...l1-strict.dtd">
<!--
 
 
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googlea...=Oswald:400,300' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googlea...css?family=Abel|Satisfy' rel='stylesheet' type='text/css'/>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
 
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="file:///D:/blackpolish/index.html">Homepage</a></li>
        <li><a href="file:///D:/blackpolish/trip.html">Destinations</a></li>
        <li><a href="file:///D:/blackpolish/Contact.html">contact </a></li>
        <li><a href="file:///D:/blackpolish/login.html">Login</a></li>
<li><a href="#">Leader</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="sd.jpg" width="999" height="300"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      <h2 class="title"><a href="#">Welcome to Yakity yak club</a></h2>
 <form method='post' action='login.php'>
<table width='400' border='5' align='CENTER'>
 
<tr>
<td><h1>Login</h1></td>
 
</tr>
 
<tr>
<td>User Name:</td>
<td><input type='text' name='name'/></td>
</tr>
 
<tr>
<td>Password:</td>
<td><input type='password' name='pass'/></td>
</tr>
<tr>
<td>Email:</td>
<td><input type='text' name='email'/></td>
</tr>
<tr>
<td><input type='submit' name='login' value='login'/></td>
 
</tr>
 
</table>
</form>
  
<div class="entry">
 
</div>
    </div>
  </div>
</div>
</body>
</html>
 
 
<?php
$connect=mysql_connect("localhost","root","");
$db_selected = mysql_select_db("users_db", $connect); 
if(isset($_POST['login'])){
 
$users_name = $_POST['name'];
$users_pass = $_POST['pass'];
$users_email = $_POST['email'];
 
if($users_name==''){
echo "<script>alert('Please enter your Username')</script>";
    exit();
}
 
if($users_pass==''){
echo "<script>alert('Please enter your password')</script>";
    exit();
}
 
if($users_email==''){
echo "<script>alert('Please enter your email')</script>";
    exit();
}
 
$check_email="select*from users where users_email='$users_email'";
 
$run = mysql_query($check_email) or die(mysql_error());
 
 
 
if(mysql_num_rows($run)>0){
 
echo"<script>alert('Email $users_email is already exist in our databse, please try another one')</script>";  exit();
}
 
 
$query = "insert into users (users_name,users_pass,users_email) values('$users_name','$users_pass','$users_email')";
 
 
{ 
$result = mysql_query($query) 
or die(mysql_error());
 
    
}
echo"<script>alert window.open('','_self')</script>";
 
    
}
 
?>
Link to comment
https://forums.phpfreaks.com/topic/281800-i-got-some-error/#findComment-1447911
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.