Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. ssl means https "Hyper text transferr protocol secure" It's secure connection to whatever website you are visiting, and people can general jump in and out of ssl mode just changing the https://www.domainname.com over to http://www.domainname.com You can set a server redirect to always force a secure connection, you can even configure sessions and cookies to only run on a secure connection.  As far as getting the ssl hooked up, it depends on your webhost, some of them have it included you just have to sometimes send a photoid, so they know it's you, and sometimes they are dumb and just set it up anyway, some have it included, but some you have to pay extra for, and some don't even have it at all.  There are different levels to that as well, so some would cost more, adn some are more trusted that others, go to wikipedia.org and type in ssl
  2. http://desktoppub.about.com/gi/dynamic/offsite.htm?zi=1/XJ&sdn=desktoppub&zu=http%3A%2F%2Fwww.pyrus.com%2Fhtml%2Ffonmaker.html http://desktoppub.about.com/gi/dynamic/offsite.htm?zi=1/XJ&sdn=desktoppub&zu=http%3A%2F%2Fwww.high-logic.com%2Ffcp.html http://desktoppub.about.com/gi/dynamic/offsite.htm?zi=1/XJ&sdn=desktoppub&zu=http%3A%2F%2Fwww.pyrus.com%2Fhtml%2Ffontlab.html http://desktoppub.about.com/cs/fonteditors/gr/yourhandwriting.htm http://www.high-logic.com/fontcreator.html Those might get you started.
  3. My ideas on the process in general would be something like this The user pay's via paypal(I am assuming that's how they are paying to download), when paypal's ipn comes back you process the request(temporarily database that they have paid, and set them up a temp access id.  Have a login area, an area that is hidden to the public, in that login area, there is a master username/password it's universal for everyone, or even individual, however you want to do it.  Then you have all the files downloading there, and for them to get any of the links to work, they have to have a temporary passcode, that passcode can be stored in a database, and you can set up a script that every 24 hours(as ober said), it removes whatever passcodes are over 24 hours old, this removes access to everyone who doesn't have passcode.  As long as you htaccess (to prevent people from getting to the files folder), I don't think you would have anything to worry about.
  4. At this point, simply removing the height restriction seemed to have totally fixed the problem in all those browsers, thank you all for the help, as for the clearfix, I know what it's for now, I will look into it,maybe it can help me in other situations, thank you all for the help.
  5. I just happened across this post, I was going to try and help, but I ended up learning something, thanks for the info about aliases.
  6. I tried it, I put the div around everything but the footer, adn put that in the stylesheet, and had a class="clearfix" to the div, adn it didn't fix it.  I took it back off now, but I tried it, and it didn't work, any more advice, I don't understand this myself, wildteen is the one who helped me put this together, and it originally worked great, but when I started putting in content it went lower than I expected, plus me adding styles to it, I don't know if that's what caused it, but now it only messes up in firefox, they are even telling me it still looks great in higher resolutions.
  7. I did, actually it's already there, I didn't show the css file because it can be pulled through the browser, I was wondering if anyone saw what could be causing this, it isn't because of the layout, it's because the thing ended up going down further than I thought, the area with the advertising.
  8. You wouldn't have that problem if you did proper validation on submitting, you are adding unnecessary complexity to the program, when you can build in the feature, with just 3-4 lines of code, instead of throwing in another whole module.  Test for the job, here for a sample $selectjob = "SELECT * FROM jobs WHERE;";  // on the were part use something that distinguishes the jobs, like the title and description, or something you know would be a double post. $query = mysql_query($selectjob); if ($row = mysql_fetch_array($query)) { echo "This job was already entered into the database, you are attempting to double post it.<br />"; } you could also add a feature like craigslist has, they use search to test title and description on entry, and don't let any posts that are too similar like. the search would be based on something, say description adn title. $title = mysql_real_escape_string($_POST['title']); $description = mysql_real_escape_string($_POST['description']); $search = "SELECT * FROM jobs WHERE title LIKE '%$title' OR description LIKE '%$description';"; $query = mysql_query($query); if ($row = mysql_fetch_array($query)) { echo "Your posting was already put in the database, please only post once.<br />"; } THe chances for the posting to have somethign similar already are next to impossible, craigslist using something almost the same.
  9. He probably means how to validate with dreamweaver because <input type="hidden" name="MM_insert" value="flights"> The MM before something means Macro Media, You can tell one from a mile away by the big MM before it.  This is probably a form created by dreamweaver, I don't know how to validate using dreamweaver, you can just program it yourself like [code]<?php $errorhandler = ""; if ($variable == "") { $errorhandler .= "The variable name was left blank please fix this.<br />"; } if ($variable2 == "") $errorhandler .= "The variable2 name was left blank please fix this.<br />"; } if ($errorhandler != "") { echo "<div style=\"color:red;\">"; echo $errorhandler; echo "</div>"; } ?>[/code] this is something basic you can just build onto it from there, if you need more help ask.
  10. [code]<a href="moredetails.php" title="More Details">Click here for more details</a>[/code] If that is all you want, you have to be more specific.
  11. www.thecampussource.com for some reason the footer, the part with rentals, is overlapping hte footer slightly for some reason, any ideas on how to fix it.
  12. $variable1 = ($_GET['variable1']) ? $_GET['variable1'] : ""; WHat does that mean?
  13. ok, I see now the first problem, thanks for that. Can you help me further on one thing, what do you mean by if ($price{0} == "$") { Is that a quick way to check a variables character position. How else can this be used, more of what does it mean, I have never seen it before.
  14. if you want to make your pages safe, putting variable code near the top of each page fixes all problems. For instance if a form is getting submitted, go to the page that it is getting submitted to, and prepare them all Like they should be done anyway $variable1 = $_GET['variable1'] $variable2= $_GET['variable2'] if your not sure whether they are coming from get or post, or your not That good at php yet, to know which is which, then for each variable put if ($_GET['variablename']) { $variablename = $_GET['variablename']; }elseif ($_POST['variablename']) { $variablename = $_POST['variablename']; } and do that for each variable it'll solve most of your register global problems.
  15. onfucus, onblur then all you have to do is click in the field to get the value.
  16. [code]<?php $variable = "all that information you had"; $variable = explode(0,2, $variable); // I think this will cut it like that, something with explode, implode, or substr, don't feel like looking right now $variable = wordwrap(); // you just have to enter the parameters for word wrap ?> That should put you in the right direction at least[/code]
  17. I know "why" they are happening, I am wondering if there is a way to fix this or not.
  18. post4.php(this is where I handle that validation for multiple variables, based on category and sub-category) [code]<?php session_start(); ?> <!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> <?php include '../includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion ?> </head> <body> <div id="wrap"> <?php include '../includes/header.inc.php'; // inserts header, logo, and everything up there ?>     <br style="clear: both;" /> <?php include '../includes/leftnav.inc.php'; // inserts left navigation ?>     <div id="content">         <div class="overall"> <h3>Ad Posting Process</h3> <?php // connecting to database, selecting database mysql_connect("mysql185.secureserver.net", "#####", "######"); mysql_select_db("joyel"); $number = mysql_real_escape_string($_POST['number']); switch ($number) {  // begin switch case "1": // post set number 1 database work // Items and events categories $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $price = mysql_real_escape_string($_POST['price']); if (isset($_POST['eventdate'])) { $eventdate = mysql_real_escape_string($_POST['eventdate']); } if (!isset($_POST['eventdate'])) { $eventdate = "None"; } $description = mysql_real_escape_string($_POST['description']); $dateentered = date("m/d/y"); $zipcode = mysql_real_escape_string($_POST['zipcode']); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/itemsandevents/".basename($_FILES['userfile']['name']); $file = "/upload/itemsandevents/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file.<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if (isset($price)) { if (!is_numeric($price)) { $errorhandler .= "The Price value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $price)){   $errorhandler .= "Please remove the $ symbol from the price field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&price={$price}&description={$description}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo (categoryname, subcategoryname, schoolname, userid, itemtitle, price, description, zipcode, uploadurl, uploadname, dateentered, expiredate, eventdate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$price', '$description', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires', '$eventdate');"; if (mysql_query($insert)) { ?> <p>Thank you for submitting your post.  We recommend that you check your post to ensure that all the information is correct.  You can view, edit, or delete your post by clicking the “My Account” link in the left navigation bar.</p> <?php }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "2": // post set number 3 database work // Found items from the lost and found category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $description = mysql_real_escape_string($_POST['description']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $datefound = mysql_real_escape_string($_POST['datefound']); $locationfound = mysql_real_escape_string($_POST['locationfound']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&description={$description}&datefound={$datefound}&locationfound={$locationfound}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo(categoryname, subcategoryname, schoolname, userid, itemtitle, description, locationfound, zipcode, datefound, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$description', '$locationfound', '$zipcode', '$datefound', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "3": // post set number 2 database work // lost items from the lost and found category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $reward = mysql_real_escape_string($_POST['reward']); $description = mysql_real_escape_string($_POST['description']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $datelost = mysql_real_escape_string($_POST['datelost']); $locationlost = mysql_real_escape_string($_POST['locationlost']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/lostitemfiles/".basename($_FILES['userfile']['name']); $file = "./upload/lostitemfiles/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file.<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if (isset($reward)) { if (!is_numeric($reward)) { $errorhandler .= "The Reward value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $reward)){   $errorhandler .= "Please remove the $ symbol from the reward field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&reward={$reward}&description={$description}&datelost={$datelost}&locationlost={$locationlost}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo(categoryname, subcategoryname, schoolname, userid, itemtitle, reward, description, uploadurl, uploadname, locationlost, zipcode, datelost, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$reward', '$description', '$file', '$newfiletemp', '$locationlost', '$zipcode', '$datelost', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "4": // post set number 5 database work // Work offered by students category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $wage = mysql_real_escape_string($_POST['wage']); $description = mysql_real_escape_string($_POST['description']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/workofferedby/".basename($_FILES['userfile']['name']); $file = "./upload/workofferedby/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if (isset($wage)) { if (!is_numeric($wage)) { $errorhandler .= "The wage value has to be Numbers only.<br />"; } } if (preg_match("/^\$/", $wage)){   $errorhandler .= "Please remove the $ symbol from the wage field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&wage={$wage}&description={$description}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo(categoryname, subcategoryname, schoolname, userid, itemtitle, wage, description, zipcode, uploadurl, uploadname, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$wage', '$description', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "5": // post set number 6 database work // work offered to students category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $wage = mysql_real_escape_string($_POST['wage']); $hoursperweek = mysql_real_escape_string($_POST['hoursperweek']); $description = mysql_real_escape_string($_POST['description']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/workofferedto/".basename($_FILES['userfile']['name']); $file = "./upload/workofferedto/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file.<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if (isset($wage)) { if (!is_numeric($wage)) { $errorhandler .= "The wage value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $wage)){   $errorhandler .= "Please remove the $ symbol from the wage field.<br />"; } } if (isset($hoursperweek)) { if (!is_numeric($hoursperweek)) { $errorhandler .= "The Hours Per Week value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $hoursperweek)){   $errorhandler .= "Please remove the $ symbol from the Hours Per Week field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&wage={$wage}&hoursperweek={$hoursperweek}&description={$description}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo(categoryname, subcategoryname, schoolname, userid, itemtitle, wage, hoursperweek, description, zipcode, uploadurl, uploadname, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$wage', '$hoursperweek', '$description', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "6": // Post set number 7 database // texts subcategory under the academics category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $coursenumber = mysql_real_escape_string($_POST['coursenumber']); $title = mysql_real_escape_string($_POST['title']); $author = mysql_real_escape_string($_POST['author']); $price = mysql_real_escape_string($_POST['price']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/textbooks/".basename($_FILES['userfile']['name']); $file = "./upload/textbooks/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($title == "" || $author == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if (isset($price)) { if (!is_numeric($price)) { $errorhandler .= "The Price value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $price)){   $errorhandler .= "Please remove the $ symbol from the price field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&coursenumber={$coursenumber}&title={$title}&author={$author}&price={$price}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo (categoryname, subcategoryname, schoolname, userid, coursenumber, title, author, price, zipcode, uploadurl, uploadname, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$coursenumber', '$title', '$author', '$price', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "7": // Post set number 8 database // Notes And Cheat Sheets subcategory under the academics category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $coursenumber = mysql_real_escape_string($_POST['coursenumber']); $test = mysql_real_escape_string($_POST['test']); $professor = mysql_real_escape_string($_POST['professor']); $zipcode = mysql_real_escape_string($_POST['zipcode']); $dateentered = date("m/d/y"); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/notesandcheatsheets/".basename($_FILES['userfile']['name']); $file = "./upload/notesandcheatsheets/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file.<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($coursenumber == "") { $errorhandler .= "The course number was required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&coursenumber={$coursenumber}&test={$test}&professor={$professor}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo (categoryname, subcategoryname, schoolname, userid, coursenumber, test, professor, zipcode, uploadurl, uploadname, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$coursenumber', '$test', '$professor', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; case "8": // Post set number 4 database // Everything under the rentals category $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $postinfo = mysql_real_escape_string($_POST['postinfo']); // table used in db $schoolname = mysql_real_escape_string($_SESSION['schoolaccess']); $userid = mysql_real_escape_string($_SESSION['userid']); $itemtitle = mysql_real_escape_string($_POST['itemtitle']); $priceperunit = mysql_real_escape_string($_POST['priceperunit']); $numberofunits = mysql_real_escape_string($_POST['numberofunits']); $description = mysql_real_escape_string($_POST['description']); $dateentered = date("m/d/y"); $zipcode = mysql_real_escape_string($_POST['zipcode']); $expires = date("m/d/y", strtotime("+30 days")); $errorhandler = ""; // file handling if ($_FILES['userfile']['name']) { $newfile = "../upload/rentals/".basename($_FILES['userfile']['name']); $file = "./upload/rentals/".basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['name']; $newfiletemp = "{$_FILES[userfile][tmp_name]}"; $_accepted_extensions = array('.jpg', '.png', '.txt', '.gif', '.bmp', '.jpeg', '.doc', '.pdf'); $tmp = pathinfo($_FILES['userfile']['name']); if (in_array('.' . $tmp['extension'],$_accepted_extensions)) { }else { $errorhandler .= "Incorrect file extension.<br />"; $errorhandler .= "We accept .jpg, .png, .txt, .gif, .bmp, .jpeg, .doc, and .pdf "; $errorhandler .= "file formats, please make sure you are uploading the correct "; $errorhandler .= "file format or contact administration to find out what is "; $errorhandler .= "causing the problem.<br />"; $die = "stop"; } if (file_exists($newfile)) { $errorhandler .= "The file already exists.<br />"; $die = "stop"; } if ($die != "stop") { if (!move_uploaded_file($newfiletemp, $newfile)) { $errorhandler .= "There was some sort of problem moving the file.<br />"; } } }else { $file = "null"; $newfile = "null"; $newfiletemp = "null"; } // end file handling if ($itemtitle == "" || $description == "") { $errorhandler .= "The title and description were required.  Please click the link "; $errorhandler .= "below to go back and fix the mistakes.<br />"; } if (isset($priceperunit)) { if (!is_numeric($priceperunit)) { $errorhandler .= "The Price Per Unit value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $priceperunit)){   $errorhandler .= "Please remove the $ symbol from the price Per Unit field.<br />"; } } if (isset($numberofunits)) { if (!is_numeric($numberofunits)) { $errorhandler .= "The Number Of Units value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $numberofunits)){   $errorhandler .= "Please remove the $ symbol from the Number Of Units field.<br />"; } } if ($errorhandler != "") { echo $errorhandler; echo "<br />"; echo "<a href=\"post3.php?category={$category}&subcategory={$subcategory}&postinfo={$postinfo}&itemtitle={$itemtitle}&priceperunit={$priceperunit}&numberofunits={$numberofunits}&description={$description}&zipcode={$zipcode}\" title=\"Go Back\">Go back and fix errors</a>"; } if ($errorhandler == "") { $insert = "INSERT INTO $postinfo (categoryname, subcategoryname, schoolname, userid, itemtitle, priceperunit, numberofunits, description, zipcode, uploadurl, uploadname, dateentered, expiredate) VALUES ('$category', '$subcategory', '$schoolname', '$userid', '$itemtitle', '$priceperunit', '$numberofunits', '$description', '$zipcode', '$file', '$newfiletemp', '$dateentered', '$expires');"; if (mysql_query($insert)) { echo "Thank you for submitting the post. "; echo "You can edit your posts by logging into your account at any time and clicking "; echo "on edit posts in the left navigation.<br />"; }else { echo "There was a problem submitting your post.  Please try again, or contact us.<br />"; } } break; } // end switch ?>         </div>     </div> <?php include '../includes/banner.inc.php'; // includes the banner, randomly selected from a database ?> <?php include '../includes/footer.inc.php'; // includes the page footer, bottom navigation copyright ?> </div> </body> </html>[/code]
  19. post3.php(Page that choose a form based on category and sub-category, any thing taking numbers is what I am validating with the code from the other post. [code]<?php session_start(); ?> <!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> <?php include '../includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion ?> </head> <body> <div id="wrap"> <?php include '../includes/header.inc.php'; // inserts header, logo, and everything up there ?>    <br style="clear: both;" /> <?php include '../includes/leftnav.inc.php'; // inserts left navigation ?>    <div id="content">        <div class="overall"> <h3>Ad Posting Process</h3> <?php // connecting to database, selecting database mysql_connect("mysql185.secureserver.net", "#####", "####"); mysql_select_db("joyel"); // below I set the variables depending.  If it's coming from further up the page they are set to post, because they are coming from the previous form, otherwise they are coming from the next page, back to this one via get, this allows the form fields to repopulate. if ($_GET['category']) { $category = $_GET['category']; }else { $category = $_POST['categoryname']; } if ($_GET['subcategory']) { $subcategory = $_GET['subcategory']; }else { $subcategory = $_POST['subcategory']; } if ($_GET['postinfo']) { $postinfo = mysql_real_escape_string($_GET['postinfo']); }else { $postinfo = mysql_real_escape_string($_POST['postinfo']); } // below get's hairy.  based on the contents of cat and subcat different things happen. if ($category == "Item" || $category == "Events") { // if the category is item ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="1" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="120" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="price">Price:</label><br /> <input name="price" id="price" type="text" maxlength="100" value="<?php echo $_GET['price']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <?php if ($category == "Events") { ?> <label for="eventdate">Event Date:</label><br /> <input name="eventdate" id="eventdate" type="text" maxlength="30" /><br /> <?php } ?> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } // end the if for category equals item if ($category == "Lost and Found") { if ($subcategory == "Items Found") { if ($_GET['postinfo']) { $postinfo1 = mysql_real_escape_string($_GET['postinfo']); }else { $postinfo1 = mysql_real_escape_string($_POST['postinfo_op2']); } ?> <form name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo1; ?>" /> <input name="number" id="number" type="hidden" value="2" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="200" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <label for="datefound">Date Found:</label><br /> <input name="datefound" id="datefound" type="text" maxlength="120" value="<?php echo $_GET['datefound']; ?>" /><br /> <label for="locationfound">Location Found:</label><br /> <input name="locationfound" id="locationfound" type="text" maxlength="120" value="<?php echo $_GET['locationfound']; ?>" /><br /> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } if ($subcategory == "Items Lost") { if ($_GET['postinfo']) { $postinfo2 = mysql_real_escape_string($_GET['postinfo']); }else { $postinfo2 = mysql_real_escape_string($_POST['postinfo_op1']); } ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo2; ?>" /> <input name="number" id="number" type="hidden" value="3" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="200" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="reward">Reward:</label><br /> <input name="reward" id="reward" type="text" maxlength="120" value="<?php echo $_GET['reward']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <label for="datelost">Date Lost:</label><br /> <input name="datelost" id="datelost" type="text" maxlength="120" value="<?php echo $_GET['datelost']; ?>" /><br /> <label for="locationlost">Location Lost:</label><br /> <input name="locationlost" id="locationlost" type="text" maxlength="120" value="<?php echo $_GET['locationlost']; ?>" /><br /> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } } if ($category == "Work (offered by students)") { ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="4" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="200" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="wage">Wage:</label><br /> <input name="wage" id="wage" type="text" maxlength="120" value="<?php echo $_GET['wage']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } if ($category == "Work (offered to students)") { ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="5" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="200" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="wage">Wage:</label><br /> <input name="wage" id="wage" type="text" maxlength="120" value="<?php echo $_GET['wage']; ?>" /><br /> <label for="hoursperweek">Hours Per Week:</label><br /> <input name="hoursperweek" id="hoursperweek" type="text" maxlength="120" value="<?php echo $_GET['wage']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } if ($category == "Academics") { if ($subcategory == "Textbooks") { if ($_GET['postinfo']) { $postinfo = mysql_real_escape_string($_GET['postinfo']); }else { $postinfo = mysql_real_escape_string($_POST['postinfo_op1']); } ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="6" /> <label for="coursenumber">Course Number:</label><br /> <input name="coursenumber" id="coursenumber" type="text" maxlength="120" value="<?php echo $_GET['coursenumber']; ?>" /><br /> <label for="title">*Title:</label><br /> <input name="title" id="title" type="text" maxlength="200" value="<?php echo $_GET['title']; ?>" /><br /> <label for="author">*Author:</label><br /> <input name="author" id="author" type="text" maxlength="120" value="<?php echo $_GET['author']; ?>" /><br /> <label for="price">Price:</label><br /> <input name="price" id="price" type="text" maxlength="120" value="<?php echo $_GET['price']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } if ($subcategory == "Notes" || $subcategory == "Cheat Sheets") { if ($_GET['postinfo']) { $postinfo = mysql_real_escape_string($_GET['postinfo']); }else { $postinfo = mysql_real_escape_string($_POST['postinfo_op2']); } ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="7" /> <label for="coursenumber">*Course Number:</label><br /> <input name="coursenumber" id="coursenumber" type="text" maxlength="120" value="<?php echo $_GET['coursenumber']; ?>" /><br /> <label for="test">Test:</label><br /> <input name="test" id="test" type="text" maxlength="200" value="<?php echo $_GET['test']; ?>" /><br /> <label for="professor">Professor:</label><br /> <input name="professor" id="professor" type="text" maxlength="200" value="<?php echo $_GET['professor']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } } if ($category == "Rentals") { ?> <form enctype="multipart/form-data" name="post3" id="post3" action="post4.php" method="post"> <input name="category" id="category" type="hidden" value="<?php echo $category; ?>" /> <input name="subcategory" id="subcategory" type="hidden" value="<?php echo $subcategory; ?>" /> <input name="postinfo" id="postinfo" type="hidden" value="<?php echo $postinfo; ?>" /> <input name="number" id="number" type="hidden" value="8" /> <label for="itemtitle">*Item Title:</label><br /> <input name="itemtitle" id="itemtitle" type="text" maxlength="200" value="<?php echo $_GET['itemtitle']; ?>" /><br /> <label for="priceperunit">Price Per Unit:</label><br /> <input name="priceperunit" id="priceperunit" type="text" maxlength="120" value="<?php echo $_GET['priceperunit']; ?>" /><br /> <label for="numberofunits">Number Of Units:</label><br /> <input name="numberofunits" id="numberofunits" type="text" maxlength="120" value="<?php echo $_GET['numberofunits']; ?>" /><br /> <label for="zipcode">Zipcode:</label><br /> <input name="zipcode" id="zipcode" type="text" maxlength="30" value="<?php echo $_GET['zipcode']; ?>" /><br /> <label for="description">*Description:</label><br /> <textarea name="description" id="description" rows="10" cols="30"><?php echo $_GET['description']; ?></textarea><br /> <p>Upload Picture:</p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input name="userfile" id="userfile" type="file" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> <?php } ?>        </div>    </div> <?php include '../includes/banner.inc.php'; // includes the banner, randomly selected from a database ?> <?php include '../includes/footer.inc.php'; // includes the page footer, bottom navigation copyright ?> </div> </body> </html>[/code]
  20. post.php(The first page of the form process, where they choose category) [code]<?php session_start(); if ($_SESSION['controller'] != true) { header("Location: /login.php"); } ?> <!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> <?php include './includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion ?> </head> <body> <div id="wrap"> <?php include './includes/header.inc.php'; // inserts header, logo, and everything up there ?>    <br style="clear: both;" /> <?php include './includes/leftnav.inc.php'; // inserts left navigation ?>    <div id="content">        <div class="overall"> <p>Please choose a category for your posting.</p> <form name="postad" id="postad" action="processors/post2.php" method="post"> <label for="category">Category:</label><br /> <select name="category" id="category"> <option>Item</option> <option>Events</option> <option>Lost and Found</option> <option>Work (offered by students)</option> <option>Work (offered to students)</option> <option>Academics</option> <option>Rentals</option> </select><br /> <input name="submit" type="submit" value="Next" /> </form>        </div>    </div> <?php include './includes/banner.inc.php'; // includes the banner, randomly selected from a database ?> <?php include './includes/footer.inc.php'; // includes the page footer, bottom navigation copyright ?> </div> </body> </html>[/code] post2.php(Where they choose sub-category) [code]<?php session_start(); ?> <!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> <?php include '../includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion ?> </head> <body> <div id="wrap"> <?php include '../includes/header.inc.php'; // inserts header, logo, and everything up there ?>    <br style="clear: both;" /> <?php include '../includes/leftnav.inc.php'; // inserts left navigation ?>    <div id="content">        <div class="overall"> <h3>Ad Posting Process</h3> <?php // connecting to database, selecting database mysql_connect("mysql185.secureserver.net", "####", "#####3"); mysql_select_db("joyel"); // safety $category = $_POST['category']; // switch case to determine what sub-categories appear echo "<form name=\"post2\" id=\"post2\" action=\"post3.php\" method=\"post\">\n"; switch ($category) { case "Item": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo\" id=\"postinfo\" type=\"hidden\" value=\"postset1\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; // break to stop switch statement case "Events": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo\" id=\"postinfo\" type=\"hidden\" value=\"postset1\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; case "Lost and Found": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo_op1\" id=\"postinfo_op1\" type=\"hidden\" value=\"postset2\" />"; echo "<input name=\"postinfo_op2\" id=\"postinfo_op2\" type=\"hidden\" value=\"postset3\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; case "Work (offered by students)": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo\" id=\"postinfo\" type=\"hidden\" value=\"postset5\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; case "Work (offered to students)": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo\" id=\"postinfo\" type=\"hidden\" value=\"postset6\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; case "Academics": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo_op1\" id=\"postinfo_op1\" type=\"hidden\" value=\"postset7\" />"; echo "<input name=\"postinfo_op2\" id=\"postinfo_op1\" type=\"hidden\" value=\"postset8\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; case "Rentals": $select = "SELECT * FROM categoryinformation WHERE categoryname = '$category';"; $query = mysql_query($select); echo "<select name=\"subcategory\" id=\"subcategory\">\n"; while ($row = mysql_fetch_array($query)) { echo "<option>" . stripslashes($row['subcategoryname']) . "</option>\n"; } echo "</select>\n"; echo "<input name=\"postinfo\" id=\"postinfo\" type=\"hidden\" value=\"postset4\" />"; echo "<input name=\"categoryname\" id=\"category\" type=\"hidden\" value=\"$category\" />"; break; } echo "<br />"; echo "<input name=\"submit\" id=\"submit\" type=\"submit\" value=\"next\" />"; echo "</form>"; ?>        </div>    </div> <?php include '../includes/banner.inc.php'; // includes the banner, randomly selected from a database ?> <?php include '../includes/footer.inc.php'; // includes the page footer, bottom navigation copyright ?> </div> </body> </html>[/code]
  21. [b]Website Information[/b] URL: [url=http://www.thecampussource.com]http://www.thecampussource.com[/url] Problem Pages- All [b]Problem Information[/b]   9-24-06 I recieved an email from my client, they had some changes they wanted to be made within there website (www.thecampussource.com).  I looked over there notes, and as I always do with clients, began knocking stuff off the list one after another.  Then I ran into 2 statements, that didn't strike me as odd because of the situation, and I had also noticed this.  As a Web Developer I know what causes this, but I didn't think there was a fix for it.  These are the 2 seperate things they said to me, and the first one, I saw happen for myself. Quote 1- [quote]Sometimes when I hit back it says page has expired[/quote] Quote 2- [quote]When using Mozilla, when you switch schools then browse and hit the back button, a popup comes up that says, "The page you are trying to view contains POSTDATA that has expired from cache. If you resent the data, any action the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel."[/quote] [b]Theory of problem[/b] In order to keep the selected schools working properly, I have to make the form send it to index.php, and sometimes it comes from links, so I set up a session instead to lessen the amount of difficulties, I was also recieving this problem when attempting get and post.  But I don't know of a fix for this, or totally why it's happening, now in terms that I can explain.
  22. [code] if (isset($price)) { if (!is_numeric($price)) { $errorhandler .= "The Price value has to be Numbers only.<br />"; } if (preg_match("/^\$/", $price)){     $errorhandler .= "Please remove the $ symbol from the price field.<br />"; } }[/code] [b]File Structure[/b] Area around where I am having the problem It is a posting system spread throughout 5 pages. Page 1- select category Page 2- select subcategory Page 3- Using category, and subcategory, it uses the appropriate case, from a switch statement to show the proper form. page 4- processes using a switch statement based on a form. Problem Pages(Page 3, going to Page 4) [b]Intended Functioning[/b] [list] [*]Check if the field is set. [*]If it's set check to make sure it's of a numeric value(a rough validation) [*]check to see if a dollar sign if present, if it is return a value [/list] [b]Current Functioning[/b] [list] [*]Check if the field was set(but with problems *See footnote 1) [*]Checks to see if it's a number(rough validation), if it isn't then it returns an error(as intended) [*]Checks to see if there is a dollar sign present.(but with problems *See footnote 2, See credit 1) [/list] [b]Foot Notes[/b] [list] [*]Footnote 1- It tries to detect the existence of the field, even when it is not present.  It was working, when I inserted the extra code to validate dollar sign, it now tries to read the existence of the field, whether it was left blank or not.  This is not good, as this field was intended to be optional, but if chosen needs to be validated properly. [*]Footnote 2- When I first call the post4.php page from post3.php it tells me that it detected the existence of the variable.  Then it tries to run the validation on that variable, and ends up returning an error saying remove the dollar sign, when there was no dollar sign, or no variable set. [/list] [b]Credits[/b] [list] [*]Credit 1- Courtesy of Huggie Bear from a post on http://www.phpfreaks.com (thank you) [/list]
×
×
  • 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.