Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. No the first index is articles then i am trying to access the next index inside of that .
  2. I have data stored in my database as such (this is only one table, one field in the whole db) array("left" => array("article_1" => array("id" => 1,"pos" => 2),"article_2" => array("id" => 2,"pos" => 1),"article_3" => array("id" => 3,"pos" => 3))) when i try and extract it doing <?php $newspaper = mysql_fetch_assoc($newspaper); ?> <h1>American Gangsters Newspaper - <?=Secure($newspaper['title'])?></h1> <table align="center" width="100%"> <tr> <td colspan="2" align="center" style="border-bottom:thin solid grey;"> <h2>Issue Number: <?=number_format($newspaper['id'])?>, Published <?=ConvertTimeToWords($newspaper['time'])?></h2> </td> </tr> <tr> <td colspan="2" align="left" style="border-bottom:thin solid grey;"> Editor <?=CreateUserLink($newspaper['editor_id']);?><br> Description:<br> <?=Secure($newspaper['desc'])?> </td> </tr> <?php $left = $newspaper['articles']['left']; $right = $newspaper['articles']['right']; ?> <tr> <td align="left" width="50%" style="border-right:thin solid grey;"> <?php print_r($newspaper['articles']); echo $left;?> <h3></h3> Article OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle One <hr> <h3>Article Title</h3> Article OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle OneArticle One </td> <td align="left" width="50%"> Article Two </td> </tr> <tr> <td colspan="2" align="left" style="border-top:thin solid grey;"> <h2>Adverts</h2> <?=Secure($newspaper['advert'])?> </td> </tr> </table> I get an unexpected result, the print_r($newspaper['articles']); prints the array as expected but echo $left; prints the letter a :s Same if i try print_r($left); Any ideas? Thanks, Blade
  3. $levels = array("mod","admin","owner"); if($logged['username'] && in_array($levels,$logged['level'])) { A shorter version
  4. The waiting is only apparent more so now as there is not as much to do as there will be when completed and when there is a more active community to interact with. The waiting will also help reduce cheating attempts and server load. And the chances are low to start off wtih (as in real life) and then increase when you have more expierence in that thing, e.g. crime chance of mugging someone starts at 0 and increases each time you attempt it. The odds are coding wise correct and work like they would in real life. If you have a suggestion for an alternative/improved system for crimes etc. i would love to hear it Thanks, Blade
  5. Yep the username: test password: tester The site is a browser based game, and yes the login page links do require some work but we have been working on the members pages at the moment.
  6. American Gangsters is back and better than ever, we have a new design (with a new designer continously working to improve it) and we have new and improved features. Please let me know what you think of the design (which is still work in progress) and what you think of the features (some are still unfinished). Any feedback is appriciated. http://www.americangangsters.org/ Please leave us any feedback here or on the site Thanks, Dean
  7. I am trying to ensure that a date is entered in this format (mm/yyyy) I am not good at regex, i tried this echo preg_match("/[^0-9]{2}+\/+[^0-9]{4}/", $string); But i don't think it works Any ideas? Thanks, Blade
  8. Hardly pointless, if no one said they don't understand then your never know, some response is better then none. if someone say you need to explain it better or even can you show us your calculation (as if it was on paper), them that means we can't work with what you have! as Ken2k7 says:~ Sure theirs a way to be sure, use what they have and check your doing the same! or at least getting the same results! If he asked me to explain it better i would of but starting a replie by saying i need to learn to communicate better and then telling me what to do "Stop starting you sentence with "So my problem..." and "The problem is..." us hardly going to get a respone praising him for his reply. And i anwsered daniel0's question about writing it down And yes i could do that but that would mean waiting until the college has been shown the system and then i have time to add all 18 units with all 10 - 12 criteria per unit, all i am asking is if the logic of the code seems sound or if it looks wrong. P.s. i didn't say there wasn't a way to be sure i said i have no way to be sure
  9. Stop starting you sentence with "So my problem..." and "The problem is..." if you don't specify what it is. The first one tells me what you're doing. It doesn't tell me the problem. The second one doesn't tell me what the problem is either. How would I know if your math is correct. :-\ It's like me asking you if this is correct - 5*5+3*4. Mathematically, it is an equation, but can you tell me if it's correct? Someone needs to learn what a help forum is, if you don't understand the question then don't anwser with your pointless post. And Daniel0, im not sure, i believe what i have is correct, but i have no way to be sure, logicaly is it correct?
  10. Counting the rows is so that the point system is based on the number of units ( number of rows ) And cell X9 is just a total of the points (so my $points variable)
  11. Hey long time no post So my problem, i am developing a grading system for my college and a function i wrote to work out the grade for the course is based on there current system but modified to be more flexible. The problem is is that i don't know if my maths is correct in it, and have no way to reliably test it. So, the function function WorkOutYearGrade($ProgID) { $ProgID = SecureVar($ProgID); $sql_check = mysql_query("SELECT * FROM student_grade WHERE program_id = '".$ProgID."' AND PSN = '".$_SESSION['PSN']."'"); if(mysql_num_rows($sql_check) != 0) { $sql = mysql_query("SELECT id FROM units WHERE program_id = '".$ProgID."'"); $distinction = 0; $merit = 0; $pass = 0; while($rows = mysql_fetch_assoc($sql)) { $grade = work_out_grade_average("program",$ProgID,$rows['id']); if($grade == "Pass") { $pass += (6 * mysql_num_rows($sql)); } elseif($grade == "Merit") { $merit += (12 * mysql_num_rows($sql)); } elseif($grade == "Distinction") { $distinction += (18 * mysql_num_rows($sql)); } } $points = round(($distinction) + ($merit) + ($pass)); $ExpPoints_d = 18 * mysql_num_rows($sql); $ExpPoints_m = 12 * mysql_num_rows($sql); $ExpPoints_p = 6 * mysql_num_rows($sql); $dist = $ExpPoints_d + $ExpPoints_m + $ExpPoints_p; $merit = $ExpPoints_m + $ExpPoints_p; $pass = $ExpPoints_p; if($points == 0) { return "<span style=\"color:red;\">R</span>"; } else { switch($points) { case $points >= $dist; return "DDD"; break; case $points >= $merit + (48 * mysql_num_rows($sql)); return "DDM"; break; case $points >= $merit + (24 * mysql_num_rows($sql)); return "DMM"; break; case $points >= $merit; return "MMM"; break; case $points >= $pass + (48 * mysql_num_rows($sql)); return "MMP"; break; case $points >= $pass + (24 * mysql_num_rows($sql)); return "MPP"; break; case $points >= $pass; return "PPP"; break; default; return "<span style=\"color:red;\">R</span>"; break; } } } } It is based on their point system which is: a pass = 6 a merit = 12 a distinction = 18 The point system the college was using is based on having 18 units where as mine is dynamic and based on how many units there are. Direct from their spreadsheet system: =IF(X9>=252,"DDD",IF(X9>=228,"DDM",IF(X9>=204,"DMM",IF(X9>=180,"MMM",IF(X9>=156,"MMP",IF(X9>=132,"MPP",IF(X9>=108,"PPP","R")))))))
  12. And a site consists of images, stylesheets and javascript XD And yes one way i tried to do what i wanted was to use ajax to load the page, as that way the page is loaded into the browser cache and displayed when i want
  13. Well i'm not the designer, and am trying to compensate for those with bad internet and also some pages (e.g. blackjack) which has lots of images (cards) which without preloading might not show in time for certain users (as the game can be quick) its just another way to optimise loading times, and i don't expect preloading the images to take that long
  14. I have half achieved this already, basically what i have it doing is when you log in it takes you to a loading page which will load all the main site images to improve loading time on the site.
  15. What my end plan is, is to be able to offer the user a way to preload most of the site before using the site, so they go to the preload page and it will load the sites images, and pages before display them. Is this possible?
  16. Is it possible to load a site (as in a page) into the browser cache. I want this so i can use ajax to load my site page then redirect the user there, like you can do with images. Any idea?
  17. Wow, daniel you might want to work on your idea of helping a bit
  18. Thanks, so as far as i can tell there are no security issues
  19. hmm ok, good good One last thing, unless there are more vulnerabilities will my function stop or cause a problem to my data, if used to sanitise queries function QuerySecure($query) { $query = strip_tags($query); $query = htmlspecialchars($query); $query = filter_var($query); $query = trim($query); $query = stripslashes($query); $query = mysql_real_escape_string($query); return $query; }
  20. I can't understand whats causing the 403 error though
  21. Ok, even using all of them the find user page still has vulnerabilitys Any ideas? Although they don't even do anything xD
  • 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.