Jump to content

djfox

Members
  • Posts

    327
  • Joined

  • Last visited

    Never

Everything posted by djfox

  1. First the background story: I`ve had this strip of coding working for several months, never touched it. The server host has changed something where all of my codes went into a seizure and no longer work so I`ve had to rebuild my site to get everything to work. The code that needs looking over: <?php session_start(); include("dbcon.php"); include("func.php"); require_once "auth.php"; require_once "design.php"; if (!isLoggedIn()) { Redirect("index.php"); } if ($lev > 0) { $log = $_SESSION['sess_name']; $id = $_POST['id']; $p = $_POST['p']; $pr = $_POST['pr']; $s = $_POST['s']; $it = $_POST['it']; $n = $_POST['n']; $res3 = mysql_query("Select id,login,echo_count FROM userdata WHERE id='$s'")or die( mysql_error() ); $sel = mysql_fetch_row($res3); mysql_free_result($res3); if ($_SESSION['echos'] >= $p) { $res = mysql_query("SELECT id,seller,item,sellprice,price,sellerid FROM coll_sell WHERE id=$id"); $chap = mysql_fetch_row($res); mysql_free_result($res); $_SESSION['echos'] = $echos = $echos - $chap[3]; mysql_query("UPDATE userdata SET echo_count='$echos' WHERE id='$logged' ") or die(mysql_error()); mysql_query("INSERT INTO sales (seller,buyer,item,echos) VALUES ( '$sel[1]', '$log', '$n', '$p' )"); mysql_query("INSERT INTO coll_inven (user,item,price) VALUES ( '$log', '$it', '$pr' )"); mysql_query("DELETE FROM coll_sell WHERE id=$id"); $entry_date = strftime("%B\ %e\,\ %Y %H:%M:%S", time()); mysql_query("INSERT INTO trace_history3 (user,date,action,amount) VALUES ( '$log', '$entry_date', 'Bought $n', '$p' )")or die ( mysql_error()); header("Location: trancershop.php?g=$sel[0]"); } else { header("Location: trancershop.php?g=$s&alert=noechos"); } } else { header("Location: today.php"); } ?> What the code is supposed to do: In short, it is a virtual transaction. The item is removed from the sales table, item is added to buyer`s inventory, the amount of echos (currency) the seller marks the item for should be removed from buyer`s echos amount and put the amount in sales for the buyer to pick up. What the code is currently doing: It will remove the item from the sales table, it is entering the item into the buyer`s inventory, the amount is entered into sales for seller to pick up, however the amount is not being correctly removed from the buyer`s echos. What I have done: I`ve echo`ed out all the information and the information being transferred through the form for the transaction is correct and all of the info is being picked up by the code. I`ve re-written the line of codes involving the removal of the ehcos amount from the buyer`s amount and have two different results: 1) the buyer`s echos remain the same 2) the buyer`s echos change to the negative amount of what $p is instead of just simple subtraction References: The following line of code $_SESSION['echos'] = $echos = $echos + 10; mysql_query("UPDATE userdata SET echo_count='$echos' WHERE id='$logged' ") or die(mysql_error()); is used in another file where echos are being added to the user`s echos amount and this works perfectly fine. I post this because some people have issues with how I write the code for math calculations of the echos and claim it doesn`t work, however I have files where it does work, and this had worked for months. Additional info: $logged is defined in design.php which I am not posting because that is not the problem. I think that`s all the info needed.
  2. Just in case anyone else comes across this: I find that putting plain <td valign=center align=right> does not work. I had to put <td valign=center width=30% align=right> to get it to work right.
  3. Huh, before when I tried that it wouldn`t budge. Now it`s working. Perhaps I just misspelled it last time... Thanks for the help.
  4. I want a table column <td valign=top> to be aligned not only to the top but to the right as well. How do I do this?
  5. That got it working. Thanks a bunch, buddy. ^^
  6. I`ve tried this code: <?php if ($checkhour == 00 || $checkhour == 12) { $dayname = "Evening"; $daynum = "2"; } elseif ($checkhour == 01 || $checkhour == 02 || $checkhour == 03 || $checkhour == 04 || $checkhour == 05 || $checkhour == 13 || $checkhour == 14 || $checkhour == 15 || $checkhour == 16 || $checkhour == 17) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 06 || $checkhour == 18) { $dayname = "Morning"; $daynum = "4"; } elseif ($checkhour == 07 || $checkhour == 08 || $checkhour == 09 || $checkhour == 10 || $checkhour == 11 || $checkhour == 19 || $checkhour == 20 || $checkhour == 21 || $checkhour == 22 || $checkhour == 23) { $dayname = "Day"; $daynum = "1"; } ?> But it still will not work for hour 08.
  7. Ok, first, here is the code: <?php $checkhour = strftime("%H", time()); if ($checkhour == 00) { $dayname = "Evening"; $daynum = "2"; } elseif ($checkhour == 01) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 02) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 03) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 04) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 05) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 06) { $dayname = "Morning"; $daynum = "4"; } elseif ($checkhour == 07) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 08) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 09) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 10) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 11) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 12) { $dayname = "Evening"; $daynum = "2"; } elseif ($checkhour == 13) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 14) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 15) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 16) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 17) { $dayname = "Night"; $daynum = "3"; } elseif ($checkhour == 18) { $dayname = "Morning"; $daynum = "4"; } elseif ($checkhour == 19) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 20) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 21) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 22) { $dayname = "Day"; $daynum = "1"; } elseif ($checkhour == 23) { $dayname = "Day"; $daynum = "1"; } ?> Here is what the code should do: Figure out what hour the time is and declare if the time is day/night/morning/evening depending on what the hour is. What the problem is: It seems to have a problem with hour 08. All the other hour times work but that one. And by work I mean it will echo $dayname. With hour 08, it echos nothing. EDIT: Anyone know what happened to the "Topic Solved" tab? Past few posts of mine I cannot find that to mark my topics solved.
  8. Thanks a bunch! (For some reason the forum won`t let me mark this topic solved.)
  9. I have a thumbnail creator that someone else had developed for me. It works for jpg images but my site also has png, gif bmps and probably more in the future. But the thumbnail creator can`t do thumbnails for these non-jpg images. Here`s what the thumbnail creator is: <?php // File and new size //$imgfile = 'thumb.jpg'; //$percent = 0.2; header('Content-type: image/jpeg'); $imgfile = $_GET['img']; list($width, $height) = getimagesize($imgfile); //echo $width, $height; $newwidth = 100; $factor = $newwidth / $width; //echo $factor; $newheight = $height * $factor; $thumb = ImageCreateTrueColor($newwidth,$newheight); $source = imagecreatefromjpeg($imgfile); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb); ?> Any advice?
  10. Because the form url could be changed to cheat the code. Thanks, I`ll give that a shot.
  11. I`m building a mini-game using php where there is a score involved. It will use forms to send the information along. Thus far, forms I`ve seen (and used) show the url as things like game.php?id=8&s=1000 Anything I can do to keep people from being able to just type in things in the url bar to cheat the code?
  12. Oh, all I needed was that slash? Ok, thanks a bunch!
  13. You mean you didn't read it, tried to copy and paste, and nothing worked. I did read it.
  14. It isn`t picking it up it seems, did I do it correctly? <?php if ($_SERVER['PHP_SELF'] == explore.php){ $whereloc = "Exploring"; } ?>
  15. I tried using php.net to look this up myself but it keeps saying it has an internal error. So! What I would like to do is have the script check what the current url is, like if the page is currently explore.php or today.php
  16. All righty, I`ll see what he says.
  17. I hope this is the right forum for this. I currently have some functioning javascript games on my site. What I would like for them to do is if the person playing them is logged in, they earn credits when they complete something in the game (basically updating the database for accomplishing a certain task in the game). Is this possible?
  18. Yes, I wanted to count up all. I basically just wanted to see how many copies of an item was floating around. I posted your code in but that seems to have made no effect.
  19. I`ll just post the code: <?php if(!$offset) $offset=0; $recent = 0; $res = mysql_query("SELECT id,name FROM clothing ORDER BY name ASC")or die( mysql_error() ); while( $c = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 200000000 )){ $res2 = mysql_query("SELECT COUNT(*) FROM clot_sell WHERE item='$c[0]'"); $count1 = mysql_fetch_row($res2); mysql_free_result($res2); $res3 = mysql_query("SELECT COUNT(DISTINCT bought) FROM userdata WHERE bought='$c[0],'"); $count2 = mysql_fetch_row($res3); mysql_free_result($res3); $total = $count1[0] + $count2[0] ; echo "$c[1] -> <b>$total</b><br>"; } } $res4 = mysql_query("SELECT COUNT(*) FROM clot_sell"); $count3 = mysql_fetch_row($res4); mysql_free_result($res4); $res5 = mysql_query("SELECT COUNT(*) FROM clothing"); $count4 = mysql_fetch_row($res5); mysql_free_result($res5); echo "<p>Total for Sale: <b>$count3[0]</b>"; echo "<br>Total of types available: <b>$count4[0]</b><p>"; ?>
  20. It`s gone bonkers saying it`s not a valid argument. Ah never mind it. It was just something for a statistical curiosity anyhow. No big deal. Thanks for trying, guys.
  21. I must be doing something wrong since nothing shows up: $resb = mysql_query("SELECT LENGTH(`bought`) - LENGTH(REPLACE(`bought`, ',', '')) AS `count` FROM `userdata` WHERE bought='$c[0]'"); $try = mysql_fetch_row($resb); mysql_free_result($resb);
  22. Oh no, I totally know what you guys mean by the other way of setting this up. And I agree totally that it`s easier to work with in the long run. The reason I`m trying to stick with how the guy had it was because the entire doll system he made for me depends on the items listed in bought. I`m not skilled enough to redo it myself nor can I afford to have him (or even another person) redo it.
  23. I`ve heard conflicting statements about that, back when I was trying to work out favourites system for my site. I wanted to have each favourite made by it`s own entry in a table and people in another forum (don`t ask me the name, I haven`t been there in a few months) said that was inefficient and that I should add them all into one field in the person`s account information table. But here you guys say the opposite. *headscratch*
×
×
  • 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.