Jump to content

DarkMantis

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DarkMantis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That's a very good analogy. Okay I think I understand now. Thanks again for the clarification! All the best!
  2. Try limiting the Query to 1 ie: $sql="SELECT k.*, u.* FROM korisnik k JOIN uloga u ON k.UlogaID = u.UlogaID WHERE KorisnickoIme = '".$ime."' AND Lozinka = '".$pasvord."' LIMIT 1"; this is from your login.php I don't think this will be a solution but it should prevent any unforseen errors
  3. Hi all, I have been coding in PHP for a fair while now and I have come across variables by reference, but I don't really know: a) how they work; b) when to use them; c) why they are used; Can anyone here please clarify these issues please. Thanks in advance!
  4. Thanks guys, Im using the DateTime::createFromFormat method. Thanks to the both of you though!
  5. Hi Guys, I have got a date string which looks like the following: I need to convert it to format. Any ideas on how to do this? Thanks!
  6. Omg, thank you. That was amazingly useful! Thanks for all your help, you have just taught me a lot. Thanks again!
  7. Hi Guys, I have recently come across the need to extract data from a database and generate a report (in the form of graphs, but that's not really the problem) to see the increase/decrease of registered users between Dates X and Y. I can get the information from the database, but I'm not sure how to sort all the users which registered per day. For example: I want to get all the data from 20-07-2011 to 25-07-2011 and then I need to find the users which registered on the 20th, 21st, 22nd, 23rd, 24th and 25th and put them into appropriate places (I'd assume arrays). Please bare in mind that all dates are stored in unixtimestamps and I'm not very good at timestamps. Any help would be great, my script is below, however, I know it's really badly written, it's only a test-run at the moment. Thanks again! <?php /** * @author DarkMantis * @copyright 2011 */ class GenerateReports{ /** * The constructor of the class */ public function __construct(){ } /** * Gets the RAW data from the database ready to be parsed. * * @param int $startDate * @param int $endDate * @param int $reportType * * @return array $arrOut */ public function getData( $startDate=null, $endDate=null, $reportType=0 ){ $this->ConnectToDb(); //Not a real function //Perform a few little checks to ensure data is passed to the function correctly if( ($startDate == NULL) && ($endDate == NULL) ){ $startDate = strtotime('2000-01-01'); $endDate = strtotime('now'); }else{ $startDate = strtotime($startDate); $endDate = strtotime($endDate); } //Get different report types and data switch($reportType){ case '1': //Get all results between given dates //for($i = 1; $i < 31; $i++){ unset($endDate); $endDate = ($startDate+($i*86400)); $sqlQuery = mysql_query(sprintf( 'SELECT `id`,`date_registration` FROM `crowdcube_users` WHERE `date_registration` > %d AND `date_registration` < %d', $startDate, $endDate )); // } while($arrResult = mysql_fetch_assoc($sqlQuery)){ print_r('<pre>' . var_dump($arrResult) . '</pre>'); if($startDate){ } } break; case 'default': break; } } } //See if the script works $new = new GenerateReports(); $new->getData('2011-07-24', 'now', 1); ?>
  8. I would personally suggest trying to do most of this using jQuery or simular. You could do: $.(document).ready(function(){ $.each("h2").html("Title 1", function(){ $(this).html("Replaced Text"); }); }); However, I'm not overly good with jQuery so you may want to edit that to make it work properly. Hope this helps. DarkMantis
  9. Hey, Both are string I've got that error sorted now it just continously loads without forwarding me to the second page.
  10. My table structure is as follows: ID (int 7) EmailAddress (varchar 255) Password (varchar 255) Thanks
  11. $sql = "SELECT * FROM `someTable` WHERE 1=1"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)){ echo '<table border="0">'; echo '<tr><td>'.$row['someColumn'].'</tr></td>'; } Something like that? Just a bit more indepth and accordingly with your Database and some CSS to sexeh it up
  12. It's not the fact that I want to use it neccessarily, I was just wondering as I've never seen it in PHP before. BUT, that is an awesome Idea, I think I will! Thanks!
  13. Hi all, Recently I've been doing some work with C++, and I've been learning about it's struct keyword. I've never come across it in PHP but I was just wondering whether there would be such a thing in it? ie: struct point{ int x; int y; } POINTS; Many Thanks!
  14. To be perfectly honest, you sound like your trying to do this as an attackers point of view. It seems like you know a system which does this and you are trying to trick it. However, to answer your question, yes you can spoof IP's, however, that's not to say you will receive any data back through that IP address as you are not that machine. Spoofing an IP would be just sending out Data from your machine and in the packet headers you would be IP XXX.XXX.XXX.XXX instead of YYY.YYY.YYY.YYY. You cannot receive the data back from the spoofee, as it were, unless you are on their network.
  15. Why not use templated HTML for the drop down lists, then you don't have to worry about re-writing them etc. And for everytime they get set, create a new drop down using the template and get the data from a mysql db, replace the templated tags with the data from the database and repeat. Here is a good example of a template class: http://www.phpro.org/classes/Template-Class.html Template: <select name="{tpl.SelectName}"> <option name="{tpl.Option"}>{tpl.OptionValue}</option> </select> ------------------------------ $this->tplSet('tpl.SelectName') = mysql_result(mysql_query("SELECT * FROM `someTable` WHERE 1=1")); $this->tplReplaceAll(); Then using Ajax/Javascript repeat it all and create a new drop down box using the results for the search query. Sorry if that doesn't make too much sense, It's early! lol. Hope this helped!
×
×
  • 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.