Jump to content

uniflare

Members
  • Posts

    867
  • Joined

  • Last visited

About uniflare

  • Birthday 12/27/1988

Profile Information

  • Gender
    Male
  • Location
    UK - England

uniflare's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I would like to know why I have been given this warning: uniflare, You have been given a warning by .josh. Reason: Other Not trying to be anal but... You've been a member for almost 4 years, and have almost 1k posts...I think you should know by now to use code tags in your posts! .josh. I am pretty sure i use code tags. always, maybe i forgot. To that end, I will not be helping on this forum anymore. A warning for not posting code tags? wtf? I couldn't post unless i "acknowledged" the warning. This is like school. I have helped people on here because i like helping. not to be a part of some crazy mans empire. Maybe i just forgot to use code tags, and i get a warning like that, this forum is dead to me because of this admin. Bye bye
  2. Just read a warning about not formatting my post... wtf??

  3. $strings = array(); // sample data $letters = array(); $numbers = array(); foreach($strings as $str){ if(preg_match("#([a-z]*)([0-9]+)#i", $str, $matches)){ $letters[] = $matches[1]; $numbers[] = $matches[2]; } } print_r($letters); print_r($numbers); Preg match is very handy, would be quicker to use on blocks of text rather than single elements in a loop. (for text though use preg_match_all, slight differences)
  4. ah i see what youve done. Please explain code, and neaten it up lol - wrap your code in bb tags so its easier to read, but make sure it starts with a <?php. eg: [ code] <?php //some code ?> [/ code] --- basically, you make a php script called "getimg.php", you make it get an image from the database according to an paramters you give it via the URL, eg: getimg.php?img=fduiowehr9832 could be a lovely picture of your dog. After that, you ust change your current page so that ou put that link in there.
  5. sorry, if you are looking for php help then sure. HTML help is everywhere else. --- google "editable list box"
  6. Are you sure you are the author of this code? It ust seems you lack the knowledge to of got this far; The error your getting is because you are calling a class method/function "if ($theValidator->foundErrors())" if this method is not in "SystemComponent.php" i the "systemcomponent" class then you need to add it and make it do what you want it to do. === The error is pretty self explanatory, you cant use a method that hasnt been made/set.
  7. Arras are really simple once you get into them, and you cannot code without them . <?php $disallowed = array( "at", "the", "a", "or", "and" ); // and about 1 hundred other words lol. ?> then you may need a more advanced regex pattern, to use "preg_replace". Ask in the regex forum for help with that, something like: "/\A[ ]{0,1}".$current_word."[ ]{0,1}$/i" - this should work, but there might be more effective methods. My Example: <?php $disallowed = array( "at", "the", "a", "or", "and" ); // and about 1 hundred other words lol. //set string $string = $_POST['search']; // $_POST from form data. //loop foreach($disallowed As $current_word){ $string = preg_replace("/\A[ ]{0,1}".$current_word."[ ]{0,1}$/i"," ",$string); } echo($string); ?> The aim is to not leave half a word, eg: if ou searched for 'sweat', and ou filtered 'at', ou would be left with 'swe'. So you need a regex pattern that could handle that. or use a different method - like splitting the string into an array itself and remove specific values. - uniflare
  8. the function doesnt exist: foundErrors()
  9. the error is here: DJInfo= "This text is updated"," WHERE id = "1" rid urself of the ," <?php // Add this code, mysql_real_escape_string basically prevents SQL injection when working with insertion etc. Foreach($formVars As $Key=>$Value){ // So, this will loop each form variable, and temprorarily set the $key to the name of the variable, and $Value to the... value.. // This basically sets variables from the formvars array, $formVars['name'] will become $name, and so on.. $$Key = mysql_real_escape_string($Value); } // Change the query to a more standard structure. And remove the error mentioned above. $query="UPDATE `showinfo` SET `ShowName`= '$ShowName', `DJ`= '$DJ', ` Day`= '$Day', ` StartTime`= '$StartTime', ` EndTime`= '$EndTime', ` ShowDesc`= '$ShowDesc', ` DJInfo`= '$DJInfo' WHERE `id` = '$id' "; ?> hope this helps
  10. You will notice in the query it gives the "where id='' " should be something like, "where id='1' ". So its missing the ID for the ROW to update, so it doesn't update any, but it doesn't error, so. You need to add a "Hidden" type of input field: <input type="hidden"> with a value as the ID of the record that is being modified; [] Add this line into showupdate.php <?php /* This adds a "hidden" input field onto the form, (must be between <form> tags) */ ?> <input type="hidden" name="id" value="<?php echo($formVars["id"]); ?>">
  11. If you can just post "postupdate.php", should be able to work from there . Try changing: <?php //... $query="UPDATE showinfo SET ". "ShowName= \"".$formVars["ShowName"]."\",". "DJ= \"".$formVars["DJ"]."\",". "Day= \"".$formVars["Day"]."\",". "StartTime= \"".$formVars["StartTime"]."\",". "EndTime= \"".$formVars["EndTime"]."\",". "ShowDesc= \"".$formVars["ShowDesc"]."\",". "DJInfo= \"".$formVars["DJInfo"]."\",". "\" WHERE id = \"".$formVars["id"]."\""; mysql_query($query); mysql_close($db1); //... So you can debug it like this: <?php // ... $query="UPDATE showinfo SET ". "ShowName= \"".$formVars["ShowName"]."\",". "DJ= \"".$formVars["DJ"]."\",". "Day= \"".$formVars["Day"]."\",". "StartTime= \"".$formVars["StartTime"]."\",". "EndTime= \"".$formVars["EndTime"]."\",". "ShowDesc= \"".$formVars["ShowDesc"]."\",". "DJInfo= \"".$formVars["DJInfo"]."\",". "\" WHERE id = \"".$formVars["id"]."\""; // First DEBUG, check out what the query looks like: echo("<br />$query<br />"); mysql_query($query) or die ($query."<br />".mysql_error()."<br />"); // an OR DIE() is always useful to catch those simple mysql logic errors mysql_close($db1); // do not need this line unless you are connecting to different mysql host servers. // ... Tell us what it says, and we can work backwards from there .
  12. Any "Confidential" or "Restricted" files should always be put outside of the public root - that is: Typical SYSTEM path to web server public root: /home/web/www Translates to: http://www.some-website.com/ The public root being the folder "www", so if you store all your files in "/home/web/securefiles/" no one can access the folder anyway - Apache wont let them, but your php script has no problem serving the file itself, including files, or manipulating them.
  13. yes, you can change the pattern to validate emails etc as well. Do a google search for "preg_match validate form data"
  14. \A is the same as ^, Thge difference is ^ is like "At the start of this line". \A is like "At the very start of $subject". So if your matching against a multilined string, eg: this is [illegal ch4rs] a multiline blah blah so if u used ^, it would match ok since it would match line 2 and 3, but obviousl you dot see line 1. if you used \A, it would fail, since it spotted illegal characters o the first line. (it interprets it as a single lie, rather than multiline.) php.net/pcre for more information.
×
×
  • 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.