Jump to content

CBaZ

Members
  • Posts

    128
  • Joined

  • Last visited

Everything posted by CBaZ

  1. CBaZ

    users online

    something like this? if (permission== 1) { echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", "; } else { ". ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". "; }
  2. CBaZ

    users online

    i want it to count the 2 admin users seperately right now its throwing it all together. the regulars and the admins before i just had the regulars that was fine but i thought i could add the admins as well
  3. i have an issue with this $result2 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'"); $row = mysql_fetch_array($result2); $result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'"); $row2 = mysql_fetch_array($result3); echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". "; permission 0 are regular users permission 1 are admins. for some reason the regulars are ok but admins are not.. when one person logs in it will add 2 and when more sign in the number goes up for admin and regulars something is really screwy here any ideas?
  4. thanks .. i much appreciated this one. I possibly have another code in question my usersonline code i will post it for your viewing. $result2 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'"); $row = mysql_fetch_array($result2); $result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'"); $row2 = mysql_fetch_array($result3); echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". "; now the permission 0 comes out fine but the admins are not fine at all. i have 2 admins everytime i login as a user it adds admins as well and goes beyond the possible 2. i may have to give you more code then this let me know.
  5. ok the pull down menu has values .. it displays the username and the id the only place i do not get an id value is in the first line with the form ... you know where i have action="profile2.php?user_id=<?php echo $x[user_id]?>"> this one is not gettin the id value and if it gets it its always constant ... so one id works but not the selected one from the pulldown.
  6. i need the id number in that line profile2.php?user_id=<?php echo $x[user_id] so that when i click view it goes to the selected username's profile. maybe this can be done a different way
  7. <form name="profileview" method="post" action="profile2.php?user_id=<?php echo $x[user_id]?>"> <?php echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td>View:</td>\n"; echo "<td><select name=\"\">\n"; echo "<option value=\"\"></option>\n"; $sql = mysql_query("SELECT * FROM users WHERE user_id != '$user_id' ORDER BY username"); if (mysql_num_rows($sql) > 0) { while ($x = mysql_fetch_assoc($sql)) echo "<option value=\"\">$x[username], $x[user_id]</option>\n"; } echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td></td>\n"; echo "<input name=\"action\" type=\"hidden\" id=\"action\" value=\"View\">\n"; echo "<td><input type=\"submit\" name=\"submit\" value=\"View\" /></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</form></left>\n"; ?> <form name="profileview" method="post" action="profile2.php?user_id=<?php echo $x[user_id]?>"> in question here is this $x[user_id] i get no id in the action line but i do get username and id for the option value in script above. how is it that i can get this same id into the action line? anyone have any ideas?
  8. actually its either the first or 2nd row from my users table how do i make it select the right id with the right username
  9. <br> <?php $connect = mysql_connect("localhost", "user", "pw") or die("Could not connect to database: " . mysql_error()); mysql_select_db("db", $connect) or die("Could not select database"); $query = "SELECT * FROM users WHERE user_id != '$user_id' ORDER BY username"; $result = mysql_query($query, $connect) or die("QUERY FAILED: " . mysql_error()); $row = mysql_fetch_array($result,MYSQL_ASSOC); print "<left><form name=\"profileview\" action=\"profile2.php?user_id=$row[user_id]\" method=\"post\">\n"; echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td>View:</td>\n"; echo "<td><select name=\"profileview\">\n"; echo "<option value=\"\"></option></left>\n"; $sql = mysql_query("SELECT * FROM users WHERE user_id != '$_SESSION[id]' ORDER BY username"); if (mysql_num_rows($sql) > 0) { while ($x = mysql_fetch_assoc($sql)) echo "<option value=\"$x[user_id]\">$x[username]</option>\n"; } echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td></td>\n"; echo "<td><input type=\"submit\" name=\"profileview\" value=\"View\" /></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</form></left>\n"; ?> the question is that i can only get the current logged in user's id but i want it to be the user id matching the username that comes up from the pull down list. the usernames show up but the user id won't be displayed when i select a username from the pulldown
  10. *** = not sure what to place here yet. i get the read out of all my usernames via the id but i need maybe another row in my table to make this work. please help me <?php echo "</left><form name=\"profileview\" action=\"profile.php?user_id=***\" method=\"post\">\n"; echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td>View:</td>\n"; echo "<td><select name=\"profile\">\n"; echo "<option value=\"\"></option>\n"; $sql = mysql_query("SELECT * FROM users WHERE user_id != '$_SESSION[id]' ORDER BY username"); if (mysql_num_rows($sql) > 0) { while ($x = mysql_fetch_assoc($sql)) echo "<option value=\"$x[user_id]\">$x[username]</option>\n"; } echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td></td>\n"; echo "<td><input type=\"submit\" name=\"profileview\" value=\"View\" /></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</form></left>\n"; ?>
  11. that's just it .. this way has worked before but not anymore. I am not getting an error. the br is for when it writes the ip into the next line in the file.
  12. unfortunately doesn't write to the txt file it does however enter it into the hacklog
  13. $connect = mysql_connect("localhost", "username", "pw") or die("Could not connect to database: " . mysql_error()); mysql_select_db("database", $connect) or die("Could not select database"); $login = $_POST["txtLogin"]; $password = $_POST["txtPassword"]; $field = ""; if (is_numeric('$login')) { $field = "user_id"; } else { $field = "username"; } $query = sprintf ("SELECT * FROM users WHERE $field='$login' AND password='".md5($password)."'", mysql_real_escape_string($login), mysql_real_escape_string($password)); $result = mysql_query($query, $connect) or die("QUERY FAILED: " . mysql_error()); if (mysql_num_rows($result) == 0) { if(session_is_registered("LoginFailed")) { if($_SESSION['LoginFailed'] > 3) { $user_query = mysql_query("SELECT * FROM users WHERE username = '$login'") or die("QUERY FAILED: " . mysql_error()); $user = mysql_query($user_query); $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $password_cypt = md5($password); $date = date("YmdHis"); $IP = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); $handle = fopen("banip/banip.txt", "a+"); //echo "sql: ".$query."<br>"; //echo "Login Failed!"; $access_query = "INSERT INTO hacklog (date, username, hostname, ip_address, browser, refer, password) values ('$date', '$login', '$hostname', '$IP', '$browser', '$refer', '$password')" or die("QUERY FAILED: " . mysql_error()); $access = mysql_query($access_query) or die("QUERY FAILED: " . mysql_error());
  14. I have solved this one myself now so thanks for your help
  15. if i have the code like this <?php if (!$_SESSION[id].gif) { $pic = "$_SESSION[id].gif"; } else { $pic = "nopic.gif" } ?> it always shows the users photo even if it does not exist it attempts to show it. i don't understand why it doesnt check correctly it is uploaded and then goes to nopic.gif if none is there.
  16. <?php session_start(); include "config.php"; if (!isset($_SESSION['logged'])) { // not logged in header("Location: index.php"); } $username = $_SESSION['username']; $maxfilesize = 81920; // check if there was a file uploaded if (!is_uploaded_file($_FILES['userphoto']['tmp_name'])) { $error = "you didn't select a file to upload.<br />"; // if it was, go ahead with other checks } else { if ($_FILES['userphoto']['size'] > $maxfilesize) { $error = "your image file was too large.<br />"; unlink($_FILES['userphoto']['tmp_name']); } else { $ext = strrchr($_FILES['userphoto']['name'], "."); if ($ext != ".gif" AND $ext != ".jpg" AND $ext != ".jpeg" AND $ext != ".bmp" AND $ext != ".GIF" AND $ext != ".JPG" AND $ext != ".JPEG" AND $ext != ".BMP") { $error = "your file was an unacceptable type.<br />"; unlink($_FILES['userphoto']['tmp_name']); // if it's there, an okay size and type, copy to server and update the photo value in SQL } else { if ($_SESSION['photo'] != "profiles/photos/nopic.gif") { unlink("profiles/photos/".$_SESSION['photo']); } $newname = $_SESSION[id].$ext; move_uploaded_file($_FILES['userphoto']['tmp_name'],"profiles/photos/".$newname); mysql_query("UPDATE users SET photo='$newname' WHERE username='$username'") or die (mysql_error()); $_SESSION['photo'] = $newname; } } } ?> <html><head><title>Change Photo Result</title> <link rel="stylesheet" type="text/css" href="style.css"> </head><body> <h1>Change Photo Result</h1> <?php session_start(); include "config.php"; if (!isset($_SESSION['logged'])) { // not logged in header("Location: MaloriaN.php"); } ?> <?php if ($error) { echo "Your photo could not be changed because ".$error."."; } else { $id =<?echo $_SESSION['id']; ?> echo "Your photo was successfully uploaded. To view your updated profile, <a href=\"update.php?user_id=$id\">click here</a>."; } ?></body></html> this is what the uploader php looks like maybe this can be done better to make the if's work
  17. I have figured out the problem its that $pic = can only identify one time not multiple i'd have to use $pic2 = jpg pic3= bmp etc. that's why its not working
  18. yea it locates the folder due to my other script but it just doesn't look for the files weird.
  19. yea all are sensitive something even after uploading its still saying nopic.gif only
  20. now eventhough there is a pic there it only shows nopic.gif
  21. i get an unexpected $end error if (file_exists ("$_SESSION[id].gif")) { $pic = "$_SESSION[id].gif"; } else { if (file_exists ("$_SESSION[id].jpg")) { $pic = "$_SESSION[id].jpg"; } else { if (file_exists ("$_SESSION[id].bmp")) { $pic = "$_SESSION[id].bmp"; } else { $pic = "nopic.gif";
  22. how about for the extension of the pic $_SESSION[id] only gives the number like 90 but it doesn't include .jpg .gif .bmp etc
  23. I have a question. I have my photos displayed via $_SESSION[id] so I am trying to use <img src=$_SESSION[id] which is fine and all matches the name of the file but for extensions and multiple extension I am not sure how to script it so that it holds the extensions as well. also I need to have an if statement in place when the SESSION[id].gif jpg whatever does not exist I have a nopic.gif in place if there is no member chose photo yet.. can anyone please help? thanks.
  24. I still need help with this ... so far the way I have it ... when I login as admin it adds 2 users to the admins online and also 2 users to the regulars anyone have a clue as to what I need to change? and I am not sure how to get my usernames to show.
  25. I have a timestamp for regular users but no time stamp for admins let's see permission 0 is for regulars admin have permission 1 I am seeing the right totals for how many users are in that table just not the right amount currently logged in. <?php include("dbinfo.php"); // Set length of session to twenty minutes define("SESSION_LENGTH", 20); $sConn = @mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldnt connect to database"); $dbConn = @mysql_select_db($dbName, $sConn) or die("Couldnt select database $dbName"); $timeMax = time() - (60* SESSION_LENGTH); $result = mysql_query("select count(*) from usersOnline where unix_timestamp(dateAdded) >= '$timeMax'"); $usersOnline = mysql_result($result, 0, 0); $connect = mysql_connect("localhost", "user", "pw") or die("Could not connect to database: " . mysql_error()); mysql_select_db("db", $connect) or die("Could not select database"); $result2 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'"); $row = mysql_fetch_array($result2); $result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'"); $row2 = mysql_fetch_array($result3); echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". ";
×
×
  • 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.