Jump to content

Airhead315

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Airhead315

  1. you never output $number. You use it to set $code2 but then $code2 is never used either.
  2. I must be confused as to what the question is...because with 300+ posts I would hope this would be more obvious by now...If you have two POST forms submitting to the same PHP script then add a post variable to each form named "submissionForm" and have it be unique between each form: Form 1 add: <input type=hidden name=submissionForm value="form1"> Form 2 add: <input type=hidden name=submissionForm value="form2"> Change code to: <?php if (!empty($_POST)) { if($submissionFrom == "form1") { $query="INSERT INTO ".TBL_AWARDS." VALUES (NULL, '$type','$user', now(), '$acomment')"; // processing logic if(!$acomment || strlen($acomment = trim($acomment)) == 0) echo "Comment not entered"; else if(!$acomment || strlen($acomment = trim($acomment)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$acomment || strlen($acomment = trim($acomment)) > 10){ echo "".$_SESSION['username'].", you have added an award to ".$_POST['awarduser']."'s Profile. "; mysql_query($query);} } else if($submissionFrom == "form2") { $query2="INSERT INTO ".TBL_AWARDS." VALUES (NULL, '$type2','$user2', now(), '$comment2')"; // processing logic if(!$comment2 || strlen($comment2 = trim($comment2)) == 0) echo "Comment not entered"; else if(!$comment2 || strlen($comment2 = trim($comment2)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$comment2 || strlen($comment2 = trim($comment2)) > 10){ echo "".$_SESSION['username'].", you have added recognition to ".$_POST['recuser']."'s Profile. "; mysql_query($query2);} } else { echo "Where is this request coming from"; } ?> Please note that there are ALOT of coding issues with your code. For one, you insert into the database before you do your error checking...
  3. Ok, So I developed a system which is best referred to as the core system (common components, default configuration...etc). I did not program this using classes (though I should have) because initially this was a very small project but it keeps getting bigger and bigger. My primary navigation into each different section is a case statement: switch($section) { case "Contacts": include a file...do some stuff break; case "Something else": include a file...do some stuff break; } A little more information: Different entitities (which can be added via a database) will use this system and some may need custom sections to be added. Right now the way I handle if they want to modify something in the "Contacts" section is that I create a directory using thier acronym and put a file with the same name as the include file in it. The main system always checks for include '$acronym/contacts.inc' for instance. If it is there it includes it and then it includes the standard contacts.inc. The standard contacts.inc verifys a function is not defined before attempting to define it, so this allows each entity to override certain portions of the system. Any finally, the problem: If an entity wants to add a new section which isnt part of the core system I want to add that to the switch statement without having to have each entitys custom sections included in the main file. In a perfect world I would be able to do something like this: switch($section) { case "Contacts": include a file...do some stuff break; case "Something else": include a file...do some stuff break; injectifexists '$acronym/customSections.inj'; } The customSections.inj would contain something like: case "some custom thing": include a file...do something break; Is there anything I can do to get a similar functionality? Thanks for any and all help, Aaron
  4. Im having probably the most rediculous problems with the simplest regular expression ever. Here is the code im trying to parse out of: <B>Original Message:</B> <P> <b>Posted by:</b> someguys name (<a href="mailto:someguy@somesite.com ">someguy@somesite.com </a>)<BR> <b>Organization:</b><a href="http://www.somesite.com ">JAQUET Ltd </a> <BR><b>Date posted:</b> Thu Jan 14 5:23:11 US/Eastern 2001 <br> <b>Subject:</b> some subject of a forum <br> <b>Message:</b><br> some long message that has no html tags in it no breaks and no other weird charachters I tried getting just one part of the meta data I wanted with the following code preg_match("/<b>Posted by:<\/b>(.*)<BR>/i", $parts[$i],$innerparts); echo $innerparts[1]; As you can see im trying to get the Name/Email of the user who posted the message. However im not getting anything back("Undefined offset: 1") $parts[$i] holds the content shown above. I also tried the following lines with the same result preg_match("/\<b\>Posted by:\<\/b\>(.*)\<BR\>/i", $parts[$i],$innerparts); preg_match("/<b>Posted by:<\/b>(.*?)<BR>/i", $parts[$i],$innerparts); preg_match("/<b>Posted by:<\/b>(.*?)<BR>/i", $parts[$i],$innerparts);
×
×
  • 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.