Jump to content

flipper828

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by flipper828

  1. Thank you for analyzing for me. It looks like I have a lot more to learn. I'm off to research the things you mentioned.
  2. Hello, I have the following upload script that actually worked until I tried to add file type specifications. I can't figure out what I did wrong. I have been piecing things together so there is no telling what is wrong. Help me please? <?php $fileName = $_FILES["file1"]["name"]; // The file name $fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder $fileType = $_FILES["file1"]["type"]; // The type of file it is $fileSize = $_FILES["file1"]["size"]; // File size in bytes $fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true if (!$fileTmpLoc) { // if file not chosen echo "ERROR: Please browse for a file before clicking the upload button."; exit(); } if ($fileType=="image/png" || $fileType=="image/gif" || $fileType=="image/jpg") // checking file type echo "ERROR: Only file types .png, .gif or .jpg may be uploaded"; exit(); } if(move_uploaded_file($fileTmpLoc, "image_uploads/$fileName")){ echo "$fileName upload is complete"; } else { echo "move_uploaded_file function failed"; } ?> Thanks.
  3. Thank you gizmola. If I understand this properly. I should use the php upload script to get the file uploaded and then use the move_uploaded_file to move them to the proper directories?
  4. Hello again, Pros! I need an advisory jump start so I don't have any code or examples to show. And I am not asking for any code. Just advise on the best possible way to proceed with my project.. PROJECT : I am trying to build a system that will allow me to upload video files to several different categories within several different categories etc. Boy...that sounds confusing already. First let me start by saying the video files are home recordings of reviews for my whole family's use and are not illegal in any way at all. This is what I want to be able to do: I have video files that fit into several different states (3). Within the first state I have 2 cities - within the second state I have 5 cities - and in the third state I have 1 city. Within all the cities are 5 different categories. I want to be able to upload them like so..... State1 | City1 | Category1 | video lands here. State1 | City1 | Category4 | video lands here. I am familiar with the php video upload script but from everything I have read, it will only upload to one directory. I don't know how to go about getting the videos into the correct directory. I thought about using a database driven drop down menu with an upload script for each state, city, category. I am willing to setup all the directories and scripts do this if its the best way but before I spend hours and hours testing all this, I thought I would check with you experts first. Is there a better way than what I am thinking? Thanks again in advance for your time and patience with me. CR
  5. Thank you, Pyscho. I actually learned that time out script from an intro to php class. I just assumed it was correct. Shame on me for assuming!!! Your answer seems a lot easier than what i'm doing now. So now I will do some research on how to configure a time out on the server. Thank you again.
  6. Hello Pros! I have set up a secure login page. Here's what I need: When a user times out and then refreshes the page, I want the system to take them back to a login page within the formatting and styling I have set for the rest of the website. My problem: One page works exactly as I want it to work. However, every other page displays the page with just my header and footer and the message I have set up in the session check. I hope I am describing this correctly. Here is the time out script on the top of my index.php. I have the time set to 5 minutes for testing purposes. I will lengthen this after I get it to work properly. <?php session_start(); ?> <?php if (isset($_SESSION['time'])) { $current = strtotime(date("Y-m-d H:i:s")); $login = $_SESSION['time']; $active = $current - $login; if ($active > 300) { unset($_SESSION['time']); unset($_SESSION['flusers']); } } else { $_SESSION['time'] = strtotime(date("Y-m-d H:i:s")); } ?> Here is the page that works properly. In other words, after the time out, the user is directed back to the login page. <?php if (!isset($_SESSION['lnusers'])) { echo "<h2>Sorry, you have not logged into the system</h2>\n"; echo "<a href=\"index.php\">Please login</a>\n"; } else { echo "<div id=\"wrapper\"> <div id=\"ccontent\"> <div id=\"cleftcolumn\"> <p>RESOURCE<br />CENTER</p> <br /> <br /><br /> <table width=\"100%\" cellpadding=\"3\"> <tr> <td> <h3 style=\"color:#042252;\">Welcome! </h3> <br /> <br /> </td> </tr> <tr><td><strong><a href=\"index.php?content=main\">Resource Center Home</a></strong></td></tr> <tr><td><a href=\"index.php?content=contactus\"><strong>Contact Us</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=holidayschedule\"><strong>Holiday Schedule</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=verdochome\"><strong>Lincoln Documents</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=ugitems\"><strong>Lincoln Group Items Board</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=lnnews\"><strong>Lincoln Group News Listing<strong></a></td></tr> </table> </div> <div id=\"crscrollArea\">\n"; $loginid = $_SESSION['flusers']; $query = "SELECT name FROM lnusers WHERE loginid = '$loginid'"; $result=mysql_query($query); $row=mysql_fetch_array($result, MYSQL_ASSOC); $name = $row['name']; echo "<h2>Welcome, $name</h2><br />\n"; $date = date("l, F j, Y"); echo "<h2>Today's date: $date</h2><br />\n"; echo "<table width=\"100%\" border=\"0\"> <tr> <td><hr size=\"1\" noshade=\"noshade\"></td> </tr> <tr> <td><h4>Breaking News!</h4><br /></td> </tr> <tr> <td> <a style=\"font-size:10pt; color:#042252;\" href=\"index.php?content=newsItems/Lincoln\">Licoln</a></p><br /> </td> </tr> <tr> <td> <a style=\"font-size:10pt; color:#042252;\" href=\"index.php?content=newsItems/socialupdate\">Social Update</a></p><br /> </td> </tr> </table> </div> </div> </div>\n"; } ?> And here is the page that will not behave. For some reason, after this page times out and the page is refreshed, it throws out all the formatting and styles and displays "Sorry, you have not logged into the system". "Please login" is a link that leads back to the login page. <?php if (!isset($_SESSION['lnusers'])) { echo "<h2>Sorry, you have not logged into the system</h2>\n"; echo "<a href=\"index.php\">Please login</a>\n"; } else { echo "<div id=\"wrapper\"> <div id=\"ccontent\"> <div id=\"cleftcolumn\"> <p>RESOURCE<br />CENTER</p> <br /> <br /><br /> <table width=\"100%\" cellpadding=\"3\"> <tr> <td> <h3 style=\"color:#042252;\">Welcome! </h3> <br /> <br /> </td> </tr> <tr><td><strong><a href=\"index.php?content=main\">Resource Center Home</a></strong></td></tr> <tr><td><a href=\"index.php?content=contactus\"><strong>Contact Us</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=holidayschedule\"><strong>Holiday Schedule</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=verdochome\"><strong>Lincoln Documents</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=ugitems\"><strong>Lincoln Group Items Board</strong></font></a></td></tr> <tr><td><a href=\"index.php?content=lnnews\"><strong>Lincoln Group News Listing<strong></a></td></tr> </table> </div> <div id=\"crscrollArea\"> <p><span style=\"color:#9C2431;font-size:16px;\"><strong>Holiday Schedule</strong></span></p><br /><br /> <table width=\"100%\" cellpadding=\"1\"> <td> </td> </tr> <tr> <td><p>New Years</p></td> <td><p>Tuesday December 31, 2013 & Wednesday January 1, 2014</p></td> </tr> <tr> <td><p>President's Day</p></td> <td><p>Monday, February 17, 2014</p></td> </tr> <tr> <td><p>Memorial Day</p></td> <td><p>Monday, May 26, 2014</p></td> </tr> <tr> <td><p>Independence Day</p></td> <td><p>Friday, July 4, 2014</p></td> </tr> <tr> <td><p>Labor Day</p></td> <td><p>Monday, September 1, 2014</p></td> </tr> <tr> <td><p>Thanksgiving</p></td> <td><p>Thursday & Friday, November 27 & 28, 2014</p></td> </tr> <tr> <td><p>Christmas</p></td> <td><p>Wednesday, Thursday & Friday December 24, 25 & 26, 2014</p></td> </tr> <tr> <td><p>New Year's</p></td> <td><p>Wednesday December 31, 2013 & Thursday January 1, 2015</p></td> </tr> </table> </div> </div> </div>\n"; } ?> If you need anything else, let me know. Thank you for you time and expertise ahead of time. flipper828
  7. Thank you so much Kicken and AbraCadaver for your generosity! Surprise....I've not hear of mt_rand and mt_srand in my research and studies. Thank you for the links. I want to go back and study these soon.
  8. Oh thank you so much everyone! I'm off to try this and I'll be back. You people have always been to nice and kind!
  9. The number does not have to be accurate to the number of changes to a data point spreadsheet I have available each day. However, that IS a future project. For now, I just want a different number to display each day which is linked to a .pdf which explains the data points on the spreadsheet. Does this make more sense? *fingers crossed*
  10. Oh Ok. The numbers can be reused and the ideally, I would like it to change at midnight EST. The number is not going to do anything but inform the visitor about the number of changes that have happened since the day before. It will have a hyperlink to a .pdf I have but I know how to do the hyperlink. Thank you both so much. I know this has to be frustrating.
  11. Any random number between 50 and 5000. I don't understand what you're asking about parameters. I'm sorry.
  12. Thank you for being so quick! I just pluck them out of the air when updating the site. However, I have read something about putting a list of numbers in a .txt file. There is no database connected to this site so the .txt file (if that is an option) would probably be the easiest. I hope I am making sense to you.
  13. Hello to everyone! I have a webpage that displays a number. I want this number to change every 24 hours for anyone that visits the site. Right now, I am manually changing this number each day. For the last year, I have searched help websites, consulted many many books and consulted with a couple of programmers I know that seem to not even understand what I am talking about. Would someone give me a hand in learning how to do this? Your help would be so much appreciated. To give you an idea of my knowledge level, what I have learned comes from an online php beginner and intermediate class and then some playing aorund and testing from books. Little, I know, and I apologize in advanced. Thanks
  14. Oh thank you so much for steering me to the right direction! This will be a lot easier than I thought. You lot are the best!
  15. Where to start? First, I am very much a novice to coding in general. I've had beginner and intermediate php classes and I love working with php. I've had a site with a login/password security in place for some time. However, I would like to add a page in which the user can go to see all downloads meant for them and not all available downloads. The problem is, I don't know where to start. I've done some "googling" but apparently I don't even possess the correct terminology to do a helpful search. All I am coming up with is help to create a login/pasword site. Would one of you offer some advice on where I need to start. Thank you in advance for your help.
  16. Thank you for the help. I seem to be out of my depth so back to the drawing board!
  17. Hello All! I am stuck once more and need your very professional help once again. For the last two weeks, I have struggled with this problem. I need the checkbox or checkboxes a user clicks to update the database. Right now, it is recording the boxes checked but I am receiving the following errors on the boxes that are not checked: Notice: Undefined index: SM_03022012 in C:\wamp\032012SMwebinar\addreg.inc.php on line 21 Notice: Undefined index: FH_03062012 in C:\wamp\032012SMwebinar\addreg.inc.php on line 24 Your information has been successfully received. Thank you! Of course, the lines mentioned in the messages differ according to which boxes I check. The two undefined indexes above are 2 of the 6 boxes I didn't check. Here is my table structure. Table name is smwebinar032012. regid INT(11) auto-increment primary key SM_02292012 VARCHAR(50) SM_03022012 VARCHAR(5) SM_03072012 VARCHAR(50) FH_03012012 VARCHAR(50) FH_03062012 VARCHAR(50) FH_03082012 VARCHAR(50) Here is my form on main.inc.php. I've removed all the html for easier reading: <form action=index.php method=post> Webinar 1 <input type="checkbox" name="check_list[]" value="Wednesday February 29, 2012 4&#58;30 PM EST" > Wednesday February 29, 2012 4&#58;30 PM EST <input type="checkbox" name="check_list[]" value="Friday March 2, 2012 9&#58;00 AM EST">Friday March 2, 2012 9&#58;00 AM EST <input type="checkbox" name="check_list[]" value="Wednesday March 7, 2012 1&#58;30 PM EST">Wednesday March 7, 2012 1&#58;30 PM EST Webinar2<input type="checkbox" name="check_list[]" value="Thursday March 1, 2012 1&#58;30 PM EST">Thursday March 1, 2012 1&#58;30 PM EST <input type="checkbox" name="check_list[]" value="Tuesday March 6, 2012 9&#58;00 AM EST">Tuesday March 6, 2012 9&#58;00 AM EST <input type="checkbox" name="check_list[]" value="Tuesday March 8, 2012 4&#58;30 AM EST">Tuesday March 8, 2012 4&#58;30 AM EST <input type="submit" value="Submit"><input type="hidden" name="content" value="addreg"> </form> And here is my addreg.inc.php file: <?php $con = mysql_connect("localhost", "jude","j001") or die('Sorry, could not connect to database server');mysql_select_db("sales", $con) or die('Sorry, could not connect to database'); if (!$con) { echo "<h2 class=\"BodyCopy\">Sorry, we cannot process your request at this time, please try again later</h2>\n"; echo "<a href=\"index.php?content=main\" class=\"BodyCopy\">Please try again</a><br>\n"; exit; } $check_list[] = $_POST['check_list[]']; //Everything passed, enter information in database $result=mysql_query("INSERT INTO smwebinar032012 VALUES('regid', 'check_list[]')"); $message = 'Invalid query: ' . mysql_error() . "\n";die($message); if (!$result) { echo "<h2 class=\"BodyCopy\">Sorry, there was a problem processing your information</h2><br />\n"; echo "</form>\n"; echo "<table width=\"670\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n"; echo "<tr>\n"; echo "<td colspan=\"2\" bgcolor=\"#69670E\" class=\"Copyright\" align=\"center\">© 2012 Inc. All Rights Reserved</td>\n"; echo "</tr>\n"; echo "</table>\n"; exit; } else { echo "<h2 class=\"BodyCopy\">Your information has been successfully received. Thank you!</h2><br /><br />\n"; echo "</form>\n"; echo "<table width=\"670\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n"; echo "<tr>\n"; echo "<td colspan=\"2\" bgcolor=\"#69670E\" class=\"Copyright\" align=\"center\">© 2012 Inc. All Rights Reserved</td>\n"; echo "</tr>\n"; echo "</table>\n"; exit; } ?> Any and all guidance will be greatly appreciated. I hope I haven't entered too much information.
  18. Thanks to everyone that looked at my problem. I finally found out what the problem was. I didn't have the documents above the root directory. So I moved them and adjusted the path in the script and it works beautifully!
  19. I have a site that requires login and password to access. It works fine. However, the downloadable documents (.doc and .pdf) meant only for logged in users, are available for anyone regardless of whether they are logged in or not. In my research, I found a way to mask the url for the download files by using a download.php script. I implemented the script and am having problems. When I click the link for a .pdf, all SEEMS to be working as it should. But when I try to open the .pdf, I get this message: When I click the link for the .doc, again all seems to go well until I open the document. The Word document opens up with this message: This is the code from my download.php file <?php session_start(); if (! $_SESSION['ug_user']) { header("location:login.php"); } $dir="/home/administrator/docs/trc/"; if (isset($_REQUEST["file"])) { $file=$dir.$_REQUEST["file"]; header("Content-type: application/force-download"); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($file)); header("Content-disposition: attachment; filename=\"".basename($file)."\""); readfile("$file"); } else { echo "No file selected"; } ?> When I set up the link, it looks something like this: <a href=\"http://example.com/download.php?file=filename.doc\" target=\"_blank\"><img src=\"images/word_icon.jpg\" alt=\"Word download icon\" width=\"25px\" height=\"25px\" border=\"0\"></a> <a href=\"http://example.com/download.php?file=filename.pdf\" target=\"_blank\"> <img src=\"images/pdf_icons_03.jpg\" alt=\"PDF download icon\" width=\"20px\" height=\"30px\" border=\"0\"></a> Both documents are in working condition. Please help? If you need any other information, please don't hesitate to ask.
  20. I can not believe I missed that typo! I'm really embarrassed. I MUST get better at spotting typos! I went over your examples again and understand more each time I work on them. I did get the validation to work with your help. I must admit I still do not understand all of it but now that I have that piece working in my project, I will spend the next couple of days studying for better understanding. Thank you so much for your patience and help, mjdamato!
  21. Working on understanding above...... I have/had the selection box on an html page but going by the code above, I have replaced that particular piece with a php script following along with mjdamato's perfect example. I am able to get the selection box to appear on the page with a default of --Select One--. However, when I click the drop down, there are no options to choose from. Going back to one of the questions mjdamato posed......the selections are not in the database. Here's the code for the box: <b><font style="color:red;">*</font>Registration Type:</b> <?php $regList = array('Full Registration', 'Partial Registration'); $regOptions = "<option value=\"\">--Select One--</option>\n"; foreach ($regList as $att1fp) { $regOptions .= "<option value=\"{$att1fp}\"{$att1fp}</option>\n"; } echo "<select name=\"att1fp\">"; echo $regOptions; echo "</select>"; ?> <br /> <br /> Once I get the drop down menu working, I will return to working on the validation piece. mjdamato....I am learning a lot from you. Thank you!
  22. Thank you mjdamato. I will admit I am confused but I will try to work on it until I understand. Can you tell I'm new to programming?
  23. I have a form in which several fields are required....one of which is a drop down menu. The stop edits I wrote for all the fields (which are text fields) are working perfectly. For instance: //Check if Primary Contact was entered if (trim($primecontact) == '') { echo "<h2>Sorry, you must enter a primary contact</h2><br>\n"; echo "<a href=\"index.php?content=registration\">Please try again</a><br>\n"; $baduser = 1; exit; } Unfortunately, using the example above does not work on the drop down omenu option Here's the code //Check if Attendee 1 Registration Type was selected if ($att1fp) == 'NULL') { echo "<h2>Sorry, you must enter a registration type for Attendee 1</h2><br>\n"; echo "<a href=\"index.php?content=registration\">Please try again</a><br>\n"; $baduser = 1; exit; } If you need more code, I will be glad to oblige. Help me pretty please??? Thank you
  24. Thank you phpstuck. It did work and I appreciate your help!
  25. I have two drop down selection boxes in a form in which a multiplication and then an addition operation need to be performed. I don't know what I am doing wrong because I load the page and get undefined variable. I thought the variable is defined when the user selects a number. It is a long long form so I am only attaching the piece I think is pertinent. If you need more, I will be glad to oblige. <form action="index.php" method="post" target="_self"> <b>Firm Name: </b><input type="text" size="50" name="firmname"> <br /> <br /> <b>Number of Attendees:</b> <select name="numattfull"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> Full X $495 <select name="numattpartial"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> Partial X $325 <?php $full = $numattfull * 495; $partial = $numattpartial * 325; $answer = $full + $partial; echo "<b>Total Fees:</b> $answer\n"; ?> ]
×
×
  • 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.