Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Błąd przy wykonywaniu funkcji w skrypcie hotelowym
Daffcio3615
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 18.09.2017

Ostrzeżenie: (0%)
-----


Witam. W poszukiwaniu ratunku na zaliczenie ( czyli szukania gotowca w necie na temat rezerwacji pokoju hotelowego ) natknąłem się na wideo, na którym autor pokazuje jak działa jego skrypt, który udostępnia otwarcie.

Podczas otwierania u mnie i próbie logowania wyskakuje takie coś ( a u niego normalnie działa ):

(IMG:https://i.imgur.com/W0lXcZ4.png)

poniżej podaję link do pobrania tego skryptu

https://drive.google.com/file/d/16TZEEqyPsS...iew?usp=sharing

(baza danych musi się nazywać assignment )

Nie wiem co już z tym robić... szukałem wszędzie i nic... nawet przeszedłem z PHP 7 na PHP 5.6.21 a potem znów na 5.5.19
Pozdrawiam.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Daffcio3615
post
Post #2





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 18.09.2017

Ostrzeżenie: (0%)
-----


Kod
<?php     session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<style type="text/css">
    #contenair{
        height: 100%;
        width: 100%;
        
    }
    #r{
        margin-top: 5%;
        margin-bottom: 50px;
        margin-right: 20px;
        float: right;
        height:95%;
        width:35%;
        background-color: #b7bcbd;
        
    }
    #l
    {
        margin-top: 5%;
        margin-bottom: 50px;
        margin-left:20px;
        float: left;
        
        width: 60%;
        background-color: #b7bcbd;
    
    }
    </style>
    
<script>
    
        function signup()
      {

          var alt="";
          var x=document.forms["signupform"]["firstname"].value;
          if (x==null || x=="")
            {
              alt +="First name must be filled out\n";
              
            
            }
         var y=document.forms["signupform"]["lastname"].value;
         if (y==null || y=="")
            {
              
              alt += "Last name must be filled out\n";
              
            }
            var x=document.forms["signupform"]["daytimephone"].value;
          if (x==null || x=="")
            {
              alt +="First name must be filled out\n";
              
            
            }
          var z=document.forms["signupform"]["email"].value;
          var atpos=z.indexOf("@");
          var dotpos=z.lastIndexOf(".");
              
           if (atpos<1 || dotpos<atpos+2 || dotpos+2>=z.length)
              {
             alt += "Not a valid e-mail address\n";
            
              }
        
          var v=document.forms["signupform"]["password1"].value;
        
          if (v==null || v=="")
            {
              alt += "password must be filled out\n";
                
            }
         var t=document.forms["signupform"]["password2"].value;
         if (t==null || t=="")
            {
              alt += "confirm password must be filled out\n";
                
            }
             if (v != t)
            {
              alt += "password  doesn't  match\n";
                
            }
          if((document.forms["signupform"]["usertype1"].checked==false)&& (document.forms["signupform"]["usertype2"].checked==false))
      
            {
               alt += "payment type  must be filled out\n";
                    
            }
  
        if (alt != "")
             {
               alert(alt);
              return false;
             }
             else {
                 form.Submit()
             }
}

     </script>
     <meta charset="UTF-8" />
</head>
<body>
<div id="contenair">
<?php
include_once('include/db_con.php');
if(isset($_POST['Submit']))
{
$fn=$_POST['firstname'];
$ln=$_POST['lastname'];
$phone=$_POST['daytimephone'];
$email=$_POST['email'];
$pass=$_POST['password1'];
$city=$_POST['city'];
$country=$_POST['country'];
$intr=$_POST['usertype'];

$s1="INSERT INTO users (first_name,last_name,day_phone,user_name,user_password,city,country,payment_
type)VALUES('".$fn."','".$ln."','".$phone."','".$email."','".$pass."','".$city."','".$country."','".$intr."')";
mysql_query($s1) or die (mysql_error($con));
}
?>
<div id="l" align="left">
<h2  align="center" style="color:red">Welcome to our Hotel </h2>
<h3 align="center"><u><i>Create A Account For New User....</i></u></h3>
<table>
<form method="POST" name="signupform" action="index.php" onSubmit="return signup();" >
         <tr>
        <td height="40">FirstName:</td>
        <td><input name="firstname" type="text" id="firstname" size="40" />
        
        </td>
    </tr>
    <tr>
        <td height="40">LastName:</td>
        <td><input name="lastname" type="text" id="lastname" size="40"  />
        
        </td>
    </tr>
    <tr>
        <td height="40">Phone:</td>
        <td><input name="daytimephone" type="text" id="daytimephone" size="40" class="phone" />
        
        </td>
    </tr>
    <tr>
        <td height="40">E-mail:</td>
        <td><input name="email" type="text" id="email" size="40"  />
        
        </td>
    </tr>
    
    <tr>
        <td height="40">Password:</td>
        <td><input name="password1" type="password" id="password1" size="40" />
        
        </td>
    </tr>
    <tr>
        <td height="40">Confirm Password:</td>
        <td><input name="password2" type="password" id="password2" size="40" />
        
        </td>
    </tr>
    <br>
    <tr>
        <td height="40">City/State</td>
        <td><input name="city" type="text" id="city" size="40"  />
        </td>
    </tr>
    <br>
    <tr>
        <td height="40">Country</td>
        <td><input name="country" type="text" id="country" size="40" />
        
        </td>
    </tr>
    <br>
    <tr>
        <td>Payment Type:</td>
        <td><input type="radio" name="usertype" id="usertype1" value="cash" />Cash
        <input type="radio" name="usertype" id="usertype2" value="paypal" />Paypal/CreditCard
        </td>
    </tr>
    <tr>
    <td align="center" colspan="2"><input type="submit" name="Submit" value="Submit" />
        <input type="reset" name="reset" value="Reset"  /></td></tr>
    </form>
   </table>
