Search the Community
Showing results for tags 'web page'.
-
I am new to PHP and I am having some problems and I am hoping someone can point me in the right direction. Here is what I need to do: Create a Web Form for uploading pictures for a high school reunion. The form should have text input fields for the person's name and a description of the image, and a file input field for the image. To accompany each file, create a text file that contains the name and description of the image. Create a separate Web Page that displays the pictures with a caption showing the name and description fields. Make sure the folder has read and write for everyone. Here is what I have but it isnt working properly: Process page of the page! an errow here: This is the message I get! Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR) in C:\ITEC315\htdocs\users\ramojumder0\Reinforcement Exercises\Ch. 5\R.E.5-5_FillPictureForm.php on line 28 which deals with the picture! My problem is that it is having a problem uploading a picture and showing it! How do I fix the issue with uploading a picture and then showing it! Input page <form method="POST" action="R.E.5-5_Fillrrr.php"> <p>Name <input type="text" name="name" /></p> <p>Description <input type="text" name="description" /></p> <p>Choose a file to upload: <input type = "file" name = "picture" accept = "image/*" /></p> <p><input type="submit" value="Submit" /></p> </form> <p><a href="R.E.5-5_ShowPictures.php">Show Pictures </a></p> </body> </html> Processing page! <?php if (empty($_POST['name']) || empty($_POST['description'])) echo "<p>You must enter your name and description about your picture. Click your browser's Back button to return to the Picture Input Page!</p>\n"; else { $Name = addslashes($_POST['name']); $Description = addslashes($_POST['description']); $Picture = addslashes($_POST['picture']); $ShowPic = fopen("showpic.txt", "ab"); if (is_writeable("showpic.txt)) { if (fwrite($ShowPic, $Name . "," . $Description . "," . $Picture . "\r\n")) echo "<p>Thank you for filling out the Picture Input Page!</p>\n"; else echo "<p>Cannot add your name to the Picture Input Page!</p>\n"; } else echo "<p>Cannot write to the file.</p>\n"; fclose($ShowPic); } ?><!--End PHP Script-->
- 1 reply
-
- web page
- uploading pictures
-
(and 1 more)
Tagged with:
-
Hi, I am new to PHP.So any help would be great. I would like to display a drop down list and a textbox on a page. This dropdown data will be populated from a textbox. What I would like to know is, how to: parse a file and extact some data from a txt file which is on a server. populate this dropdown on the page with the data also I would like to display another data on the textbox according to the data selected on the drop down list and of couse how to test this script etc. Best Regards.
-
hi i'm not that good in php , could you plz help me to find a solution , i want to secure my eb page , but i can't login to the main menu even when i type the right name & passeword . help me plz , thank you index.php: <?php /** * Page de connexion au site sécurisé * - Affiche le formulaire * - Le traite lorsqu'il est validé */ //le formulaire est-il validé? $error = "<br><br>"; if( isset( $_POST['name'] ) && $_POST['name'] ) { //la session est déjà initialisé? if( !isset($_SESSION) ) { session_start(); } // oui ! donc traitement du formulaire if( isset( $_POST['name'] ) && !empty( $_POST['name'] ) && ( isset( $_POST['password'] ) && !empty( $_POST['password'] ) ) ) { /* Sécurisation des données */ { $name = htmlentities($_POST['name'], ENT_QUOTES); $password = htmlentities($_POST['password'], ENT_QUOTES); } /* connexion au serveur */ { $host = "localhost" ; $user = "root" ; $password = "" ; $base = "user" ; mysql_connect($host, $user, $password) or die("erreur de connection à la base") ; // Connexion à MySQL mysql_select_db($base) or die("erreur de selection de la base") ; // Sélection de la base } /* requètage pour vérifier l'existance de cet utilisateur */ { $query = sprintf("SELECT COUNT(name) AS 'count' FROM admin WHERE name='%s' AND password='%s'", mysql_real_escape_string($name), mysql_real_escape_string($password)); $request = mysql_query($query) or die("Erreur avec la requète : $query<br /> Motif : ".mysql_error()); $result = mysql_fetch_object($request); } /* traitement du résultat */ { if(!$result->count) $error = "Mauvais name et/ou password!<br>"; else{ // c'est ici que la validation de l'utilisateur se fait! $_SESSION['name'] = $name; $error = "Merci de vous être identifié $name. , veuillez patienter "; header("Refresh: 3; URL= menu.php" );//rafraichissement de la page d'acceuil chaque 3s } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- Basics --> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Login</title> <!-- CSS --> <link rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" href="css/animate.css"> <link rel="stylesheet" href="css/styles.css"> </head> <!-- Main HTML --> <body> <!-- Begin Page Content --> <div id="container"> <form name="login-form" method="POST" action="index.php" > <label for="name" name='name' onfocus="this.value=''">login:</label> <input type="name" name='name'> <label for="password" name='password' onfocus="this.value=''">password:</label> <p><a href="#">Forgot your password?</a> <input type="password" name='password'> <div id="lower"> <input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label> <input type="submit" value="login" action="menu.php" name="login"> </div> <span> <?php echo $error; ?></span> </form> </div> <!-- End Page Content --> </body> </html> _________________ menu.php: <?php //Sécurisation de la page require_once 'fonction.fct.php'; //importer le contenu getSecured(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="sty.css"> <script type="text/javascript" src="menu.js"></script> <!-- Ou copier le code ci-dessus dans les balises : --> <script type="text/javascript"> </script> </head> <body> <p> <?php echo " welcome {$_SESSION['name']} "; ?> <p></div> <div align='left'> <ul id="menu" > <li> <a href="#">NetXMS</a> <ul> <li><a href="#">infrastructure</a></li> <li><a href="#">configuration</a></li> <li><a href="#">state nodes</a></li> <li><a href="#">syslog</a></li> </ul> </li> <li> <a href="#">RADIUS</a> <ul> <li><a href="#">accounting</a></li> <li><a href="#">authorization</a></li> <li><a href="#">authentication</a></li> <li><a href="#">configuration</a></li> </ul> </li> <li> <a href="#">supervisor</a> <ul> <li> <a href="#">add</a> <a href="#">modify</a> <a href="#">delete</a> </li> </ul> </li> <li> <a href="#">logout</a> </li> </ul> </div> </body> </html> <?php } else // Le mot de passe n'est pas bon. { // On affiche la zone de texte pour rentrer le mot de passe. ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <title>Visiteur inconnu</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" media="screen" type="text/css" title="suite" href="design_accueil.css" /> <!-- Lien vers la favicon --> <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" height="48" width="48"/> </head> <body> <!-- Le corps --> <div id="corps"> <p>Veuillez vous identifier pour accéder au site :</p> <form action="index.php" method="post"> <p> <input type="submit" value="OK" /> </p> </form> </div> <!-- Le pied de page --> <div id="pied_de_page1"> </div> </body> </html> <?php } // Fin du else. // Fin du code. ?> ________ fonction.fct.php: <?php /** * Fonction getSecured() Vérifier si une personne est enregistré * */ function getSecured() { //la session est déjà initialisé? if( !isset($_SESSION) ) { session_start(); } //La personne est-elle déjà enregistré? if( !isset($_SESSION['name']) ) { require_once 'index.php'; exit(); } } ?>