
Dada78
Members-
Posts
358 -
Joined
-
Last visited
Never
Everything posted by Dada78
-
this is what i am wanting to do but cant find anything information about this to do this...
-
bump -Thanks
-
Ok I think that is working great like I needed, can't believe it was that easy. Ok now how about this. I need to output whats in the database on this page. http://mesquitechristmas.com/local/browse.php To look like it does on this page. http://mesquitechristmas.com/local/example.php Here is the code I am using for the entire page. Now I can output data onto this page but the data is the same for every table row. I need each table row to be different like it is above. I am thinking their is something I need to add to the echo or something maybe? <?php include ('db_connect.php'); if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT * FROM users WHERE id = $id;"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $postal = $row["postal"]; $country = $row["country"]; } else { die("No user found"); } } else { die(mysql_error()); } } ?> <!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="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="Mesquite Texas Country Christmas" /> <meta name="keywords" content="Mesquite, Texas, Country Christmas" /> <meta name="author" content="NA" /> <link rel="stylesheet" type="text/css" href="/stylesheet.css" media="screen" title="FBC" /> <script type="text/javascript" src="drop_down.js"></script> <title>A Mesquite Country Christmas</title> </head> <body> <div id="wrap"> <a href="/index.html"> <img id="frontphoto" src="/images/header.png" width="760" height="237" alt="Mesquite Country Christmas" border="0"></a> <div id="menu"> <h2 class="hide">Menu:</h2> <ul id="avmenu"> <li><a href="/index.html">Home</a></li> <li><a href="/christmasstory.html">The Christmas Story</a></li> <li><a href="/directions.html">Directions</a></li> <li><a href="#">Information</a><ul> <li><a href="/information.html">Display Facts & Info</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/playlist.html">2008 Playlist</a></li> <li><a href="#">Christmas History</a></li> </ul></li> <li><a href="#">Photos</a> <ul> <li><a href="/2007photos.html">2007</a></li> </ul></li> <li><a href="#">Videos</a> <ul> <li><a href="/2007videos.html">2007</a></li> </ul></li> <li><a href="/guestbook.php">Guestbook</a></li> <li><a href="/webcam.html">Web Cam</a></li> <li><a href="/webradio.html">Internet Radio</a></li> <li><a href="http://www.noradsanta.org/" TARGET="_blank">Track Santa</a></li> <li><a href="/projects.html">Projects & How Tos</a></li> <li><a href="/links.html">Links</a></li> <li><a href="/contact_us.html">Contact Us</a></li> </ul> <center><img src="images/toys_for_tots.jpg" border="0" width="110" height="153" vspace="10"><a href="http://www.toysfortots.org/" TARGET="_blank"></a></center> <center><a href="http://christmas.bronners.com/2007/house/534.html"><img src="http://christmas.bronners.com/voteforme/vote.jpg" border="0" width="110" height="153" alt="christmas decorations" vspace="10"></a></center> </div> <div id="content"> <b>Learn more about Display</b></a><br><br>> <div class="fadebox"> <h2>Mesquite Christmas Display Finder</h2> <hr /> <p> Do you drive around aimlessly looking for Christmas lights every year? We are here to help make that tradition better by allowing you to search for local displays in Mesquite and get directions to them. And if you have a display of your own, you can add it to our database for others to find and enjoy!</p> <p><span class="title">Current Displays In Mesquite</span><br /><table style="border-top: 1px solid rgb(51, 102, 51);" border="0" cellpadding="4" cellspacing="0" width="100%"><tbody><tr><td class="bg2" width="110">IMAGE</td><td class="bg2"><? echo $row['address']; ?><br><? echo $row['city']. "," . $row['state']. " " . $row['postal']; ?><br><? echo $row['country']; ?></td><td class="bg2" style="vertical-align: middle;">> <a href="displays.php?id=<?php echo $row['id']; ?>"><b>Learn more about Display</b></a><br><br>> <a href="http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=search&countryid=US&addtohistory=&country=US&address=<? echo $row['address']; ?>&city=<? echo $row['city']; ?>&zipcode=<? echo $row['postal']; ?>&historyid=&submit=Get+Map" target="_NEW"><b>Get Directions</b></a><br /><br /></td></tr> <tr><td class="bg1" width="110">IMAGE</td><td class="bg1"><? echo $row['address']; ?><br><? echo $row['city']. "," . $row['state']. " " . $row['postal']; ?><br><? echo $row['country']; ?></td><td class="bg1" style="vertical-align: middle;">> <a href="displays.php?id=<?php echo $row['id']; ?>"><b>Learn more about Display</b></a><br><br>> <a href="http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=search&countryid=US&addtohistory=&country=US&address=<? echo $row['address']; ?>&city=<? echo $row['city']; ?>&zipcode=<? echo $row['postal']; ?>&historyid=&submit=Get+Map" target="_NEW"><b>Get Directions</b></a><br /><br /></td></tr></tbody></table></p> </div> </div> </div> <div id="footer"> © 2007 Mesquite Country Christmas <br /> <br /> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //468x60, created 1/8/08 google_ad_slot = "0360766123"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> </body> </html> -Thanks
-
Ok so if I wanted to create links formed from the ID would this be correct? <a href="displays.php?id=<?php echo $row['id']; ?><a href="displays.php?id=<?php echo $row['id']; ?></a> -Thanks
-
never mind I think I have it now, let me play with this for a min.
-
That produces this error: Parse error: syntax error, unexpected '}' in /home/mesquit1/public_html/local/displays.php on line 153 So remove this from the end of the file <? } ?> That clears the error but I get no data displayed. Is their something I need to add to the echo statements in the HTML about the ID?
-
Thanks have tried that and I get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mesquit1/public_html/local/displays.php on line 10 Here is the page http://mesquitechristmas.com/local/displays.php Here is the entire code for that page. <?php include ('db_connect.php'); if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT * FROM users WHERE id = $id;"; } $row = mysql_fetch_array($result); $displayname = $row["displayname"]; $displaytype = $row["displaytype"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $postal = $row["postal"]; $country = $row["country"]; $rating = $row['rating']; $votes = $row['votes']; { ?> <!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="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="Mesquite Texas Country Christmas" /> <meta name="keywords" content="Mesquite, Texas, Country Christmas" /> <meta name="author" content="NA" /> <link rel="stylesheet" type="text/css" href="/stylesheet.css" media="screen" title="FBC" /> <script type="text/javascript" src="drop_down.js"></script> <title>A Mesquite Country Christmas</title> </head> <body> <div id="wrap"> <a href="/index.html"> <img id="frontphoto" src="/images/header.png" width="760" height="237" alt="Mesquite Country Christmas" border="0"></a> <div id="menu"> <h2 class="hide">Menu:</h2> <ul id="avmenu"> <li><a href="/index.html">Home</a></li> <li><a href="/christmasstory.html">The Christmas Story</a></li> <li><a href="/directions.html">Directions</a></li> <li><a href="#">Information</a><ul> <li><a href="/information.html">Display Facts & Info</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/playlist.html">2008 Playlist</a></li> <li><a href="#">Christmas History</a></li> </ul></li> <li><a href="#">Photos</a> <ul> <li><a href="/2007photos.html">2007</a></li> </ul></li> <li><a href="#">Videos</a> <ul> <li><a href="/2007videos.html">2007</a></li> </ul></li> <li><a href="/guestbook.php">Guestbook</a></li> <li><a href="/webcam.html">Web Cam</a></li> <li><a href="/webradio.html">Internet Radio</a></li> <li><a href="http://www.noradsanta.org/" TARGET="_blank">Track Santa</a></li> <li><a href="/projects.html">Projects & How Tos</a></li> <li><a href="/links.html">Links</a></li> <li><a href="/contact_us.html">Contact Us</a></li> </ul> <center><a href="http://www.toysfortots.org/" TARGET="_blank"><img src="/images/toys_for_tots.jpg" border="0" width="110" height="153" vspace="10"></a></center> <center><a href="http://christmas.bronners.com/2007/house/534.html"><img src="http://christmas.bronners.com/voteforme/vote.jpg" border="0" width="110" height="153" alt="christmas decorations" vspace="10"></a></center> </div> <div id="content"> <div class="fadebox"> <h2><? echo $row['displayname']; ?></h2> <hr /> <br> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tbody> <tr> <td align="center"><img src="http://www.christmaslightfinder.com/images/submitted/11283740-large.jpg" class="border"></td> <p></p></td></tr><tr><td><center>Rated 0 from 0 people | <b>Rate This</b>: <a href="displays.php?id=397&rate=1">1</a> | <a href="displays.php?id=397&rate=2">2</a> | <a href="displays.php?id=397&rate=3">3</a> | <a href="displays.php?id=397&rate=4">4</a> | <a href="displays.php?id=397&rate=5">5</a> </td><td> </td></tr></tbody></table> <table align="center" style="border-top: 1px solid rgb(51, 102, 51);" border="0" cellpadding="4" cellspacing="0" width="100%"> <p><a name="info"><span class="title">About this Display...</span> <tbody><tr><td class="bg2" width="100"><b>Display Name</b>:</td><td class="bg2"><? echo $row['displayname']; ?></td></tr><tr><td class="bg1"><b>Display Type</b>:</td><td class="bg1"><? echo $row['displaytype']; ?></td></tr><tr><td class="bg2"><b>Description</b>:</td><td class="bg2"><? echo $row['description']; ?></td></tr><tr><td class="bg1"><b>Address</b>:</td><td class="bg1"><? echo $row['address']; ?><br><? echo $row['city']. "," . $row['state']. " " . $row['postal']; ?><br><? echo $row['country']; ?><br><a href="http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=search&countryid=US&addtohistory=&country=US&address=<? echo $row['address']; ?>&city=<? echo $row['city']; ?>&zipcode=<? echo $row['postal']; ?>&historyid=&submit=Get+Map" target="_NEW"><b>Get Directions</b></a></td></tr><tr><td class="bg2"><b>Website</b>:</td><td class="bg2"><a href="<? echo $row['website']; ?>" target="_blank"><? echo $row['website']; ?></a></td></tr><tr><td class="bg1"><b>Sponsor Links</b>:</td><td class="bg1"> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //displays google_ad_slot = "4239948836"; google_ad_width = 234; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </td></tr></tbody></table></p> </div> </div> </div> <div id="footer"> © 2007 Mesquite Country Christmas <br /> <br /> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //468x60, created 1/8/08 google_ad_slot = "0360766123"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> </body> </html> <? } ?> Where did I go wrong?
-
I am not sure how to explain this but here it goes. I have a page that is displaying information from a database as you can see on this page. All the information that is being outputted in the HTML is coming from the database. http://mesquitechristmas.com/local/displays.php Now notice the URL it is displays.php. I need to be able to use this same template but but change the output of data for each entry in the database. For example taking the URL from above and making it http://mesquitechristmas.com/local/displays.php?id=2 for that display Then to show another display using the same template and url it would change to http://mesquitechristmas.com/local/displays.php?id=3 while all using the same template only the data that is being shown it is is changing. Noticing the only thing that changes is the id number which is calling a certain row in the data base. Now each row in the database has a column called ID and it is auto increment. Now I know how to call a page within a php page but how do you do it so that you can use the same template but change what is outputted just from changing the URL ID from the database. I hope that makes sense. If you need another example look at this site. http://www.christmaslightfinder.com/displays.php?id=322 Then change the number at the end to like 323 or 324 etc. You will know the page stays the same only the data changes on the page changes. So I need to know how to do that by using the same template but changing the data by the id of the database and displaying it in the URL. -Thanks
-
I don't think this is working how I like. I have manually entered a image into the DB for testing. How would I display the image from the database? I think having the image stored in a file then having the URL stored in the DB would be easier and preferred. How would this be done? -Thanks
-
Actually it sounds a little more complicated then I would like to make it. I am just a designer so all I work with is HTML XHTML CSS etc. The guy that was in with me on this site that knows php and was suppose to do that part bailed because of other commitments. So I am just trying to keep this simple as possible. This is just a hobbyist site so I don't need anything real fancy or high tech with all the bells and whistles for security. Just as long as it serves it's purpose and functions I will be happy. I don't expect a lot of people to be using this but maybe 50 people tops if I am lucky. If someone wants to hack this little script more power to them. It would be like stealing from a blind and deaf man if they did it and it wouldn't hurt the rest of my site anyways. I could just install my backup and away I go again. Also the user would have to have cookies enabled for your method to work. I would really like to just stick with sessions as it seems as a easier way to go. So if anyone can help me with the problem I am currently having listed in my previous post that would be great.
-
Ok this is starting to make more sense now and come together. In the code above you mentioned this code, where do it go and how is it used? <?php $email = $_SESSION['email']; ?> I have a sessions.php page with this in it <?php session_start(); if(!isset($_SESSION['email'])) { header("location:login.php"); } ?> Then at the top of all the pages I want secure with sessions I use this. <php include ('session.php'); ?> Now I have set up a test query like this on the users.php page but it doesn't display anything and no error. I think because the session is set correctly. Anyways here is the test query I have on user.php <?php $result = mysql_query("SELECT * FROM users WHERE email='email'"); while($row = mysql_fetch_array($result)) { echo $row['displayname']; echo "<br />"; } ?> Now this is my login page, it checks if a field has been left empty but doesn't send an error for wrong password or email, it just refreshes the page. <?php session_start(); include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='" . md5($password) . "'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); header("location:user.php"); } } } ?> <!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="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="Mesquite Texas Country Christmas" /> <meta name="keywords" content="Mesquite, Texas, Country Christmas" /> <meta name="author" content="NA" /> <link rel="stylesheet" type="text/css" href="/stylesheet.css" media="screen" title="FBC" /> <script type="text/javascript" src="drop_down.js"></script> <title>A Mesquite Country Christmas - Login</title> </head> <body> <div id="wrap"> <a href="/index.html"> <img id="frontphoto" src="/images/header.png" width="760" height="237" alt="Mesquite Country Christmas" border="0"></a> <div id="menu"> <h2 class="hide">Menu:</h2> <ul id="avmenu"> <li><a href="/index.html">Home</a></li> <li><a href="/christmasstory.html">The Christmas Story</a></li> <li><a href="/directions.html">Directions</a></li> <li><a href="#">Information</a><ul> <li><a href="/information.html">Display Facts & Info</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/playlist.html">2008 Playlist</a></li> <li><a href="#">Christmas History</a></li> </ul></li> <li><a href="#">Photos</a> <ul> <li><a href="/2007photos.html">2007</a></li> </ul></li> <li><a href="#">Videos</a> <ul> <li><a href="/2007videos.html">2007</a></li> </ul></li> <li><a href="/guestbook.php">Guestbook</a></li> <li><a href="/webcam.html">Web Cam</a></li> <li><a href="/webradio.html">Internet Radio</a></li> <li><a href="http://www.noradsanta.org/" TARGET="_blank">Track Santa</a></li> <li><a href="/projects.html">Projects & How Tos</a></li> <li><a href="/links.html">Links</a></li> <li><a href="/contact_us.html">Contact Us</a></li> </ul> <center><a href="http://www.toysfortots.org/" TARGET="_blank"><img src="/images/toys_for_tots.jpg" border="0" width="110" height="153" vspace="10"></a></center> <center><a href="http://christmas.bronners.com/2007/house/534.html"><img src="http://christmas.bronners.com/voteforme/vote.jpg" border="0" width="110" height="153" alt="christmas decorations" vspace="10"></a></center> </div> <div id="content"> <div class="fadebox"> <h2>Login Now</h2> <hr /> <p>Log into your account to submit new displays as well as modify existing ones. Registration is free, so if you don't already have an account, <a href="/local/register.php">create one</a>!</p> <table width="28%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <table width="300" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="login.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong> User Login</strong></td> </tr> <tr> <td width="78"> Email:</td> <td width="294"><input name="email" type="text" id="email" size="30"></td> </tr> <tr> <td> Password:</td> <td><input name="password" type="password" id="password" size="30"></td> </tr> <tr> <td colspan="2" align="right" class="errorText"> <?PHP // then we check for the error message if (isset($error)) { echo $error . '<br />'; } ?> </td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> </td> </tr> <tr> <td><table width="300" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td> <p><a href="/local/forgot.php">Forgot Password</a> | <a href="/local/register.php">Register</a></p> </td> </tr> </table></td> </tr> </table> </div> </div> </div> <div id="footer"> © 2007 Mesquite Country Christmas <br /> <br /> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //468x60, created 1/8/08 google_ad_slot = "0360766123"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> </body> </html> Anyone know what I am leaving out or forgetting? -Thanks
-
Here is the entire code for this page. http://mesquitechristmas.com/local/submit.php Is this right? am I missing anything? They database setup is above. <?php // here, we check if the form has been submitted, because we need to handle // redirection before we handle outputting the HTML stuff. if (isset($_POST['submitted'])) { if (empty($_POST['displayname']) || empty($_POST['displaytype']) || empty($_POST['description']) || empty($_POST['address']) || empty($_POST['city']) || empty($_POST['state']) || empty($_POST['postal']) || empty($_POST['country']) || empty($_POST['imgdata'])) { $error = '*Please fill in all fields.'; // here, they have not filled in all fields. Set an error. } else { // MAKE CONNECTION include ('db_connect.php'); $displayname = $_POST['displayname']; $displaytype = $_POST['displaytype']; $description = $_POST['description']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $postal = $_POST['postal']; $country = $_POST['country']; $website = $_POST['website']; $website = $_POST['imgdata']; $imgdata = file_get_contents($_FILES['replacewithfieldname']['tmp_name']); mysql_query("INSERT INTO users (displayname, displaytype, description, address, address2, city, state, postal, country, website, imgdata) VALUES ('$displayname', '$displaytype', '$description', '$address', '$address2', '$city', '$state', '$postal', '$country', '$website', '$imgdata')")or die (mysql_error()); } } ?> <!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="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="Mesquite Texas Country Christmas" /> <meta name="keywords" content="Mesquite, Texas, Country Christmas" /> <meta name="author" content="NA" /> <link rel="stylesheet" type="text/css" href="/stylesheet.css" media="screen" title="FBC" /> <script type="text/javascript" src="drop_down.js"></script> <title>A Mesquite Country Christmas</title> </head> <body> <div id="wrap"> <a href="/index.html"> <img id="frontphoto" src="/images/header.png" width="760" height="237" alt="Mesquite Country Christmas" border="0"></a> <div id="menu"> <h2 class="hide">Menu:</h2> <ul id="avmenu"> <li><a href="/index.html">Home</a></li> <li><a href="/christmasstory.html">The Christmas Story</a></li> <li><a href="/directions.html">Directions</a></li> <li><a href="#">Information</a><ul> <li><a href="/information.html">Display Facts & Info</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/playlist.html">2008 Playlist</a></li> <li><a href="#">Christmas History</a></li> </ul></li> <li><a href="#">Photos</a> <ul> <li><a href="/2007photos.html">2007</a></li> </ul></li> <li><a href="#">Videos</a> <ul> <li><a href="/2007videos.html">2007</a></li> </ul></li> <li><a href="/guestbook.php">Guestbook</a></li> <li><a href="/webcam.html">Web Cam</a></li> <li><a href="/webradio.html">Internet Radio</a></li> <li><a href="http://www.noradsanta.org/" TARGET="_blank">Track Santa</a></li> <li><a href="/projects.html">Projects & How Tos</a></li> <li><a href="/links.html">Links</a></li> <li><a href="/contact_us.html">Contact Us</a></li> </ul> <center><a href="http://www.toysfortots.org/" TARGET="_blank"><img src="/images/toys_for_tots.jpg" border="0" width="110" height="153" vspace="10"></a></center> <center><a href="http://christmas.bronners.com/2007/house/534.html"><img src="http://christmas.bronners.com/voteforme/vote.jpg" border="0" width="110" height="153" alt="christmas decorations" vspace="10"></a></center> </div> <div id="content"> <div class="fadebox"> <h2> Submit your Lights</h2> <hr /> <p><img src="/images/christmas-lights.jpg" width="153" height="208" alt="Submit Lights" align="left" border="0" hspace="10"> Thank you for submitting your home to the Mesquites Country Christmas display finder database. There are some things you should know before submitting to make your experience a pleasant one.</p><p>First of all, we do not release your personal information to anyone for any reason. The only exception to this, obviously, is the address of the display, the website (if it has one), and a picture of the display.</p><p>Secondly, please have a picture available to use for your display. You won't be able to submit your display without one. When submitting a picture, please make sure that the file is less than one megabyte (1 Meg or 1024k), and if possible, resize it to 640x480. Please also be sure your picture is in JPG format.</p><p>Your display will not immediately be entered into the Christmas Light Finder database. We will first have to approve your submission. This is so that those unscrupulous folks out there can't submit unacceptable pictures (not family friendly). Please allow up to 48 hours to be included into the database, though, the time before insertion is usually much shorter than that.</p> </div> <div class="fadebox"> <h2> Ready to submit? Fill out the form below:</h2> <hr /> <br /> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td>Display Name*</td><td><input name="displayname" size="40" type="text"></td></tr> <tr> <td>Display Type*</td><td><select name="displaytype"><option value="Residential">Residential</option><option value="Neighborhood">Neighborhood</option><option value="Commercial">Commercial</option><option value="City/Government">City/Government</option><option value="Sponsored">Sponsored</option></select></td></tr> <tr><td>Description*</td><td><textarea name="description" cols="30" rows="5"></textarea></td></tr> <tr><td>Address*</td><td><input name="address" size="40" type="text"></td></tr><tr><td>Address 2</td><td><input name="address2" size="40" type="text"></td></tr> <tr><td>City*</td><td><input name="city" size="30" type="text" value="Mesquite"></td></tr> <tr><td>State/Province*</td><td><input name="state" size="30" type="text" value="Texas"></td></tr> <tr><td>Postal Code*</td><td><select name="postal"><option value="75149">75149</option><option value="75150">75150</option><option value="75180">75180</option><option value="75181">75181</option><option value="75185">75185</option><option value="75187">75187</option></select></td></tr> <tr><td>Country*</td><td><input name="country" size="30" type="text" value="United States"></td></tr> <tr><td>Website</td><td><input name="website" size="50" value="http://" type="text"></td></tr> <tr><td>Picture*</td><td><input type="file" name="imgdata" size="35"></td></tr> <tr> <td colspan="2" align="right" class="errorText"> <?PHP // then we check for the error message if (isset($error)) { echo $error . '<br />'; } ?> </td> </tr> <tr><td colspan="2" style="border-top: 1px solid black;" align="right"> <br /> <input name="submitted" value="Submit Now" type="submit"></td></tr> </tbody></table></form> <br>* Fields are required. <br> </div> </div> <div id="footer"> © 2007 Mesquite Country Christmas <br /> <br /> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //468x60, created 1/8/08 google_ad_slot = "0360766123"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> </body> </html>
-
What do you mean "use the following in the insert"? This is the PHP for the form.... <?php // here, we check if the form has been submitted, because we need to handle // redirection before we handle outputting the HTML stuff. if (isset($_POST['submitted'])) { if (empty($_POST['displayname']) || empty($_POST['displaytype']) || empty($_POST['description']) || empty($_POST['address']) || empty($_POST['city']) || empty($_POST['state']) || empty($_POST['postal']) || empty($_POST['country'])) { $error = '*Please fill in all fields.'; // here, they have not filled in all fields. Set an error. } else { // MAKE CONNECTION include ('db_connect.php'); $displayname = $_POST['displayname']; $displaytype = $_POST['displaytype']; $description = $_POST['description']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $postal = $_POST['postal']; $country = $_POST['country']; $website = $_POST['website']; mysql_query("INSERT INTO users (displayname, displaytype, description, address, address2, city, state, postal, country, website, imagefile) VALUES ('$displayname', '$displaytype', '$description', '$address', '$address2', '$city', '$state', '$postal', '$country', '$website')")or die (mysql_error()); } } ?>
-
Like I already stated and showed in my last post. I already have an ID field that is already auto_increment. MySQL doesn't allow for two fields in the same table to be auto_increment. That is why I ask how to just be able to add an image to the one I have now. As you notice I already have my image set to blob. Can I not just use the ID that is already being used for the table? So what do you mean by update the BLOB column with the $_FILES that was uploaded and assign it an ID?
-
Ok thanks for the help. I already had sessions set up and a sessions page that I would use an include state to call to each secure page and it worked. My login form and everything worked fine, the one I used above doesn't work. Also yes I have it restricted to where only one user to registered with one email address. It won't allow for multiple emails addresses to be registered. The reason I wanted to use the ID is because I have a column in my DB that is ID that is auto-increment. So would it be better to use the ID or the email to get the information?
-
Where do I put this exactly? I have this on the user.php page to test what is being shown on each log on. Right now it shows everything instead of just the information for that user that is logged in. What and where do I put to pull just the information for that user on the page when they log in? I am using this to display the information. <?PHP $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($result)) { echo "<br />"; echo $row['displayname']; echo "<br />"; } ?> -Thanks
-
Thank you that is a start but I already have a table with all the information. That explains how to do it with a new table but I don't need a new table. I need to add this to a table I already have so that the information is kept in the same row with the others users information. http://mesquitechristmas.com/local/submit.php Can I just add the image information to that table? Is the tutorial says I need an image_id but I have an ID already for the table and row I am using now. Here is the columns in the table I use now. What all do I need to add to this so I can use the same table? CREATE TABLE `users` ( `id` int(4) NOT NULL auto_increment, `email` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', `displayname` varchar(40) NOT NULL, `displaytype` varchar(40) NOT NULL, `description` longtext NOT NULL, `address` varchar(50) NOT NULL, `address2` varchar(50) NOT NULL, `city` varchar(10) NOT NULL, `state` varchar(5) NOT NULL, `postal` int(5) NOT NULL, `country` varchar(15) NOT NULL, `website` varchar(40) NOT NULL, `imagefile` blob NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=42 ; -Thanks
-
I have a form that allows for a image to be uploaded. I am not sure how to do this so I was hoping someone could point me to someplace I could read how to do this or explain to me how this can be done. Really what I am wanted is for the image to be uploaded to a file then renamed and the URL to that image in the file be entered in the DB. I already have the database built and the form and page built. So All I am really needing is to put the function together. Can anyone help me with this please? -Thanks
-
bump
-
Well currently the registration consists of email and desired password. That is what you use to login. Now in the Database I have a column named ID and is set it increment, so every new registration has a unique ID that I was wanting to use to make sure hey were different. So at the top of each secure page I have this code <? session_start(); if($_SESSION['hasLoggedIn']!=1) { header("Location: login.php"); } ?> Then on my login script is like this. <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='" . md5($password) . "'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); session_register("password"); header("location:user.php"); } } } ?> But I was thinking how do I know each person is being sent to their own unique control panel? Shouldn't the URL being something like user.php?id=1 or something a long those longs after they have logged in? -Thanks
-
Ok I have a registration form built and working. I have a login script built and working and sessions working and going to the User CP on login. Now the one thing I need to figure out is I need when each user logs in they are directed to their User CP like it does now, but I need User CP to show the members info on that page and just for them. I do want to make sure the registered members are logging into the User CP that is just able to be accessed by them with their information. I don't want the registered users to all be sent to the same page. I need it to be unique to that member because it will handle their display information about their Christmas display. I hope that makes sense. Any way to go about this to make sure this is happens? -Thanks
-
I am not sure I am following you, can you explain a little more about what you mean? That is how I want to do it, just store the image in a folder and have the DB store the URL and being to call it from their. How do I go about doing that. Is their anywhere you can point to read about this or explain this to me further? -Thanks
-
Ok I have figured out what my problem is I am just not sure how to fix it. Since when you register the password is entered into the database as MD5. So when you log in it needs to set as MD5 before the password on the login page. I am just not sure which password to put it in front of and how exactly. I have tried a few different ways but have failed Here is the code for the login page <?php session_start(); include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); session_register("password"); header("location:user.php"); } } } ?> -Thanks
-
Ok the error is working now, I was just testing the script and realized I need to add an error if someone enters the wrong login information, I will get to that though in a minute though. I tried to log in and it doesn't log in and go to the user.php You can try to test this at http://www.mesquitechristmas.com/local/login.php email: [email protected] password: 22250916 All it does it refresh with no error <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); session_register("password"); header("location:user.php"); } } } ?> -Thanks
-
The statement that is getting echoed is "does not enter the submit check" which is the last one on the code. I don't know what that means. I guess I must be tired but I am not understanding exactly where to insert this code in reference to what is already there. All their is no username, they register and login using their email and password they entered on the registration form. here is the current code <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { echo "it enters the part to show fields are field in(delete me once debugged as the headers will not work other wise)"; // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; session_register("email"); session_register("password"); header("location:user.php"); } } } echo "does not enter the submit check"; ?> -Thanks