Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. A PHP file is infinitely more secure than a plain text file. Most of my applications import data in external files, configuration settings, database passwords, things like that. But it doesn't make sense to hide things in comments and then use file and string functions to read the data, you might as well instead just cut out the middle step and set up the data to be PHP variables from the start, that way you can just include the file and go from there, you don't need to open the file and process it. Am I making sense?Your code would change to something like this:

    <?php$users = array();$newuser = array();$newuser['username'] = "sfb";$newuser['password'] = "ru6g8oz";$newuser['first'] = "john";$newuser['last'] = "jones";$newuser['email'] = "snowfort@gmail";$users[] = $newuser;$newuser = array();$newuser['username'] = "mittens";$newuser['password'] = "123456789";$newuser['first'] = "";$newuser['last'] = "";$newuser['email'] = "dogs_drue@gmail.com";$users[] = $newuser;$newuser = array();$newuser['username'] = "patches";$newuser['password'] = "987654321";$newuser['first'] = "";$newuser['last'] = "";$newuser['email'] = "cool_cat@gmail.com";$users[] = $newuser;//$users now has 3 records?>

    <?php$userlogedin = false;$username = $_POST["username"];$password = $_POST["password"];if($username != ""){  require_once("users.php"); //include the file that contains the user records  $size = count($users);  for ($i = 0; $i < $size; $i++)  {    if (($users[$i]['username'] == $username) and ($users[$i]['password'] == $password))    {      $email = $users[$i]['email'];      $userlogedin = true;      echo "{$username}<br>{$email}<br>";    }  }}if($userlogedin){  print"The password and username match";}else{  print"the username and password do <u>not</u> match!";}print"  <br><br>this is the login page";?>

    Just look at how much code it eliminates, and how much easier it is to understand what's going on.

  2. I've been trying to explain how to do this.Look at the source of your HTML page (from the browser). At the top, you see this:

    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html dir="LTR" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Bhura Tea</title>

    There is a <title> tag there. I assume that is what you are trying to change, so instead of saying <title>Bhura Tea</title>, you want it to say <title>Bhura Tea - Tea Bags</title> or whatever. You need to find where the <title> tag is being created. If I had all of source code I could find it, but you copy and paste various lines and things that don't show me where in the code this is, so you need to find it yourself. Find where the <title> tag gets printed, and instead of whatever it says now (something like <?php echo TITLE; ?> like you pasted below), you want it to say something like <?php echo TITLE . " " . NAVBAR_TITLE; ?> or something like that. That's what I was trying to say in my last post.

  3. Make sure you do not have any spaces or blank lines before the <?. Anything outside of the <? (it should really be <?php) will be sent to the browser, including any whitespace like blank lines.

  4. The only reason to learn more than one server-side language is to increase your own marketability. If you are only doing things for yourself, then you probably don't need more than one, unless it's something you're just interested in. If you are trying to get contract jobs with clients, then the more you know, the more jobs you are going to be qualified for. If someone has a requirement that you use ASP or JSP instead of PHP, then the only way to get the contract is if you know it. The good jobs are where the client lets you choose those types of things, but some of them have their own server they want it on, and they dictate what software you can use.

  5. The breadcrumb file isn't important for this. You need to build the title in the index. Start with the constant TITLE if you always want Bhura Tea to show up. Detect if you are on another page (like a product page) and append the product name to the title. It looks like to detect a product page you can look for the existence of product_id in the querystring, and to find out if you are on a section page you can probably look for cPath in the querystring. If I'm guessing right, from the code you posted above, it looks like $breadcrumb->last() holds the page title.

    <?php$page_title = TITLE;if (isset($_GET['cPath']) || isset($_GET['product_id'])  $page_title .= " | " . $breadcrumb->last();echo $page_title;?>

  6. How is an unencrypted Word document more secure than a 256-bit encrypted password string?Passwordmaker doesn't store passwords on your computer at all, it doesn't store them anywhere. It stores your encrypted master password on disk if you ask it to.

  7. You need to change the page title on the page, there's no way around it. If you want the title to change, then you need to change it. It won't happen by itself. You need to find on the index page where the page title is being set. You might need to look in a template or something, since I don't have all the code in front of me I can't tell you where to look. But you need to find where the page title is being set, and change it to what you want. It might be in one place, it might be in 20 places, like I said I don't have the code in front of me so I don't know specifically what you need to change.

  8. You need to start the session before you send any output. Session information goes in a header, and headers are the start of the page, so you can't send output to the browser and then try to send a header, the headers have already been sent.You need to move session_start to the top of the page, or at least before you send any output. You can also enable output buffering, and buffer the entire page and send it once execution is finished.

  9. How can you send email without an email server? Are you just talking about clicking a link to open the mail client, or are you actually having the website create and send an automatic email?I guess I'm not sure what your question is. What do you mean by posting to another page? You can set the action of the form to any page you want, is that what you mean by posting?

  10. Well, here is the page about media types:http://www.w3schools.com/css/css_mediatypes.aspYou should probably either test the page on a handheld device, or use something like Opera, which will render the page as a handheld device if you press shift-F11. That way you can see what you are developing, and change things until you have it the way you want it. None of us knows what you want the page to look like, you know?

  11. From the FAQ:

    How do I know PasswordMaker isn't sending my passwords to you without my knowledge?Although you can read the source code to determine this for yourself, there's an easier way. Install a packet sniffer and use PasswordMaker to generate some passwords. You won't see any traffic to or from PasswordMaker -- ever. It never connects to the internet. Two popular packet sniffers are snort (for Unix/Linux/OSX) and ipInterceptor (for Windows). Both tools reveal *all* network traffic, not just HTTP.
  12. You are going to want to use this as a reference:http://www.php.net/manual/en/ref.image.phpThe functions you are going to use will either be imagecreatetruecolor (if you are creating a new image) or imagecreatefromjpeg (or another one) if you want to start with an image, and put text over it. Then eventually you use imagestring to actually write the text. See the page on imagecreatetruecolor or imagestring for some examples and links to other functions. imagecreatetruecolor has this example:

    <?php$im = @imagecreatetruecolor(50, 100)     or die("Cannot Initialize new GD image stream");$text_color = imagecolorallocate($im, 233, 14, 91);imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);header ("Content-type: image/png");imagepng($im);imagedestroy($im);?>

  13. I agree with a lot that has been said. A template is not a bad idea, and it would help beginners, but this particular one may not do the trick. But it brings up a good point. The community could take it upon ourselves to create a basic template. We could even just create a thread, start with a very basic shell, and have people make their own additions and post their new template as a reply, so that all additions can be seen and explained, and either used for later versions or not. If there is any interest in doing something like this, reply here and we can set up a new thread to start it off. The first step, other than creating a basic head and body, would be to decide what structural elements a basic page would need.Also, just as a minor point, it's better to post any code in a code box instead of a quote box because the code box preserves the indentation.

  14. If all of the numbers are unique, the easiest thing to do is create an array of everything and sort the array using ksort.

    <?php$list = array();$list[7] = "DCole";$list[3] = "SFB";//etcksort($list);?>

    If the numbers are not unique, you will want to create a multidimensional array and use usort.

    <?php$list = array();$item['id'] = 7;$item['text'] = "DCole";$list[] = $item;$item['id'] = 3;$item['text'] = "SFB";$list[] = $item;usort($list, cmp_function);function cmp_function($a, $b) {   if ($a['id'] == $b['id']) {       return 0;   }   return ($a['id'] < $b['id']) ? -1 : 1;}?>

  15. OK, try setting it to 744. But make sure that when you are done you set it back to 444. Unix/Linux permissions are octal values. The three digits are for owner, group, world. Octal value 4 is binary 101, so the permission 444 is like this:101 101 101These are read, write, execute. So all write values are 0, if you set the permissions to 744, it will be this:111 101 101Which will give write access to the owner. If that doesn't work, make it 774 to also give write access to the group. Last case (if you don't own the file and aren't in the group that does), change it to 777 (or 775, or 755) to give everyone write access. Just make sure to change it back to 444 when you're done.

  16. Well, 'webbot' seems to refer to a lot of different things (including the W3C's own web crawler, a Microsoft FrontPage component, and some 'web scripting language').As far as I know though, you need to be able to communicate with a mail server in order to send email. I don't think there's any way around that, the server has to be what actually sends the mail, so you need some way of getting the formatted message to the server.It should be easy to get some free webspace to host something like this. But if it's for school, then you can probably just have a message pop up that says something like "if this were a live site, it would send an email at this point, but this demo does not have access to an email server".

  17. Sadly, no, ConTEXT does not run on Linux. It was programmed in Delphi 4, and I know there is something called Kylix that helps port Delphi to Linux, but the author of ConTEXT (Eden Kirin) does not have Kylix, and as far as I know he's not planning on porting it to Linux any time soon. We've all just been waiting around for version 1.0.

  18. Welcome! Yes!! Another convert! HAHAHAHAHAH!!ahem.. yeah, the file explorer is nifty. It took me forever to figure out how to set my own folders as favorites, so here it is: if you're looking at a folder or a file in the file explorer, and you want to have it show up in the favorites when you click the favorites tab, you drag it to the favorites tab. There is a button in the favorites tab to add a file, but if you want to add a folder you have to drag it from the file explorer.Also, CTRL-SHIFT-E shows/hides the side panel. Stop by http://forum.context.cx if you have questions, and we will be happy to ignore your question and start talking about vodka. Thank you.

  19. Actually, C doesn't have anything to do with either HTML or CSS. Are you confused about what you're doing? You attach a CSS sheet through a meta tag in the HTML page, neither of them have anything to do with the C programming language.

  20. Highlighters for other languages. You can write your own highlighter file to highlight whatever language you want, but a lot of them are built-in. Most (all?) of the highlighters on the download page are user-written for whatever language they were wanting highlighting for. There's even a highlighter highlighter, to highlight the highlighter file (under "C" for "ConTEXT Highlighter Files"). You copy them into the highlighters folder in the ConTEXT install folder, and restart ConTEXT to use them. You can select them from the dropdown manually, or do Tools -> Set Highlighter -> Customize Types to have a certain highlighter automatically apply to certain file types (i.e., if you open a .uc file, select the UnrealScript highlighter).

×
×
  • Create New...