Jump to content

rickyj

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.ai-stockmarketforum.com

Profile Information

  • Gender
    Not Telling

rickyj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. okay, its a simple question, but I have no idea how to search for this. How can I put a forward slash within quotes. I have a problem, a string gets converted to "xyz/" and is then put in an sql querry, how can I detect the slash, I cant use: strpos($encPass, "\" ) > -1 Since the \ makes the quotation a non surrounding quotaion.. so what can I use to detect a forward slash?
  2. a simple java solution would be: (after splitting Srch into array) this_column.indexOf(splitSrch) != -1 but have no idea how to put this into an sql statement. Please HELP..
  3. for example : WHERE this_column Like '%srch%"' solves if srch = "puzzle" and this_column = "a puzzle search phrase" but doesnt solve the case where for instance if srch = "this is a puzzle" and on one of the rows this_column = "a puzzle search phrase" - It might be possible to split srch, via ' ', and then check for each of the arrays eg: $splitSrch = split(' ', $srch) and then use: WHERE (this_column Like '%splitSrch[0]%' Or this_column Like '%splitSrch[1]%' ...) but $srch may not always contain two words... hmm, must be an easier way of doing this
  4. Does anyone know how to put the following in to a query WHERE At least one of the words in the phrase "srch" must contain at least on of the words in "this_column" for instance if srch = "this is a puzzle" and on one of the rows this_column = "a puzzle search phrase" so the where statement is true for this row.
  5. my above code was supposed to say str_replace (The edit function was not working for me?). preg replace doesnt seem to work here for some reason? However, It should be noted, before I use these variables, I get them via this method: stripslashes((get_magic_quotes_gpc()) ? $_POST[$MyString] : addslashes($_POST[$MyString])));
  6. Thanks for the help, I tried this but get the following for: 1st line new line third line gets converted to :1st line\r\nnew line\r\nthird line\r\n (looking at the database: looks exactly the same) i.e., it doesn’t get converted at all. yet, $string = preg_replace('\r', '<br>', $string); works but leave /n at the start of each line, and $string = preg_replace('\r\n', '<br>', $string); works, but deletes n's off of the start of a new line if its present <-- this I find really odd!
  7. Hi there, I’m having a real bit of trouble, and I cant narrow it down. I’m trying to get a form to post a message to a mySQL data base, and replace the users input new lines into <br> - But this doesn’t seem to be working as expected. - I have tried lots of things, but they all give strange results. - the Mysql column is a text column - I have tried using nl2br, but this does nothing to the text. Im currently using: function nl2br2($string) { $string = str_replace('\r\n', '<br>', $string); $string = str_replace('\r', '<br>', $string); $string = str_replace('\n', '', $string); return $string; This works perfect, unless the new line start with an n, if the new line starts with an n the n gets striped: first line new line third gets converted to first line<br>ew line<br>third if I use this: function nl2br2($string) { $string = str_replace('\r\n', '<br>', $string); $string = str_replace('\r', '<br>', $string); return $string; I get: first line \nnew line \nthird I cant figure out whets going on here? I have also tried using variations, but get exactly the same result: function nl2br2($string) { $string = str_replace('\n\r\n', '<br>', $string); $string = str_replace('\r\n\n', '<br>', $string); $string = str_replace('\r\n', '<br>', $string); $string = str_replace('\r', '<br>', $string); $string = str_replace('\\n', '', $string); $string = str_replace('\nn', ' n', $string); $string = str_replace('\n', '', $string); return $string; gets converted to first line<br>ew line<br>third function nl2br2($string) { $string = str_replace('\n\r\n', '<br>', $string); $string = str_replace('\r\n\n', '<br>', $string); $string = str_replace('\r\n', '<br>', $string); $string = str_replace('\r', '<br>', $string); $string = str_replace('\\n', '', $string); $string = str_replace('\nn', ' n', $string); return $string; I get: first line \nnew line \nthird Any on know what is happening?
  8. Referer is not used by all browsers (and can easily be faked)
  9. Sorry, cant do that, but I can give examples (as the one above) Im bassically asking it there is a way of grabing the full url, since $_SERVER['PHP_SELF'] only grabs "/this.php" from www.example.come/this.php?other=things&more=1 If I could grab the full url I would be able to show that 'other' and 'more' are or are not set without using isset, or get. I dont like using isset($_GET['a'] ) since if the user manipulates the a variable to "a = ']) && more code //", this is unsafe!
  10. The problem is, I really dont want to use isset and then get (I cant trust users input so do a lot of stipping of characters). I was initially using isset, and then relised the security flaw
  11. I need it to go to the second page, and then display the contense, its just looping at the moment
  12. is there a way to redirect www.example/this.php to www.example/this.php?a=1&b=2 I have tried using: but this results in a loop, any ideas?
  13. hmm, "INSERT INTO sigparsed (a, b, c, d) VALUES ('2', '1', '$var1', '0' )WHERE userid = '$UserID' " hmm getting there, but I cant use the where statment like this can I? how can I do the above?
  14. yes, I shouldnt be using insert, But I have made some progress thanks to you guys, cheers
×
×
  • 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.