Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. $result = mysql_query("UPDATE server1 SET count=count+1 WHERE ip='$ip'") or die(mysql_error());
  2. Add these lines at the top of your script: ini_set ("display_errors", "1"); error_reporting(E_ALL); Have you tried echoing anything out to make sure it's being submitted to the page?
  3. You should be able to use either walk or map to traverse through the multi-dimensional array and apply those functions. The only other way would be: $arr = array( array(" RedArrow", " Php")); foreach($arr as $key1 => $value1) { array_walk($value1, 'trim'); array_walk($value1, 'strip_tags'); } foreach($arr as $key1 => $value1) { foreach($value1 as $key2 => $value2) { echo $key2 . "=> " . strip_tags(trim($value2)) . " "; } }
  4. I assume it works? I think your problem was that you had: $add_new=mysql_query("INSERT INTO server1 (IP, count) VALUES ('$ip', '1')"); Which only held the resource id. If you echo $add_new in the ELSE block you would have gotten something like "Resource Id# 5" or something. I personally always like to put the query in a string so I can debug easily and then just call that string variable in the SQL execution. Oh, please marked as solved if so.
  5. Maq

    stopwatch

    gish, could you elaborate on what exactly you're trying to do? There may be an easier way to do this...
  6. I can't test anything right now so bear with me. I bet you have a lot of errors. I fixed up some of your script but I think it would be better to do sort of a trial and error for this. Try this and give me all of your errors... //if the login form is submitted if(isset($_POST['login'])) { // makes sure they filled it in if(!$_POST['username'] || !$_POST['pass']) { die('You did not fill in a required field.'); } $username = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string($_POST['pass']); $check = mysql_query("SELECT * FROM users WHERE username = '".$username."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database.'); } while($info = mysql_fetch_array( $check )) { $pass = md5(stripslashes($_POST['pass'])); $info['password'] = stripslashes($info['password']); //$_POST['pass'] = md5($_POST['pass']); THIS IS DONE IN THE ABOVE STATEMENT //gives error if the password is wrong if ($pass != $info['password']) { die('Incorrect password, please try again.'); } else // if login is ok then we add a cookie and send them to the correct page { $username = stripslashes($username); session_start(); $_SESSION['username'] = $username; $_SESSION['loggedin'] = time(); // Finds out the user type $query = "SELECT `admin` FROM `users` WHERE `username` = '" . $username . "'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $admin = $row['admin']; $_SESSION['admin'] = $admin; } } } else { // if they have not submitted the form ?> Backstage V1 Administration Console <br /> var page = document.cookie.match(/page=[\w][\w\-\.]+;/);<br /> if(page != null) {<br /> ajaxpage("page", "content");<br /> } else {<br /> ajaxpage("home", "content");<br /> }<br /> KOW Backstage Username: Password: } ?> Home | Logout | Forums Character Bio Allies Rivals Quotes Submit Roleplay News Match Seg Handler Directory Booking Champions Booker Compiler Archives Fed Admin Handlers Characters Applications Event Names Title Names Match Types Divisions Arenas Site Admin Templates Content Bio Configuration News Categories Menus Backstage 1 © 2009
  7. I get 5... What is going on om?! SQL Injection String Tests Summary (102340 results recorded) Failures: 5 Warnings: 0 Passes: 102335
  8. I added some debugging statements that you can take out, but try this: $ip=$_SERVER['REMOTE_ADDR']; $con=mysql_connect('*','*','*'); mysql_select_db('*'); $get=mysql_query("SELECT ip FROM server1 WHERE IP='$ip'"); $ip_exist=mysql_num_rows($get); $sql = "INSERT INTO server1 (IP, count) VALUES ('$ip', '1')"; if($ip_exist > 0){ echo "welcome again"; } else { mysql_query($sql) or die(mysql_error()); echo $sql; } ?>
  9. ok... so go try it out and come back with questions. This is easily possible with a little effort.
  10. First, this is irrelevant and, for the most part, false. Secondly, the only donations open source communities usually ask for is to keep the everything running. It's not like servers/support etc. are cheap.
  11. I assume Login Script is "backstage.php" And Control Panel is: ? You should submit the form to itself like: </pre> <form method="POST" action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>">< Does anything happen? Did you echo anything out to make sure they're the correct values? We kind of need some more information...
  12. *Will not maintain the correlation of the indices. sort($array, SORT_STRING)
  13. And what would lead you to believe that? Please shore so we can help
  14. Maq

    stopwatch

    Check this out.
  15. I see your point. Thanks for explaining. Negation overload, don't understand what this line means.
  16. Try it! I told you it is the same as yours except it's compressed into 1 line rather than 2.
  17. Ah yes, I see why. I was in this thread while I searched so I think it only searched this thread. :-\
  18. Never closed your ELSE statement. I remember posting this for you before... if($ip_exist > 0){ echo "welcome again"; } else { echo "new user"; } ?>
  19. Maq

    stopwatch

    You should use a client side language for this perhaps JS?
  20. If both conditions are true. If $_SESSION['admin'] is set and is It's the same as what you had but 1 IF rather than 2.
  21. I was talking about the company, not you. Why would they choose you over a proven open source forum? (not trying to be rude just curious)
  22. The only thread that comes up for, "smart quotes", is this one lol. Use Google and also check out this function along with the related ones.
  23. No... Browsers only display the rendered HTML. PHP lives only on the server. You have to post your code. Make sure you use code tags.
  24. For example shouldn't these if statements encapsulate the HTML you want to show? (BWT I rewrote your if statement) if(isset($_SESSION['admin']) && $_SESSION['admin'] Fed Admin </pre> <ul> Handlers Characters Applications Event Names Title Names Match Types Divisions Arenas </ul
  25. I mean the code... It would be kinda helpful...
×
×
  • 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.