Az előzőek mellett egy olyan apróság, hogy így, kritika nélkül átvenni űrlapról érteket és sql parancsba beírni - melegágya az sql injection típusú támadásoknak. Minimum a htmlentities vagy hasonló függvényt kellene rájuk alkalmazni.
Zsolt Nagy <[email protected]> ezt írta (időpont: 2021. jan. 20., Sze 10:46): > Szép napot Mindenkinek! > > Kérnék szépen pár szakértő szemet, mert nem találom mi a hiba állandóan > ezt írja ki: > *Parse error*: syntax error, unexpected '}', expecting end of file in > *C:\xampp\htdocs\loginx\edit.php* on line *71* > pedig kell a: "}" > > A kódom: > > <?php > include "connection.php"; > $id=$_GET["id"]; > > $firstname=""; > $lastname=""; > $email=""; > $contact=""; > > $res=mysqli_query($link,"select * from table1 where id=$id"); > while($row=mysqli_fetch_array($res)) > { > $firstname=$row["firstname"]; > $lastname=$row["lastname"]; > $email=$row["email"]; > $contact=$row["contact"]; > } > ?> > > > <!DOCTYPE html> > <html lang="en"> > <head> > <title>Bootstrap Example</title> > <meta charset="utf-8"> > <meta name="viewport" content="width=device-width, initial-scale=1"> > <link rel="stylesheet" href=" > https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> > <script src=" > https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js > "></script> > <script src=" > https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js > "></script> > </head> > <body> > > <div class="container"> > <div class="col-lg-4"> > <h2>Basic Database Connection</h2> > <form action="" name="form1" method="post"> > <div class="form-group"> > <label for="email">firstname</label> > <input type="text" class="form-control" id="firstname" > placeholder="Enter firstname" name="firstname" value="<?php echo > $firstname; ?>"> > </div> > <div class="form-group"> > <label for="pwd">lastname</label> > <input type="text" class="form-control" id="lastname" > placeholder="Enter lastname" name="lastname" value="<?php echo $lastname; > ?>"> > </div> > <div class="form-group"> > <label for="pwd">email</label> > <input type="text" class="form-control" id="email" > placeholder="Enter email" name="email" value="<?php echo $email; ?>"> > </div> > <div class="form-group"> > <label for="pwd">contact</label> > <input type="text" class="form-control" id="contact" > placeholder="Enter contact" name="contact" value="<?php echo $contact; ?>"> > </div> > > <button type="submit" name="update" class="btn btn-default">Update</button> > > </form> > </div> > </div> > > </body> > > <?php> > if(isset($_POST["update"])) > { > mysqli_query($link,"update table1 set > firstname='$_POST[firstname]',lastname='$_POST[lastname]',email='$_POST[email]',contact='$_POST[contact]' > where id=$id"); > ?> > <script type="text/javascript"> > windows.location.href="index.php"; > </script> > <?php > } > ?> > > </html> > > Előre is köszönöm a szemeteket! > > Szép napot! > > > _______________________________________________ > Techinfo mailing list > [email protected] > Fel- és leiratkozás: > http://lista.sulinet.hu/cgi-bin/mailman/listinfo/techinfo > Illemtan: http://www.szag.hu/illemtan.html > Ügyfélszolgálat FAQ: http://sulinet.niif.hu/ >
_______________________________________________ Techinfo mailing list [email protected] Fel- és leiratkozás: http://lista.sulinet.hu/cgi-bin/mailman/listinfo/techinfo Illemtan: http://www.szag.hu/illemtan.html Ügyfélszolgálat FAQ: http://sulinet.niif.hu/
