Jump to content

SieRobin

Members
  • Posts

    212
  • Joined

  • Last visited

    Never

Everything posted by SieRobin

  1. Nevermind I got it, thank you very much :]
  2. Ok and as for the nm, prc? How does the javascript, know what they are?
  3. [code]$sellp=$uinventory3['cost']*.6; $sell=$_GET['sell']; $item=$_GET['item']; $name=$_GET['name']; $sellid=mysql_query("SELECT * from inventory where IID='$item' AND UID='$userstats3[ID]'"); $sellid2=mysql_fetch_array($sellid); print "<td>$uinventory3[name]</td>"; print "<td><a href='inventory.php?sell=$sellp&item=$inventory3[IID]&name=$uinventory3[name]' onclick='return sellitem();'>$sellp</a> Gold</td>"; if (isset($sell)&&$item=$sellid2['IID']) { if ($sellid2['status']==1) { print "<table class='table'><tr class='headline'><td colspan='4'><center>Inventory</center></td></tr> <tr class='mainrow'><td><center>You can not sell something that's equipped, please return to your <a href='inventory.php'>inventory</a> to unequip the item you're trying to sell.</center></td></tr></table>"; exit; } else { mysql_query("UPDATE users set gold=gold+'$sell' where ID='$userstats3[ID]'"); mysql_query("DELETE from inventory where UID='$userstats3[ID]' AND IID='$item'"); print "<SCRIPT language='JavaScript'> location.reload('inventory.php') </script>"; exit; }[/code] That's the code for selling the item. [code]<script language="JavaScript" type="text/javascript"> var message="text"; function sellitem() { return confirm("Are you sure you want to sell your " + message + " for $sell Gold?"); } </script>[/code] This is the javascript with the confirm.
  4. I'm trying to make it so when a user sells an item, it shows a confirm that says. "Are you sure you want to sell your $itemname for $howmuchgold Gold?" How I do this, I don't know. I could make it so it doesn't show the variables.. BUT then they won't know what they're confirming or not.
  5. I did the $_GET variable like that, problem is.. with a confirm the URL doesn't load until you pick "Ok" or "Cancel"
  6. Yeah that works.. what I'm trying to do is use a $_GET in javascript, is there like an equivlant statement in javascript to do that?
  7. Yeah I'm new to javascript, I'm used to PHP. How in the world do I print a variable into a confirm message? It's starting to really bug me lol.
  8. One small question though. For each thread you can view it basically with a title set in the link tag, so when you hold your cursor over the link it shows what was posted so you don't have to click on it to read it. Now if there is quotes or an apostrophe.. it won't display anything past the apostrophe or quote. I tried using, "addslashes" but it really doesn't do anything. How could I make it so you can read the entire thing?
  9. Wow haha, ok now \n is working, do NOT ask why please, because I cannot give you that answer. It's working perfectly now, thank you everyone for taking out the time to help me with the problem :D I appreciate it. Woohoo!
  10. [quote author=HeyRay2 link=topic=102818.msg408999#msg408999 date=1154623871] You didn't answer the question I posed. Are you performing any modifications on the reply text before it's submitted to the database? If so, we need to know what those modifications are so we know what state the text is in. Only then will we know what needs to be done to that text to get rid of your "rn" problem. My code will only work if you have not yet stripped the slashes from your reply text. Perhaps posting a snippet of your "reply" code would be a step in the right direction. [/quote] The script was pretty simple HeyRay2, all it really was, was a $_POST from the textarea on the form. Nothing is modified or even messed around with. It's straight forward posting information into the database.. that's all.
  11. [quote author=RockingGroudon link=topic=102818.msg408923#msg408923 date=1154617977] but replacing rn in a sentence like "he is a stern guy" would make it "he is a ste guy" and i dont think he wants that and use this if you relly want to change rn = \n [code] <?php $text="I love...rnguess whatrnchocolates"; $text=str_replace("rn", "\n", $text); echo $text; // Results:- // I love... // guess what // chocolates ?> [/code] [/quote] This somewhat works, but I changed \n to [code]<br>[/code]. What's odd is that the \n will not work. I know this because for quoting on my forum I use "\n" to space the text out from the quote. But once it is submitted it doesn't put "\n" it puts rn in replace of that. What's also really odd is that it worked before, it just now decided not to work anymore. The only problem with it, is that if you line break twice, it will only inster ONE line break, not two.
  12. [quote author=HeyRay2 link=topic=102818.msg408929#msg408929 date=1154618751] Are you performing a [b]stripslashes()[/b] on the reply text before it's added to the database? If so, that would change "\r\n" to "rn". Run a [b]str_replace()[/b] or a [b]preg_replace()[/b] instead of stripping slashes, change "\r\n" to "\n", then change "\n" to HTML line breaks, and you should be good to go: [code=php:0] $text = nl2br(preg_replace("/\r\n/", "\n", $_POST['text'])); [/code] [/quote] I tried this, it didn't work, gave me the same thing without it.
  13. [quote author=Crayon Violent link=topic=102818.msg408918#msg408918 date=1154617461] is this your own personal forum you are coding or some other script (like ipb, phpbb, etcc) that you are using? [/quote] My own personal forum.
  14. [quote author=hackerkts link=topic=102818.msg408669#msg408669 date=1154587597] I believe he meant preg_replace("rn", "\n", "words... words and words.."); [/quote] Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /home/sierobin/public_html/forum.php on line 29 That gives you an error. I still have a question though that wasn't answered.. I really don't understand why this is happening now, since it never has before.
  15. What exactly do you mean?
  16. Whyyyy in the world is it doing this? It's putting rn for a line break, HOW do I fix this?
  17. Or is there some way I can change the character? I just want it gone so it will work correctly, this hasn't happened before, just started today.
  18. Ok, for the forum on my site, when you post a reply and hit the enter button to make line breaks, it puts "rn" for each enter into the database. Anyone know why it would do that?
  19. [quote author=scottybwoy link=topic=101955.msg406530#msg406530 date=1154360871] You can use a seperate file for hadling sessions, for portability.  I have one se up that thats creates a session for each user.  The session will then last as long as you set it up for in php.ini.  Here one I borrowed from http://www.evoknow.com/downloads.php Need to connect to the database first. [code] $SESS_LIFE = get_cfg_var("session.gc_maxlifetime");         function sess_open($save_path, $session_name) {            return true;         }         function sess_close() {            return true;         }         function sess_read($key) {                 global $dbi, $DEBUG, $SESS_LIFE;                 $statement = "SELECT value FROM sessions WHERE " .                        "sesskey = $key AND expiry > " . time();                 $result = $dbi->query($statement);                 if ($DEBUG) echo "sess_read: $statement <br>result: $result<br>";                 $row = $result->fetchRow();                 if ($row) {                    return $row->value;                 }                 return false;         }         function sess_write($key, $val) {                 global $dbi, $SESS_LIFE;                 $expiry = time() + $SESS_LIFE;                 $value = addslashes($val);                 $statement = "INSERT INTO sessions VALUES ('$key', $expiry, '$value')";                 $result = $dbi->query($statement);                 if ($DEBUG) echo "sess_write: $statement <br>result: $result<br>";                 if (! $result) {                         $statement = "UPDATE sessions SET expiry = $expiry, value = '$value' " .                                "WHERE sesskey = '$key' AND expiry > " . time();                         $result = $dbi->query($statement);                 }                 return $result;         }         function sess_destroy($key) {                 global $dbi;                 $statement = "DELETE FROM sessions WHERE sesskey = '$key'";                 $result = $dbi->query($statement);                 if ($DEBUG) echo "sess_destroy: $statement <br>result: $result<br>";                 return $result;         }         function sess_gc($maxlifetime) {                 global $dbi;                 $statement = "DELETE FROM sessions WHERE expiry < " . time();                 $qid = $dbi->query($statement);                 if ($DEBUG) echo "sess_gc: $statement <br>result: $result<br>";                 return 1;         }         session_set_save_handler(                 "sess_open",                 "sess_close",                 "sess_read",                 "sess_write",                 "sess_destroy",                 "sess_gc"); [/code] You need to make some other files first to talk to it. But shud give you all you need. [/quote] Looks like a giant blur to me, lol.
  20. Sorry, this is way confusing to me lol.
  21. So I can include the file checkonline.php, but below the include i put, "log_action();"?
  22. i'm including a file with the log_action() in it called checkonline.php.
  23. alrighty, well i included the file on each page, still didn't work, and of course i took your script and dubbed it into my own settings.. dunno what's up with it i guess.
×
×
  • 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.