Jump to content

Taffd

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Taffd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OK, Supposing I had a table:- groupID, name1, name2, name3 How do I go about taking 3 people from the names table, insert them into the above group table and then repeat the process, taking 3 different names etc. and so on until there is only one remaining name.
  2. In detail then - I'm trying to set up a new system for electing leaders. The electorate are divided into groups of 3. Each group then elects 1 of the 3 to represent them at the next level. Thus from 10,000 names, I want 3,333 groups of 3 names and 1 remaining name who will advance automatically to the next level. The second level will thus have 3,334 names. Again, I will want to organise them into 1,111 groups of 3 and have 1 remaining. I'll continue the process until I arrive at the required number of leaders, somewhere between 14 and 100. At the final level, I'll adjust the numbers in the groups so there's no remainder. There are no time constraints for this process, it's a back-end operation that will happen once a year. The whole exercise is a personal project that a friend and I are working on, an idealised community, with a web-based governance.
  3. Hi folks, I have a table 'names' with one column 'name'. It has 10,000 names in it. I'd like to separate these 10,000 names into groups of 3 names and 1 remaining name, that is 3,333 groups of 3 with 1 leftover. I'd at first thought this would be simple to accomplish but alas not only can I not do it, I've had no luck at any other forum. Does anybody have any ideas please. Regards Taffd
  4. Hi everyone, I'm using dreamweaver 8 to build some forums. Are there security issues, such as sql injection, when using url parameters to select topics etc or does dreamweaver code account for this. Regards Taffd
  5. Thank you all, so far, for your comments. Re professional. I'm not sure what everybody means by 'it's not very professional'. The idea was to create a simple clean look that was generic. ie. not pertaining to any specific country. The long list of 'country' links, I agree, is not ideal but was done for a specific reason. It gives the site over 60,000 internal links, viewable by search engine. I'm hoping that, with each country page being different, this will enhance the ranking. Whether or not this proves to be correct, will be seen when the redesign goes live in a week or two. From viewing my site stats, it's apparent that most people who have viewed the site, from here, have only visited one or two pages and are obviously dissatisfied with the first impression. Feedback from other viewers has tended to be more positive. It is obviously a subjective thing. Maybe another redesign is in order. Thanks again everyone, keep 'em coming. Regards Taffd
  6. Todding01, Thanks but I was referring to server-side php. However I have found a solution to my problem, which I post in case it can help anyone else. I post this solution to a form validation and redirect, as an addition to a comment page written with dreamweaver. Unfortunately Dreamweaver does not provide server-side validation for php. You're expected to purchase an extension. My problem I have a comments page with a comment form. I wanted the comment input to a database if ok but if a user tried to input code or a link, I wanted to redirect them back to the form page without their comment input to the database. I also needed to work out where in the Dreamweaver written code to place my validation and redirect. The code below shows the part of the page which dreamweaver writes to input form data into the database, with the associated validation. It works. $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "comments")) { $comment = htmlentities($_POST['comment']); function check_field1($comment) { if (preg_match("/</", $comment)) { return TRUE; } } $error=0; if(check_field1($comment)) { $error++; $insertGoTo = "comments.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); // $error=$error+1; } if($error == 0) $insertSQL = sprintf("INSERT INTO comments (comment, `day`, `month`, `year`) VALUES (%s, %s, %s, %s)", GetSQLValueString($_POST['comment'], "text"), GetSQLValueString($_POST['day'], "int"), GetSQLValueString($_POST['month'], "text"), GetSQLValueString($_POST['year'], "int")); mysql_select_db($database_connection, $connection); $Result1 = mysql_query($insertSQL, $connection) or die(mysql_error()); $insertGoTo = "comments.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); }
  7. Many thanks orio, I'll have to have a look at htmlentities in the manual to find out what else I don't know about it. Your help has been invaluable Best Regards Taffd
  8. No. When I use the character <, "I get string is ok". However if I substitute , with A, then inputting A as $comment, gives me "string is not ok". ie it works.
  9. Hi all, Can anybody tell me why this simple regex doesn't work $comment = htmlentities($_POST['comment']); if (preg_match("/</", $comment)) { print 'string is NOT OK!'; } else { print 'string is OK!'; } This if statement works if I substitute < with another character. I'm confused
  10. Hi folks, My existing site is http://www.myverdict.net The new design can be viewed at http://myverdict.net/HTML/myverdict_home.php Your comments would be appreciated.
  11. Hi all, I've googled, forummed, manualled and experimented but am unable to accomplish simple form validation. Problem example; comment page. I wish to validate a text area. I want it to contain text,numbers, punctuation and a few special characters ie/./,/"/£/$/! I can accomplish the required regex. Anyway, I would like to validate the input, send it to the database if ok and if not refresh the form page with existing text and an error message saying something like "The following characters are not allowed." I also need to know how to adjust the dreamweaver code accordingly. I've been experimenting with simple validation over two pages using !preg_match and although I've had minor success, I've found that I can have (<) or (<<<<) show an error but if I input (<.) or (<anyletter), it validates as ok. I haven't been able to make any headway with preg_match_all. Is there anybody in the world who is able to help please?
×
×
  • 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.