Jump to content

Omzy

Members
  • Posts

    314
  • Joined

  • Last visited

    Never

Everything posted by Omzy

  1. I use $_SERVER['REMOTE_ADDR'] to get the IP address of the person who fills out my contact form, what other information can I obtain from this IP address and how? For example, country, ISP... Also what other things can I do to improve my contact forms so that I can authenticate form submissions?
  2. thanks mate that has worked perfectly.
  3. ps_manufacturer table contains fields id_manufacturer and name ps_manufacturer_lang table contains fields id_manufacturer and description I need a join query that let's me extract name and description based on the id_manufacturer Unfortunately I can't use 2 separate queries as the program I'm using won't let me do this, so everything needs to be one query.
  4. Cheers man. Also with regards to sessions I heard these can be easily hacked? How can I make this more secure?
  5. Cool, that looks good, I'll give it a bash tonight. BTW do you know how I can seperate pieces of code within the same file, without having to put them in to a function? I.e. organising the code on the page into their own "sections" and then "including" them when/where required.
  6. Can you give me example, based on my script? So do u mean instead of using $_POST(), I should use $_SESSION() everywhere?
  7. I have a multi part form on my site called signup.php. It is one file that has 3 forms in total and each part of the form is in its own FUNCTION, as follows: $errors=array(); if($_SERVER['REQUEST_METHOD'] != 'POST') { //upon page load form1($_POST); } else if($_POST['process'] == 1) { if(strlen($_POST['name']) < 3) { //form validation $errors[]='name'; } if(!empty($errors)) { form1($errors); } else { form2($_POST); //POST the values to form2 } else if($_POST['process'] == 2) { if(strlen($_POST['selection']) < 3) { $errors[]='selection'; } if(!empty($errors)) { form2($errors); } else { form3($_POST); } else if($_POST['process'] == 3) { conf_form($_POST); } Each part of the form has a hidden varaible called "process" and also contains hidden variable of the POST values from the previous part of the form. I was wondering is there another (better) way of doing this, without using functions? The problem iwth using functions is I have to declare stuff globally, etc. I beleive it can be done using sessions, if so how can I modify my script to use sessions?
  8. Yes mate, it's working, I have to use array_keys top get the values to display :-) Thanks for all your kind help :-)
  9. Think there might be an error there, it didn't seem to work for me and I noticed that $wordfrequency is only referenced once in the code...
  10. Right I managed to figure that out, I've now got it to display the 10 most popular words on the page, I did this using array_slice, array_count_values and arsort. Mark also mentioned above "You might also want to drop words of length 1" - how can I do this?
  11. Cheers Mark, that works like a charm. Now any chance this can be extended so that it limits the output to : a) the first 10 words b) or preferebly the 10 most popular words in the page
  12. LOL I know but I'm not really bothered about that, I'm just working to spec lol!
  13. Basically I'm trying to dynamically generate <meta keywords> tag. Let's say I got a string like this: $description="SanDisk’s Memory Stick PRO Duo is half the size of a standard-size Memory Stick PRO media and it offers the same technologies including high speed data transfer, built-in MagicGate, and high capacities. The Memory Stick PRO Duo is the ideal solution for the most portable devices such as pocket-size digital cameras and with the use of Adaptor, it can be used in all PRO-compatible devices." And I got a list of stopwords which I have put in to a variable $stopwords: $stopwords="in|the|of|to|which|where|how|is|it|if|why|who"; So I basically want to recreate $description with those stopwords taken out of it. How do I do this? I tried using preg_replace but it would only do partial-word matches...
  14. Just done this: preg_replace("#\s{2,}| #", "", $str); Everything sorted now :-)
  15. No it's definitely not calling htmlentities or any other method. Not as far as I can see anyway... This is just really strange, normally strip_tags() and trim() is all you need to get rid of line breaks, spaces and html tags. But I've already had to use a preg_replace function to get rid of the line breaks and will probably now need to use some other function to get rid of the !
  16. Well basically, as well outputting extra line breaks it was also outputting in the html source. So after applying your fix above it got rid of the extra line breaks so I now get it all in-line as it should be: <meta name="Description" content=" Technical Specifications: Platform: DS BBFC Rating: Description: 100 Classic Book Collection turns your Nintendo DS into.. " /> Can your preg_match code be extended to take out all the ?
  17. Cheers Daniel0, that has worked! But not quite the finished article yet... how can I stop it from outputting in the source?
  18. That doesn't seem to work either!
  19. Basically I'm using the strip_tags() function to (obviously) strip out the HTML tags from a string. The new string is then used to form a <meta description> tag. What happens is when I view the source of the page (in the browser) I get the stripped string but there are loads of line breaks throughout the string. It seems like these line breaks are where the HTML tags have been stripped out. How can I get rid of these line breaks? I have tried the trim() function but that doesn't seem to work. I have also tried str_replace(" ", "", $string)...
  20. Well ideally I need a universal solution, i.e. one where I don't have to explicitly specify the domain name. So it needs to basically check whether the referring page was a page on the server that the site is on.
  21. Can we not get it to check whether the referer was on the website's server or not?
×
×
  • 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.