Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by surefire

  1. Unless I misunderstand the request, I think I covered that at the end of the last tutorial. If I misunderstood your request, please explain a bit more. Thanks.
  2. surefire


    Question: Does Google know what size your h1 fonts are if you use an external style sheet? I'd really like to know. Not really my intention to make h1 smaller than anyother text... just reduced down from superhuge.
  3. If someone already said this, my apologies... but this is a long thread. I don't want to come off as pessimistic, but if you want it safe, don't put it on the web. There are lots of tricks you can use to foil some folks, but none of it is thief-proof. You're smart to search for a way to protect your content... but realize that there is no perfect solution. It's just a matter of how much trouble you want to go through to get a little extra protection. I did see a site a couple of months back that provided software meant to protect images... but the visitor had to download special viewer software.
  4. Two things to add... real basic: Make sure that each folder has an index.htm file... even if it's just blank. Second, certain folders are best kept outside of the public html files... closer to the root of the site. For example, if you access a database and keep a list of your login info in a file, put the folder with the file outside the public root of your site so it's not accessible by the web. Then I'd also password protect the folder with cpanel (.htaccess) Okay... three things: Also, not all FTP programs show .htaccess files at all or maybe they only show the files if you tell the software to show you. So you might already have an .htaccess file... but not know it.
  5. I'm not familiar with Perl, but there are thousands of pre made perl scripts at this site: Hot Scripts So I figure someone must have already written a script that does what you want to do. PS - I love the look of your website, but some of the photos have been x-ed out. See here Your page Since it's at your store... I thought you'd want to change it. Hope that helps
  6. surefire


    To add just a bit onto what Jim said... If you're starting out with website design, I think every minute you spend learning the basics of CSS would be well worth it. Example: You can have CSS set certain fonts for all text inside of <p> tags... a different font for <h1> tags... and totally different fonts for all text inside of table cells. The uses are almost limitless. But here's the time-saver: If you set up your fonts in CSS and do it intelligently, then you can make a minor change to your CSS file and change the entire site instantly. Another neat thing is to be able to bring your H1 fonts down to a more normal size... but still get the search engine benefits of using H1 tags in your pages. CSS is pretty cool stuff... and just when you think you've got it mastered, you see someone else use it in a whole new way.
  7. On to Part Two of PHP Basics... Even if you have a popular WYSIWYG editor (Dreamweaver, etc.) creating forms with tons of options can be a drag. Especially if you find yourself creating the same form over and over again. I'll share some ideas with you for saving time with forms. I wanted to create a form for one of my sites that involved the user choosing the year of their birth. Obviously it wouldn't be too hard to create the entire form using html... but it would be tedious. I knew I'd have to go back to the 1940's just to be safe. There are plenty of ways to save yourself time. Some would create some code in Javascript. But since this is a tutorial on PHP (and I'm not nearly as good at Javascript) let's look at one way to do it. We want to use PHP to tell the server "Count backwards from 2003 to 1940 and create the necessary html code so I don't have to write it." So let's look at a very watered down version of this form: Now we have nothing to show for the drop down select box... yet. Here's what we do. We create a loop, have the server print out html code as it counts backward, and quite the loop when we reach 1940. Let's look at the finished code and then dissect it: Step by step... <?php starts the php code Tells the server"Variable x is now 2003... stop the loop when it's greater than 1939... and each pass through the loop, reset variable x at one less than it's currentl value." Or "Count backwards from 2003 to 1939 and do everything between the brackets {} while you're counting." So, everything between the brackets gets done until the loop is finished ($x reaches 1940). Inside the brackets we have: It looks close to html... but different. This is our familiar print function, but now we have slash marks (or whatever they're called) in front of the quotation marks. This tells the server... whatever follow the \ is a symbol I really mean... and nothing else. If we left them out, then the server would think our print statement was finished at the first quotation mark right after value= But we want the print statement to cover the entire line... so we use the \ to tell the server "I really mean print a quotation mark." The $x variable is whatever number we're on. Save this code to a php file and upload it to your server to see that it really works. Isn't that a lot easier than typing 60+ lines of repetitive code? I think so. ***Final note*** Don't bother hitting Submit on this form you created since the form will post to a php script that doesn't exist. If you hit submit, you'll get an error message. To avoid the error message, you could have the form POST to a real url. None of this has anything to do with the tutorial info except to prevent someone from thinking "This darn form doens't work". All it's supposed to do is list the dates in reverse order.
  8. Before I move on... I thought I'd get some feedback on how this info is perceived... Useful Boring Etc.... This is pretty time intensive... so if no one's getting anything out of this... I'd be willing to stop. Just reply to this thread if you have an opinion you'd like to share. Thanks
  9. Tracy, Good questions. I'll do my best to answer them. First, you can create the same effect I explained in detail using any server side language... ASP, SSI, Pearl, Python... although I have no idea how to do it. I'm good at only one server side code: PHP. Luckily it does just about everything you could want it to. (The community spirit you see at the TCH boards is very similar to the open source PHP community) Back to your question. My experience with Dreamweaver templates. Is that it's a software function that allows you to modify your entire site within Dreamweaver, then FTP the whole new site to your host. And if that's incorrect... I apologize. I fooled around with Dreamweaver templates once a long time ago and never went back to it. On the other hand, when I learned about PHP includes, the light went off in my head and instantly I saw the potential. I'll give you an example that should show you why I think PHP templates (no one really calls them that) is superior to Dreamweaver templates. I have a website that's over 6,500 pages and growing. If I want to reorganize the NAV bar... add a link... or change the layout completely... I change two files... FTP those two files only... and the whole site is instantly changed. If you can do that with Dreamweaver templates... that's great and you should use it. Anything that saves you time and energy when it comes to updating your site is a positive in my book. The day I find something better than PHP for the things I want to do... that's the day I switch. I'm not married to PHP. Now... your second question: If by "menu" you mean "navbar" then you're probably talking about Javascript. The best way to do those nifty drop down navigation menus is with javascript. And there are plenty of ready made scripts that you can use for free. But I think you mean, drop down selections in forms. Those select boxes. With PHP you can populate those drop down selection boxes with data fields from an array, a file, or even a database. In a future tutorial, I might go over database connections and MySQL... but there are so many awesome tutorials written on this subject that I almost feel like I'd be helping others better by answering specific questions. I think I wrote a script that is similar to what you are asking about. On one of my sites, there's a form where visitors can tell-a-friend. But this form's a little different: The visitor sees a basic email message that will be sent to their friend from them They choose how many friends they want to refer to me The next form gives them only as many fields as they asked for The form sends out emails to their friends All of the emails are stored in my database in case I want to use them later (with great care and respect) Your question is actually a little advanced... not hard... just ahead of this mini-tutorial. In general terms, your form is nothing more than plain-Jane html with a little PHP thrown in. You use the include function to pull your database password in securely and privately, then you connect to the database, you tell MySQL what you want, then you create a loop that says "create more html tags and selection fields until there's no more data", and then the server sends the page to your visitor. I know this doesn't tell you HOW to do it... but it's very possible and you can find more info on it at Dev Shed:: PHP Hope this helps. In the next tutorial, I'll show you how to save yourself time and energy putting forms together.
  10. Ooops... forgot to add our php date function to our handy dandy template. Open up that header.php file. Here's what it should look like: See where it says "Date Here"...? All we have to do is replace that with our php date function I showed you ealier... So now header.php looks like: Voila... now every page on your site has the date at the top of the page... And it matters not whether your visitor has javascript, flash, or whatever else loaded on their computer. Pleasant coding.
  11. Alright then... let's tackle some of those issues you mentioned, Tracy. First of all, most PHP pages are nothing more than html pages with some extra code thrown in. Some are pure php code... but you can get a ton of use out of php without knowing a whole lot of it. If you look at the php written by other folks, you'll see two distinctive styles: 1- HTML dominant with php spliced in 2- PHP dominant with html spliced in For whatever reason, option 1 makes the most sense to me. What I do, is basically create an html page... and get it to where I want it to be in terms of layout... and then I stop. Let's say I save this as template1.htm Notice I saved it as html... there's no php in there... and there never will be... this is going to be my template. How, I'm going to show you something really cool. In my opinion, this is the coolest thing PHP can do... and the easiest. What we're going to do is break the page up into three pieces 1-Header 2-Main body 3-Footer The main body will change from page to page. But for most sites, the header and footer will stay the same. This is where the nav bar, logos, and copyright information usually goes. What I'm going to show you will save you countless hours of tedious programming and typing. Let me create a fake template1.htm: Wow... that's an ugly webpage... but it'll work for illustration purposes. See where it says "Main Body Here" in the code? Everything before the opening <p> next to Main all the way up to the top of our html document is going to be copied and pasted into a php file. Let's call it header.php (original... I know) header.php will look like: Similarly, everything after the closing </td> at the end of "Main Body Here" all the way to the end of the document goes into a new php file we'll call footer.php. footer.php will look like: I left out all the carriage returns because that's stuff that will be replaced by real content in a moment.One last step and you're on your way to creating umpteen bazillion webpages. We create a new webpage we'll call template.php. Notice that this is a php file. It's going to look exactly like this: So what does this do??? It tells the server, "Start in the root of the site (www.yoursite.com) and look in the folder named "inc" (which is where you are going to put these php files) and get everything in the header file and include it at the top." Then we switch over to html for a second. And then we tell theserver, "Start in the root of the site (www.yoursite.com) and look in the folder named "inc" (which is where you are going to put these php files) and get everything in the footer file and include it at the bottom." Once we have template.php, we ftp our files to the server. We create a new folder called "inc" for our header.php and footer.php to live in. Then we test it out. Assuming it works... and why wouldn't it?... we now have a template for all of our other webpages. Not only that... when you view the source code from your browser... it's perfectly formatted html... because the php did it's magic before showing you the webpage. So for my home page... I open up template.php in my html editor (Dreamweaver or whatever) and save it as index.php (must be php). I then replace "Main Body Goes Here" with the real content for the page... And we're done. So now... anytime you want to add a link to your navbar, update your logo, or change the layout completely... you change these two files... and you've got a whole new website in an instant! Enjoy!
  12. Dsdemmin is abolutely right about the most likely cause of this problem. The script (for security reasons) checks to see where the POSTed information is coming from. If it's coming from the url that is listed in the code (www.your-actual-site-url.com) then it proceeds. If it's from a site not listed, then it assumes it is spam email and stops, gives an error message. Now, if you don't change the line of code reference by Dsdemmin, then you'll get an error. The only other possibility (and I'm not 100% sure about this) is that your site is brand new and the server is reading your IP address but not the url. I have a site that I just started that might be having this issue. I haven't had time to check it yet. Other than that, I can't think of any reason why it wouldn't work. If you are new to programming, even a relatively short script can seem daunting since it doesn't look much like html. If someone can post better instructions than I have in previous posts... be my guest. And there are plenty of PHP scripts out there that can do this. So if you're having trouble with this one... go get a premade one from HotScripts. (Link can be found in one of my previous posts in this thread.) The only reason I made modifications to this code was to improve security and make it easier for me to add multiple forms to my site without adding tons of hidden input variables. You are more than welcome to download the original version and tinker with it. But the support given at that site is pretty lousy.
  13. Sorry to hear that. The least I can do is provide a list of links that might do the trick: Hot Scripts php form processors
  14. Putting the date and time on your webpage: Okay... you've made it this far... Let's do something actually useful. Anywhere in your php file that you want to add the date, you can put There are many ways to format the date and time... entire tutorials have been written on it. For now, if you've made it this far, take a much needed break... congratulate yourself. But if you're yearning for more php know how then check out these links: DevShed::PHP PHP Builder Depending on the response from these posts... I'll add more in a few days. (Or I'll actually get some work done on my own stuff)
  15. Mixing html and php together is easy. You just have to tell the server where php starts and where it ends. Let's look at something just a tiny bit more involved: You can name this whatever.php and ftp it to your site. It will dutifully print out First, notice that even though it's a php file, it starts out as pure html... no problem. Then php kicks in with <?php The line assigns value Psycho Bob to the variable $name Then we have a regular <p> element that starts off as normal html. Then right in the middle of everything, we break back into php, tell the server to print the value of $name, and break back out of php and into html. Pretty slick!
  16. Creating your first PHP page. Step one: open up one of your html files in your html editor of choice. Step two: save it as the same name but end it in .php instead of .htm or .html Done. You see, any html file can be named .php and it will still work just like it did before... assuming your hosting company has php (which TCH most assuredly does). Now, renaming all your files .php is not only unnecessary, it's not very useful. So let's create a simple php script and see what it does: You can paste this into your text editor, name it as test.php (or anything.php) and ftp it to your website. You'll see it says "Hello World" when you load it up in your browser. Line by line: <?php tells the server "starting php code here" print("Hello World"); tells the server to print Hello World Notice that the line ends with a semicolon ; Every line of php code must end with a semicolon. Some lines of php code can wrap to the next line so I guess it's more accurate to say that every php line of instruction must end with a semicolon. (This doesn't count comments added to the end of a line) ?> Tells the server "Done with php code here" Next... mixing php code and html together
  17. I have no idea if this is even something that others want to read... so here goes: Let's cover three things: 1-What php can do for you 2-Your first php page 3-Putting the time and date on your page PHP is a server side code, which means that before your visitor ever sees a thing on your site, the server is told to perform some functions and first. For example, you might tell the server "Get today's date, put in a certain format, and show it in this table... then send the html to the visitor." The great thing about php is that except for the fact that the page ends with .php, all they see is html if they view the source code. There are even ways around the .php ending... but we're not covering that. In contrast, JavaScript is a client side code. Your visitor has to have Javascript turned on and installed in order for all the neat javascript to work on your website. The good news is that most people have javascript enabled on their browsers. So, where PHP would get the time and date from the server, you could have a similar javascript program that gets the time and date from the visitor's own computer. Both codes have pluses and minuses... but the fact that php works on everyone's computer (since it does all the magic at the server) I've focused my efforts on PHP. There are other differences between javascript and PHP, but that's not the issue right now. So why use PHP? Rather than give you an infinite number of uses for PHP, here's a shorter list of ways that I've used it to help improve my websites: Storing user inputs, passwords, and so forth in a database Dynamically generating thousands of pages from a database Processing forms and sending out mail to users Dynamically 'including' snippets of HTML for pieces of my website you see on every page (NAV bar, copyright, logo, etc.) Updating thousands of pages and changing the entire look of a website by modifying just two files Automatically generating meta tags for Title, Description, etc. Putting the date on my pages Generating pdf (Adobe Acrobat) files from user input Password protecting pages Pulling news and other information from other sites and having it update automatically And that's the short list. The good news is that PHP is pretty easy to learn.
  18. If I understand you correctly, then you're not using the cgi script that the warning was about. The warning was about security issues with a very popular script called FormMail.pl (or .cgi) If you don't use the script, you don't have to worry about this security issue.
  19. I've written some pretty intense database driven websites (6,500+ pages) in php but not in perl. What you're looking to do is absolutely possible, and not all that difficult... depending on how you feel about coding. The good news is that TCH comes with awesome PHP resources and free MySQL. However, it's a long post to explain how to integrate database functionality into your site. If you give me a little more info what you mean by then I'll be happy to answer the question in more detail. Specifically, what do you want the visitor to see after they post the form? If you want the posted information to be stored for other users to see, you'll need a database (or flat file) to make it work. You're looking at lots of hours of coding and caffeine to get it working. One thing you might try... is to visit Hot Scripts They've got tons of free scripts ready to use. The trick is finding something close enough to what you're looking for. Best of luck.
  20. I sent you two files since you have two separate forms that you wanted contacting two separate emails. It could easily have been accomplished with one file... but that would require PHP modifications that would get a little dicey to put into your website without doing it myself. So do this: Create a folder on your site in your public html folder. Label the folder phpbin (or whatever you want). FTP both of these files to the folder. Now, take the html files with your forms and open them up in the html editor of your choosing. Direct the forms to POST the information to the approprate php files that I sent to you. I named them appropriately so it would be pretty simple to figure out which is which. FTP your HTML files with the forms to your website so the old ones are replaced with the new ones. Voila. You're done.
  21. Through private message function, I help S Garrett with form. Solved. Still one other TCH member that's got me stumped.
  22. I had tried to post an online tool that creates the code with user input so it would be easy... It seems to have a glitch, so I'm editing this post. If you copy and past the script from page two of this post, you should have to problems.
  23. 1stover and stoneage: Thanks for the kudos... but my work was slight modifications and helping other members. The original script wasn't mine (even though my name is Jack as is the creator's). Since the script is under GPL license, there shouldn't be any issues with using this script for TCH members are including in cpanel as long as headers remain to give credit where credit due... but that's my guess since I'm not the author. I have since edited my post with the script (second one) for two reasons 1- Change comment section so that it won't cause problems regardless of which text editor used 2- To indicate to TCH members that it is critical that they use a text editor (like NotePad) that allows long lines of code to remain one long line of code... rather than splitting it onto two lines (wrapping) I am fast at work on a script that will help others plug in their site info and get a ready to copy script. I'll post it when done. PS - I am currently helping one member by email. Not sure what the issue is, but working hard to resolve it. Will update this post when we figure out why it's giving this member problems. Most members report that this script is very easy to use per the instructions given. If any clarification is needed, I'll be happy to help any way I can.
  24. Guys... I only just now realized that I can edit my posts. So my apologies for putting the script up twice... but maybe the extra instructions will help someone. And I edited the previous script posting, thanks to all for the input. I didn't proofread my code as thoroughly as I first thought. Wanted to get it on the boards to help others... but haste makes waste I guess.
  • Create New...