</div>
    <div id="r" align="right">
    
    <?php
    include_once('include/db_con.php');
        if (isset($_POST['username'],$_POST['password']))
               {
                $username=$_POST['username'];
                $password=$_POST['password'];
  
                   if (empty($username) || empty($password))
                   {
                      $error = 'Hey All fields are required!!';
                    }
                    
                     else {  
                     $login="select * from users where user_name='".$username."' and user_password ='".$password."'";
                     $result=mysql_query($login);
                     print_r($result);
                     echo "Connect error: " . mysql_error() . " :( ";
                    if (mysql_fetch_array($result)){
                 $_SESSION['logged_in']='true';
                 $_SESSION['username']=$username;
                     header('Location:registration.php');
                     exit();
                     } else {
                     $error='Incorrect details !!';
                     }
                           }
        }
  
  ?>
    <form action="index.php" method="POST">
    <h2 align="center" id="h"><u><i>Login Here........</i></u></h2>
        <table align="center" id="t">
        <tr> <?php  if (isset($error)) {?>
           <small style="color:#aa0000;"><?php echo $error; ?>
            <br /> <br />
           <?php } ?> </tr>
          <tr>
            <td width="113">Email:</td>
            <td width="215">
              <input name="username" type="text"  size="40" /></td>
          </tr>
          <tr>
            <td>Password:</td>
            <td>
              <input name="password" type="password"  size="40" /></td>
          </tr>
          <tr>
            <td colspan="2" align="center">
            <input type="submit" name="sub" value="Login" /></td>
            </tr>
            
       </table>
        </form>
        
        
    </div>
</div>
</body>
</html>
Go to the top of the page
+Quote Post

Posty w temacie
- Daffcio3615   [MySQL][PHP]Błąd przy wykonywaniu funkcji w skrypcie hotelowym   12.06.2018, 14:19:41
- - Neutral   Popatrz na przykład i pozmieniaj. [PHP] pobierz, ...   12.06.2018, 14:39:09
- - nospor   @Neutral i niby jakim cudem przejscie na mysqli ma...   12.06.2018, 14:47:13
|- - Daffcio3615   Cytat(nospor @ 12.06.2018, 15:47:13 )...   12.06.2018, 16:08:50
- - SmokAnalog   Taki błąd oznacza, że masz złą nazwę użytkownika/h...   12.06.2018, 14:56:23
- - nospor   @SmokAnalog a skadzesz te mysql_connect wytrzasnal...   12.06.2018, 15:02:39
- - SmokAnalog   Ale pierwszy parametr to połączenie. Mówimy o funk...   12.06.2018, 15:12:18
- - nospor   @Smoku idz sie wyspij bo gadasz takie glupoty.... ...   12.06.2018, 15:13:36
- - SmokAnalog   Rzeczywiście gadam głupoty Pomyliło mi się z mysq...   12.06.2018, 15:16:13
- - nospor   CytatAle wstydNo ba. Dodam ten temat do ulubionych...   12.06.2018, 15:32:01
- - SmokAnalog   Miejże litość, pozwól negocjować. Niech to będzie ...   12.06.2018, 15:37:54
- - nospor   I takie negocjacje lubie. Euro pasuje   12.06.2018, 15:40:14
- - nospor   No ale dales to wyswietlanie po mysql_query() a pr...   12.06.2018, 16:11:56
- - Daffcio3615   Kod<?php session_start(); ?> ...   12.06.2018, 16:18:04
- - nospor   No i co? Nie zwraca ci to bledu bazy ale jednoczes...   12.06.2018, 16:22:48
- - Daffcio3615   Warning: mysql_error(): 6 is not a valid MySQL-Lin...   12.06.2018, 16:30:22
- - nospor   zmien mysql_error($con) na mysql_error() Co...   12.06.2018, 16:34:14
- - Daffcio3615   db_con.php -> daję to, co zmieniłem z PDo na my...   12.06.2018, 16:42:46
- - nospor   Masz blad ze nie wybrales bazy Ja ci mowie ze masz...   12.06.2018, 16:45:34
- - Daffcio3615   dodałem wszędzie na początek zamiast session_start...   12.06.2018, 16:56:20


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.10.2025 - 14:13