Jump to content

EchoFool

Members
  • Posts

    1,074
  • Joined

  • Last visited

Everything posted by EchoFool

  1. Basically on output say a user put <span class=name>text</span> it would take into affect if that class was a valid one. So to stop people using classes and divs i needed the function that you guys have suggested. So i used it, but then forgot that if a user quotes another user. The quote is constructed via "<div>" to seperate the quoted message from the actual message so people know what is being quoted. How ever with , htmlentities function it has now caused the quotes to just come out as a block of text... So messages that quoted a post now just looks like: So is there a way to allow certain div's with htmlentities and not others or some method of avoiding this problem?
  2. Hang on this can't work as i call a div when some one
  3. I have a problem with my messages system where by if a user types in html in the block of text the reciever sees it as if its a page layout.. how do i stop that from happening? I currently have this before it goes into query: <?php $MessageText = mysql_real_escape_string(stripslashes($_POST['letter'])); ?> (from sender) And this for when it is echo'd (The reciever reading it) <?php echo ucfirst(nl2br(stripslashes($MessageText))); ?> Also tried: <?php echo ucfirst(stripslashes(nl2br($MessageText))); ?> Neither worked... Suggestions?
  4. So it should be: mysql_real_escape_string(stripslashes($_POST['Start'])); ?
  5. I have a text area which, with the inputted text goes to an update query and adds it to a text field. Now this is what i put before it goes in: <?php $Start = stripslashes(mysql_real_escape_string($_POST['Start'])); //query here ?> Now the next page echos it: <?=nl2br(strip_tags($MissionInfo))?> For some unknown reason though, the structure is lost like new lines so it becomes one giant text. And it occasionally adds rnrn to my paragraphs for no reason... Example of block of text: Hello there ! Testing this sentence!Testing this sentence also!rnNow then, i hope this works.rnrn Observe the bold rnrn... why is that happening?
  6. Scott, I don't know I saw it in the php site so presumed it was needed. But it is fixed now i have removed it. So thankyou for that!
  7. Thankyou for your reply! I am getting this how ever now as an error: Notice: Undefined offset: 1 on line 57 <?php $IDType = explode('|', $ID, -1); $Type = $IDType[0]; $ID = $IDType[1]; //this line ?>
  8. I have a value which carries to bits of infomation seperated by | symbol. But I do not know how to split them into two different variables. <?php $ID = 'Country|23'; $IDType = explode('|', $ID, -1); $IDType[0] = $Type; $IDType[1] = $TypeID; ?> What im trying to get is $Type = Country; $TypeID = 23; But it is not working, what am i doing wrong ?
  9. makes total sense! Thanks guys! Works a treat now
  10. Yes its before the query insert occurs. The string comes from the database so its in the database as Username's Query. Though this didn't go through a stripslashes upon insert, however it does go through the mysql_real_escape_string. Thats the error you can see it starts from the 's Query. My code: $Name comes from the database and it equals "Username's Query". <?php $TableName = 'logs'; $Log = 'Ths is '.$Name; $INSERT = mysql_query("INSERT INTO $TableName (Log,UserID,LogTime) VALUES ('$Log','{$_SESSION['Current_User']}','$Date')") Or die(mysql_error()); ?>
  11. Quick question, i have a variable holding a string like this: "Username's query" Now when i put this into a query the ' symbol is causing it to crash, what can i do to prevent that upon the moment a query occurs? I have this at the moment: $row = mysql_fetch_assoc($Check); $Name = stripslashes(mysql_real_escape_string($row['Name'])); But that doesn't fix the issue Any suggestions?
  12. I have the idea of a while loop with a query which is also in a while loop.. so in essence a while loop within a while loop. Now obviously that is do-able but the first main query i need to select rows in batches of 3's via ID for example. Now what needs to be added is a while loop around that whole thing so the "$Get the first 3" will essentially do this: Get first 3 Get 4 to 6 Get 7 to 9 etc But could not figure out how I could do this..... any suggestions?
  13. Tried that... It accepted "test.php" But php_self see's it as /test.php so then there is a problem. Specially when the test.php is in many subfolders etc.
  14. Is there a pre-made function for doing something like: Say a variable had 'testfolder/test.php' or just 'test.php' (as a string). Then you use that variable to check your server to see if that page exists? And if the function cannot find it then it errors ? Is such a function in existance? I did some searching but kept finding functions to check if image locations were valid but never scripts...
  15. So it would be: For my first Q: echo nl2br(strip_tags($str)); And for my second Q: stripslashes(mysql_real_escape_string($str));
  16. I have 2 questions about outputs of which I do not know how to fix. Firstly, say a user inputs a paragraph that they decided to use <Span class=whatever>Words etc</span> How can you stop upon output the class being called so it will just be "Words etc" but not changed the words colour or what ever from a span class that it reads? And secondly say a user inputs a paragraph again with some thing like: When i input this i use the : mysql_real_escape_string For safety, but then the ouput for it will become:
  17. I have two tables like so: Usereventtable (in this case has no rows) UserID | EventID | Complete | and eventtable (has one row) EventID | ActivateUrl | Other random fields unrelated to this 1 bleh.php etc etc etc What i am trying to do is, collect all the rows which are found in eventtable but no in usereventtable related to a userID and then pick a random row from that select. How ever it should be finding one row as I purposely put a dummy row in to make sure it works but my mysql_num_rows says it is not finding any row. My code: <?php $Find = mysql_query("SELECT eventtable.EventID FROM eventtable,usereventtable WHERE eventtable.ActivateUrl='$Url' AND eventtable.EventID != usereventtable.EventID AND usereventtable.UserID='{$_SESSION['Current_User']}' ORDER BY RAND() LIMIT 1") Or die(mysql_error()); If(mysql_num_rows($Find)<1){ Echo 'failure, check query'; }Else{ Echo 'woo!!'; } ?> What have I done wrong?
  18. Ill re-post in the mysql section if some one could delete this thread as to avoid duplicates.
  19. I have two tables like so: Usereventtable (in this case has no rows) UserID | EventID | Complete | and eventtable (has one row) EventID | ActivateUrl | Other random fields unrelated to this 1 bleh.php etc etc etc What i am trying to do is, collect all the rows which are found in eventtable but no in usereventtable related to a userID and then pick a random row from that select. How ever it should be finding one row as I purposely put a dummy row in to make sure it works but my mysql_num_rows says it is not finding any row. My code: <?php $Find = mysql_query("SELECT eventtable.EventID FROM eventtable,usereventtable WHERE eventtable.ActivateUrl='$Url' AND eventtable.EventID != usereventtable.EventID AND usereventtable.UserID='{$_SESSION['Current_User']}' ORDER BY RAND() LIMIT 1") Or die(mysql_error()); If(mysql_num_rows($Find)<1){ Echo 'failure, check query'; }Else{ Echo 'woo!!'; } ?> What have I done wrong?
  20. Oh right i see that makes sense now ! Ok i changed it to >= 1 and it works a treat! Thanks guys !
  21. I have a mysql function to check the query before it actually updated.... yet even tho the row was affected the check seems to fail... <?php $Update = mysql_query("UPDATE usertable SET Complete=2 WHERE UserID='{$_SESSION['Current_User']}' AND OtherID='$ID'") Or die(mysql_error()); If(mysql_affected_rows()>1){ Echo 'pass'; }Else{ Echo 'fail'; } ?> I always get Fail being echo'd even though when I check my database it did infact update to "2" for the complete field. Which leads to me being confused as to why the mysql_affected_rows function is not working. Any ideas? Hope you can help!
  22. I shall give it a try. Thankyou.
  23. pugboy that looks over complicated for something that is probably simplistic to do. I am aware its server sided. I am trying to deal with process (after _POST and on submit) So value would come out as: 2,ITEM lets say in the form process. Then i need to break that apart to get just: $id = 2 $type = ITEM At that point i can then put them in to the correct fields in my database.
  24. I am trying to put two values into a select box but I don't how to retrieve them. I have something like this: <option value="<?=$ItemID?>,Item"><?=$Name?> - Item</option> Then in the form process some how grab Item and grab <?=$ItemID?> value aswell. Is this possible ?
×
×
  • 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.