Jump to content

lead2gold

Members
  • Posts

    164
  • Joined

  • Last visited

    Never

Everything posted by lead2gold

  1. Thanks, i solved it actually; The purpose of it is to generate statistics that certain actions took place on our system at any given hour, or for a specified number of hours. I had to iterate through the date-time they specified and dump the results into a temporar table. From there i could generate all the statistics i ever needed from the new temporary table. The statistics are used for in-house so the overhead fo the temporary table isn't a problem since only few people have access to run the generation. Thanks though for your feedback.
  2. Is it possible to retrieve hourly (or on an interval) statistics from the database? For example... assume the following table simplified to show all the fields i require info from): table a { pkey BIGINT(20); userId CHAR(4); logEntry DATETIME; } I want to be able to see how many entries there are for user 'XXXX' ever hour... for a given time range. thus... the output looking something like: intervalf | intervalt | count 2007-12-31 00:00:00 | 2007-12-31 01:00:00 | 12 2007-12-31 01:00:00 | 2007-12-31 02:00:00 | 112 2007-12-31 02:00:00 | 2007-12-31 03:00:00 | 12 2007-12-31 03:00:00 | 2007-12-31 04:00:00 | 132 ... etc is this possible? Chris p.s. Happy new year!
  3. I wouldn't deal with new lines at all. strip them out and put your text in a div tag that has a set width. let the browser do the wrapping $maxChar = 10; $string = "hello world there is a lot more text then i want here"; $trailer = "..."; $newString = ereg_replace("\n","",$string); // strip new lines $newString = ereg_replace("<.*[bB][rR].*>","",$newString); // Strip Breaks // Aquire New String to display $dispString = substr($newString,0,$maxChar); // Append "..." suffix if nessisary. if(strlen($newString)>$maxChar))$dispString .= $trailer; echo $dispString; Alternatively, you could define your $trailer to be something like $trailer='<a href="http://www... etc..">';
  4. you should pre-type your command in a file, you can then execute your statement that way. If there is a problem, you simply just edit your file. ie: $> echo "SELECT * FROM mytable;" >cmd.sql Then from your command prompt: $> sql -u <username> -p < cmd.sql but to answer your question: you are correct in thinking there is no other way to recall the last information you typed.
  5. <?php; srand((double)microtime()*1000000); $numb=rand(0,100); if ($numb>=75) echo '<img src="bigwin.png" />'; elseif ($numb<=50) echo '<img src="bigloss.png" />'; else echo '<img src="dude.png" />'; ?>
  6. Basically at the end of the day i want to do this: SELECT (row1,row2,row3) AS mergedrows FROM table Then i was hoping to interate through your typical fetch look and only have to read the 'mergedrows' id. Is it possible to concatinate multiple rows into 1? Chris
  7. Your not using your variables properly... Since the form is set up as type post, you should be accessing the $_POST variable to get your information. $seller should become => $_POST['seller'] $step should become => $_POST['step'] etc... Try flipping your variable names around first and see if your still having problems.
  8. md5(date()); is pretty unique... or just date() for that matter. if you have some session variables loaded (such as the user id, or something of that nature) you can concatinate that with the date too to make the # even more unique... md5(date().$_SESSION['userid']);
  9. Just a quick question for the gurus. I have a url with information residing on http://www.hostnamea.com I have a pointer set up in apache to redirect all traffic to from http://www.hostnameb.com to http://hostnamea.com. My problem is $_SERVER['HTTP_REFERER'] is blank in all cases when people are being redirected from hostnameb.com. Is there a way I can track (using php) all people who used the hostnameb pointer? I googled without success, and I can't seem to find an alternative variable for what i'm looking for other than $_SERVER['HTTP_REFERER'] (ref site: http://ca.php.net/reserved.variables).
  10. Thanks, i'm going to keep that link just the same. I appreciate that.  I was thinking about formating my laptop and loading up Ubuntu.  But the only thing holding me back was a web-designing tool. Not to drag this thread any longer, but is there a Flash toolkit also (for linux) ?
  11. Hi, i haven't posted here for a while... Just a quick question: Like Dreamweaver is to Windows... is there a good toolkit for a linux environment for php/html/css/(etc) development that someone can recommend?
  12. This might work too: [code] SELECT t.id,t.name FROM table t WHERE name IN (SELECT t2.name FROM table t2 GROUP BY t2.name HAVING count(*) > 1) [/code]
  13. at home i wrote 2 small functions is_pageReSubmit($uniqueID) // returns true if user pressed refresh and false, if first time loading. and PageSubmit($uniqueID); // sets a flag unique to the page that is_pageReSubmit() uses. the code would look something like this: [code] if(is_pageReSubmit($uniqueID)){   // perform insert   // if insert is success then:   PageSubmit($uniqueID); }else{   echo "Data already sent"; } [/code] The unique code i use to make a page unique is simply a hidden entry in the form. I usually use md5(date()); Make sure this value is passed somehow into $_GET (preferably $_POST). It is what you pass in as $uniqueID and voila!, a page that only runs it's data once. PageSubmit() has to add the $uniqueID to a rolling array of say... size 20. is_pageReSubmit() needs to poll the array and only return false if the $uniqueID wasn't found.
  14. that is semi dangerous code too the way you have it set up.  anyone who continues to press refresh on that page will continue to generate inserts into the database.
  15. can't you just replace all the code in the middle with this? [code] if(ereg("^http://www.mydomain.co.uk$", $row['link_back_address'])){ echo "LINK OK"; }else{ echo "BAD LINK"; } [/code]
  16. also... the cronjob will execute using your username Make sure if you want to write in the /opt folder you do the cronjob -e as root. Otherwise pick a home directory to run your test in. such as "~/temp.log"
  17. probably unix time.. it's the amount of seconds between now and Jan-1980. You could try formating the time of your choice using mktime()
  18. [quote author=FunkyELF link=topic=111438.msg451648#msg451648 date=1160770643] [code]<?php     $tries = isset($_POST['tries'])?$_POST['tries']:0;     if(isset($_POST['okay'])){         $tries = $_POST['tries'] + 1;         $secret = 27;         if($_POST['guess'] < $secret){             echo "higher<br/>";         } else if($_POST['guess'] > $secret){             echo "lower<br/>";         } else {             echo "hooray ... got it in " . $tries . " tries<br/>";         }             } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">     <input type="text" name="guess" value="<?php echo @$_POST['guess']; ?>">Guess<br/>     <input type="hidden" name="tries" value="<?php echo $tries; ?>">Tries<br/>     <input type="submit" name="okay" value="SUBMIT ! ! !"><br/> </form>[/code] [/quote] i modified your code to do what you ask... :) try it out
  19. [quote author=businessman332211 link=topic=103411.msg413908#msg413908 date=1155307259] [quote]http://hitech.lead2gold.org/community/[/quote] also you could skin that page to look almost exactly like the rest of your site, that shouldn't take you too long either, just another suggestion. [/quote] Yea, well there is a green theme i can d/l from the site.  I haven't really touched the message board.. i just made some groups and left it at that. Making your own skin is easier said then done.  There are alot of images associated with the SMF board, they're all set to blue.  But to be honest, Im not to worried about the message board as it has no bearing on my sites functionality.  But thanks for the suggestion.
  20. Sorry guys, last time i'll bump this post. I fixed the CSS issue.  The problem was actually that "display: inline-block;" is not a CSS v2.0 standard but a v2.1 standard instead.  I changed my CSS validator link a bit and everything checks out ok! (w00t!). I also took on the suggestion of tabs and changed them to fit my light green theme. As for the comment about having an image in the header.  I totally love that idea... but i don't want to steal someone elses image, and the best thing i can draw is a crooked stickman  ;D Maybe in time I will get a logo up top though.  I won't throw that idea out. Thanks for everyones feedback.
  21. Having the hyperlinks underline is nice, but don't you think you should turn the underline feature off for menus and images.  Moving the mouse over the left menu bar causes some crazy vibration.  the same thign occurs when you mouse over the Graphic on the top of the page. Other then that it looks nice.
  22. Well, you only write /check a key on every submit. So if they are doing a database transaction. Then in each form, you store the last key in <input type="hidden" value=<?=$_SESSION['key']?> /> It doesn't matter how many windows anyone opens, because after the submit on 1 screen, the keys on all the other windows (will reference the old key) and will no longer be valid. Upon each submit, you willl refresh the $_SESSION['key'] value. After each submit, you must check $_POST['key'] to ensure that it is equal to $_SESSION['key'] Preform your sql, and change the $_SESSION['key'] The end result is someone who can have as many windows open as they want,  But they will only be able to sequentially preform 1 task after another.  the key acts as sort of a mutex/semaphore
  23. you could always stamp breadcrumbs in the session file. Each time a user does an action store an md5(time()+$key); Every action one takes, matches the current key and then the page is submitted.  On the submit the key is changed. In the event that the user ever had 2 windows open, his second window is uselsess now as it has a different key.  Anything submitted there won't be saved. you only preform the transaction if the keys match. On every match, the transaction is preformed and the key is changed.
  24. Thanks for your feedback, i fixed the right menus like both of you suggested. I'm not familiar with making tabs, although that does sound like a nice idea.  I guess i will google that and hope some nice examples pop up. As far as the CSS not validating.... Thats because the W3C marks display: inline-block; as invalid.  Yet i need that or it doesn't look right in IE. Oh well... i was told that if you know why your getting the errors, then it's not so bad. Chris
  25. If your preforming SQL inserts after someone completes a game, how could they cheat? Game data shouldn't be stored on the client end.  If your keeping your data on the server end, then it shouldn't matter how many windows they have open. [quote author=DarkReaper link=topic=103543.msg412408#msg412408 date=1155127819] Orio, cookies are shared. This means that if i change 1 cookie var, every window will read the new value on the next request. Rendering this method quite uneffective. I want to limit them to 1 window so i can prevent cheating in an online game. I want to identify each tab with unique id ... the problem is that i dont know how, nor if its possible ... :) The best thing that i've comed up with is to get the browser PID but ... i dont think this is implemented in php [/quote]
×
×
  • 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.