Jump to content
xisto Community

nol

Members
  • Content Count

    379
  • Joined

  • Last visited

6 Followers

About nol

  • Rank
    Super Member
  • Birthday 08/12/1990

Contact Methods

  • Website URL
    http://www.360evolved.net

Profile Information

  • Gender
    Male
  1. Wasn't there something like this, like a big thing about shutting down limewire because of the mass illegal mp3 and video downloading on it? But they allowed limewire because it still does serve a purpose of torrents that aren't legal (however I don't think there are too many uses for limewire really, besides the downloading of illegal mp3s)
  2. Alright so now all I need to do is just edit what was mentioned previously and see if it works? I'll have to test this one i get home later, but thank you very much for that ahead of time. I haven't even tested the user part, but the loading message keeps showing even though I see the shoutbox posts already?
  3. Should I post the whole php page's script? And should I take out the part on the javascript page and make it check on the php page not javascript? Also the whole script source is hosted on that website too, it isn't just the tutorial.
  4. So, I added that, and then it wouldn't let me try to test it because it would say that I needed to fill out all the fields, so on shoutbox.js I took out /***************************///@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro//@website: http://yensdesign.com///@email: yensamg@gmail.com//@license: Feel free to use it, but keep this credits please! /***************************/$(document).ready(function(){ //global vars var inputUser = $("#nick"); var inputMessage = $("#message"); var loading = $("#loading"); var messageList = $(".content > ul"); //functions function updateShoutbox(){ //just for the fade effect messageList.hide(); loading.fadeIn(); //send the post to shoutbox.php $.ajax({ type: "POST", url: "shoutbox.php", data: "action=update", complete: function(data){ loading.fadeOut(); messageList.html(data.responseText); messageList.fadeIn(2000); } }); } //check if all fields are filled function checkForm(){ if(inputUser.attr("value") && inputMessage.attr("value")) return true; else return false; } //Load for the first time the shoutbox data updateShoutbox(); //on submit event $("#form").submit(function(){ if(checkForm()){ var nick = inputUser.attr("value"); var message = inputMessage.attr("value"); //we deactivate submit button while sending $("#send").attr({ disabled:true, value:"Sending..." }); $("#send").blur(); //send the post to shoutbox.php $.ajax({ type: "POST", url: "shoutbox.php", data: "action=insert&nick=" + nick + "&message=" + message, complete: function(data){ messageList.html(data.responseText); updateShoutbox(); //reactivate the send button $("#send").attr({ disabled:false, value:"Shout it!" }); } }); } else alert("Please fill all fields!"); //we prevent the refresh of the page after submitting the form return false; });});
  5. As in the session starts and includes that the user must be logged in? I've got session starting, and I've got it so if the user is not logged in, it will redirect them to the login page, otherwise it shows the shoutbox. I'll try it I haven't added it in just yet though. So when I try and include my function.php I get which is my $query = sprintf("INSERT INTO shoutbox(user, message) VALUES('$_SESSION['username']', '%s');", mysql_real_escape_string(strip_tags($user)), line
  6. so in the line: function insertMessage($user, $message){ $query = sprintf("INSERT INTO shoutbox(user, message) VALUES('%s', '%s');", mysql_real_escape_string(strip_tags($user)), mysql_real_escape_string(strip_tags($message))); Should I add something like: $_SESSION['username'] Into where it says values of user (%s)? so it would look like: function insertMessage($user, $message){ $query = sprintf("INSERT INTO shoutbox(user, message) VALUES('$_SESSION['username']', '%s');", mysql_real_escape_string(strip_tags($user)), mysql_real_escape_string(strip_tags($message)));
  7. Here is the tutorial I am using: http://yensdesign.com/2009/01/create-a-shond-ajax-jquery/ I am just wondering how would I, instead of using a form for the username, where they type in their name could I have it where instead the server would automatically post the username they are logged in with into the database? I'm guessing this would be something like the way you would make a user integrated forum system, but I'm not too familiar with ajax nor can I find too many tutorials on the internet for it, so does anybody think they could tell me how I would go about this? So basically, instead of the user typing in their username, they just need to type in a message, and their username (from the current session) will be posted.
  8. Array( [PHPSESSID] => c9871b5bf1d74a136490d1a06c898c74 [openpoli_wiki_openpoli__session] => ed8da09f52b5e426b0d9f8652ea09760) ? oh and then I tried logging in, Array( [SMFCookie683] => a:4:{i:0;s:1:\"1\";i:1;s:40:\"3bcb588b7556304359a762ce248c69c3c8d1ed83\";i:2;i:1434077628;i:3;i:0;} [PHPSESSID] => 9837d5f6f0d3c2566b50d11496f619da) idk exactly what we are looking for?
  9. well it might be something with my coding of my index page, wher ei coded it to show the login box if your set to anonymous (as in not logged in), and to say hi if you are logged in, but it won't show hi and always shows the login box so im guessing it is to do with the cookies? or am i guessing wrong?
  10. openpolitiks.com is my domain though? or should it be .localhost.openpolitiks?
  11. Theres a script I am using, that deals with users sessions and cookies. I'm having a problem with this portion of the code because I don't have any clue on what to put. # The name of the cookie that contains the user's information# Note: Due to a bug in PHP, COOKIE_DOMAIN must contain at least two decimals $USER_COOKIE = "u_info";$COOKIE_DOMAIN = ".localhost.openpolitiks.com"; # $SERVER_NAME;$COOKIE_PATH = "/"; I left the $USER_COOKIE part alone, but I changed the $COOKIE_DOMAIN (don't remember what they had but it didn't work), so what should it be? as it doesn't seem to hold user stuff? here is the full script: http://www.majordojo.com/php-users/
  12. i tried that before, and it wouldn't put anything else into the database before then. Tried it in multiple places, still get the unexpected T_STRING, it's something to do with that new line of code because it keeps giving me unexpected T_STRING in same spot, but if i take it away, it's fine (but it doesn't add to mysql databse )edit: Oh alright I didn't see your post before truefusion, I tried what I think you meant? I checked the code blocks, I only saw 1 other switch, but I did see what you mean as me having a switch within a switch, so this is what I did: <?// confirm.php$mode = $_POST['mode']; // Make sure a mode is specified. if ($mode == "") { print("No mode specified. Please contact the webmaster to have this problem fixed."); die(); }require("vars.php"); // Get mysql info.mysql_connect($host, $user, $pass) or die("MySQL connection error.");mysql_select_db($db) or die("No such database."); // Connect to the right database switch ($mode) { case "register"; // First, check to make sure that all the data is filled in. $username = $_POST['username']; // Min 4, Max 16 $password = $_POST['password']; // Min 4, Max 10 $cpassword = $_POST['cpassword']; // Min 4, Max 10 $email = $_POST['email']; // Min 4, Max 40 if ($username == "") { header("Location: register.php?error=1&email=$email"); die(); } if ($password == "") { header("Location: register.php?error=2&email=$email&username=$username"); die(); } if ($cpassword == "") { header("Location: register.php?error=3&email=$email&username=$username"); die(); } if ($email == "") { header("Location: register.php?error=4&username=$username"); die(); } // Check to see if the passwords match if ($password != $cpassword) { header("Location: register.php?error=5&username=$username&email=$email"); die(); } // Now check the minimum lengths // Check the maximum lengths if (strlen($username) > 15) { header("Location: register.php?error=9&username=$username&email=$email"); die(); } if (strlen($password) > 50) { header("Location: register.php?error=10&username=$username&email=$email"); die(); } if (strlen($email) > 40) { header("Location: register.php?error=11&username=$username&email=$email"); die(); } // Now check to make sure that we don't have the same username. $temp = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)) FROM users WHERE username='$temp'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); } // Check for duplicate email addresses. $temp = strtolower($email); $query = mysql_query("SELECT COUNT(LOWER(email)) FROM users where email='$email'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); } // We have completed all the checks. // MD5 the password. $password = md5($password); // Insert the data into the user page. mysql_query("INSERT INTO users (username, password, email) VALUES ('$username','$password','$email)"); mysql_query("INSERT INTO other (current,possible) VALUES ($current,$energypossible)"); mysql_query("INSERT INTO item2 (current,bank23) VALUES ('$current2','$bank23')"); // Redirect to login page }if ( isSet($_POST['submit']) ){echo '<pre>';print_r($_POST);echo '</pre>';{switch( strToLower($_POST['class']) ){ case "1":$result = mysql_query("UPDATE users SET field1='10,field3='12' where id=$id");break;case "2":$result = mysql_query("UPDATE users SET field1='3,field3='10'where id=$id");break;case "3":$result = mysql_query("UPDATE users SET field1='6,field3='14' where id=$id");break;case "4":$result = mysql_query("UPDATE users SET field1='2,field3='8' where id=$id");break;case "5":$result = mysql_query("UPDATE users SET field1='9,field3='12' where id=$id");break;case "6":$result = mysql_query("UPDATE users SET field1='5,field3='10' where id=$id");}} switch ($mode) { case "login": // Get user data $username = $_POST['username']; $password = $_POST['password']; if ($username == "") { header("Location: main.php?error=1"); die(); } if ($password == "") { header("Location: main.php?error=2"); die(); } // MD5 the password. Lower the username $password = md5($password); $username1 = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)), id FROM users where username='$username' GROUP BY username"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 1) { header("Location: main.php?error=3"); die(); } $query = mysql_query("select password from users where id=$result[1]"); $id1 = $result[1]; $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] == $password) { session_start(); $_SESSION['id'] = $id1; // Get the actual user name $query = mysql_query("SELECT username FROM users where id=$id1"); $result = mysql_fetch_array($query, MYSQL_NUM); $username = $result[0]; $_SESSION['username'] = $username; $_SESSION['password'] = $password; // Check to see if they want to be logged in for a week. $week = $_POST['week']; if ($week == "yes") { // add the cookie data // find out the time a week from now $time = time(); $time1 = 7 * 24; $time1 = $time1 * 60 *60; $time = $time + $time1; setcookie("username", $username, $time,"/"); setcookie("password", $password, $time,"/"); setcookie("id", $id1,$time,"/"); setcookie("signedin","true",$time,"/"); } header("Location: home.php"); die(); } else { header("Location: main.php?error=3"); } } still same thing is happening, and I think at least that I ended the switches where I'm supposed to? The thing is this script is my login/register processes script, so that is why I have the mode switch at the top. Should I just take out those switches and just make a seperate login and register script?
  13. i did that, and it still doesn't seem to do much good. doesn't display anything on the process.php page or anything, and the database still acts same way. <?// confirm.php$mode = $_POST['mode']; // Make sure a mode is specified. if ($mode == "") { print("No mode specified. Please contact the webmaster to have this problem fixed."); die(); }require("vars.php"); // Get mysql info.mysql_connect($host, $user, $pass) or die("MySQL connection error.");mysql_select_db($db) or die("No such database."); // Connect to the right database switch ($mode) { case "register"; // First, check to make sure that all the data is filled in. $username = $_POST['username']; // Min 4, Max 16 $password = $_POST['password']; // Min 4, Max 10 $cpassword = $_POST['cpassword']; // Min 4, Max 10 $email = $_POST['email']; // Min 4, Max 40 if ($username == "") { header("Location: register.php?error=1&email=$email"); die(); } if ($password == "") { header("Location: register.php?error=2&email=$email&username=$username"); die(); } if ($cpassword == "") { header("Location: register.php?error=3&email=$email&username=$username"); die(); } if ($email == "") { header("Location: register.php?error=4&username=$username"); die(); } // Check to see if the passwords match if ($password != $cpassword) { header("Location: register.php?error=5&username=$username&email=$email"); die(); } // Now check the minimum lengths // Check the maximum lengths if (strlen($username) > 15) { header("Location: register.php?error=9&username=$username&email=$email"); die(); } if (strlen($password) > 50) { header("Location: register.php?error=10&username=$username&email=$email"); die(); } if (strlen($email) > 40) { header("Location: register.php?error=11&username=$username&email=$email"); die(); } // Now check to make sure that we don't have the same username. $temp = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)) FROM users WHERE username='$temp'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); } // Check for duplicate email addresses. $temp = strtolower($email); $query = mysql_query("SELECT COUNT(LOWER(email)) FROM users where email='$email'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); } // We have completed all the checks. // MD5 the password. $password = md5($password); mysql_query("INSERT INTO users (username, password, email) VALUES ('$username','$password','$email)"); mysql_query("INSERT INTO other (current,possible) VALUES ($current,$energypossible)"); mysql_query("INSERT INTO item2 (current,bank23) VALUES ('$current2','$bank23')");if ( isSet($_POST['submit']) ){echo '<pre>';print_r($_POST);echo '</pre>';{ switch( strToLower($_POST['class']) ) { case "1": $result = mysql_query("UPDATE users SET field1='10,field3='12'");break; case "2": $result = mysql_query("UPDATE users SET field1='3,field3='10'");break; case "3": $result = mysql_query("UPDATE users SET field1='6,field3='14'");break; case "4": $result = mysql_query("UPDATE users SET field1='2,field3='8'");break; case "5": $result = mysql_query("UPDATE users SET field1='9,field3='12'");break; case "6": $result = mysql_query("UPDATE users SET field1='5,field3='10'"); break;}break; }}} break; case "login": // Get user data $username = $_POST['username']; $password = $_POST['password']; if ($username == "") { header("Location: main.php?error=1"); die(); } if ($password == "") { header("Location: main.php?error=2"); die(); } // MD5 the password. Lower the username $password = md5($password); $username1 = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)), id FROM users where username='$username' GROUP BY username"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 1) { header("Location: main.php?error=3"); die(); } $query = mysql_query("select password from users where id=$result[1]"); $id1 = $result[1]; $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] == $password) { session_start(); $_SESSION['id'] = $id1; // Get the actual user name $query = mysql_query("SELECT username FROM users where id=$id1"); $result = mysql_fetch_array($query, MYSQL_NUM); $username = $result[0]; $_SESSION['username'] = $username; $_SESSION['password'] = $password; // Check to see if they want to be logged in for a week. $week = $_POST['week']; if ($week == "yes") { // add the cookie data // find out the time a week from now $time = time(); $time1 = 7 * 24; $time1 = $time1 * 60 *60; $time = $time + $time1; setcookie("username", $username, $time,"/"); setcookie("password", $password, $time,"/"); setcookie("id", $id1,$time,"/"); setcookie("signedin","true",$time,"/"); } header("Location: home.php"); die(); } else { header("Location: main.php?error=3"); die(); } break; } is what i have now if that makes a difference, and the case "login" part is considered an unexpected T_STRING? it wasn't before?
  14. I did have a few errors with my script itself before, but they were just headers being sent twice, and I fixed it, so I'm thinking that it is fine. Here is what I am experiencing:Basically, the user is trying to register, so he enters username, password, and a confirm password, and email, and then picks a class. Depending on the class it changes other fields, which otherwise are being automatically set as '1' when created. I think when I do that I'm having the problem. The database connection is fine, I get no errors. I see all the information in the databases, such as username, password (in md5 hash), and email, and all the other fields set as 1. So I don't exactly know what that means, as to what is going on anyways. Here is exactly the script I'm working with.this is script.php (its actually called process.php on my webhost, but i called it script.php because thats what i called it above) <?// confirm.php$mode = $_POST['mode']; // Make sure a mode is specified. if ($mode == "") { print("No mode specified. Please contact the webmaster to have this problem fixed."); die(); }require("vars.php"); // Get mysql info.mysql_connect($host, $user, $pass) or die("MySQL connection error.");mysql_select_db($db) or die("No such database."); // Connect to the right database switch ($mode) { case "register"; // First, check to make sure that all the data is filled in. $username = $_POST['username']; // Min 4, Max 16 $password = $_POST['password']; // Min 4, Max 10 $cpassword = $_POST['cpassword']; // Min 4, Max 10 $email = $_POST['email']; // Min 4, Max 40 if ($username == "") { header("Location: register.php?error=1&email=$email"); die(); } if ($password == "") { header("Location: register.php?error=2&email=$email&username=$username"); die(); } if ($cpassword == "") { header("Location: register.php?error=3&email=$email&username=$username"); die(); } if ($email == "") { header("Location: register.php?error=4&username=$username"); die(); } // Check to see if the passwords match if ($password != $cpassword) { header("Location: register.php?error=5&username=$username&email=$email"); die(); } // Now check the minimum lengths // Check the maximum lengths if (strlen($username) > 15) { header("Location: register.php?error=9&username=$username&email=$email"); die(); } if (strlen($password) > 50) { header("Location: register.php?error=10&username=$username&email=$email"); die(); } if (strlen($email) > 40) { header("Location: register.php?error=11&username=$username&email=$email"); die(); } // Now check to make sure that we don't have the same username. $temp = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)) FROM users WHERE username='$temp'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); } // Check for duplicate email addresses. $temp = strtolower($email); $query = mysql_query("SELECT COUNT(LOWER(email)) FROM users where email='$email'"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 0) { die(); }if ( isSet($_POST['submit']) ){ switch( strToLower($_POST['class']) ){case "1": $result = mysql_query("UPDATE users SET field1='10,field3='10'");}break; default: }} break; case "login": // Get user data $username = $_POST['username']; $password = $_POST['password']; if ($username == "") { header("Location: main.php?error=1"); die(); } if ($password == "") { header("Location: main.php?error=2"); die(); } // MD5 the password. Lower the username $password = md5($password); $username1 = strtolower($username); $query = mysql_query("SELECT COUNT(LOWER(username)), id FROM users where username='$username' GROUP BY username"); $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] != 1) { header("Location: main.php?error=3"); die(); } $query = mysql_query("select password from users where id=$result[1]"); $id1 = $result[1]; $result = mysql_fetch_array($query, MYSQL_NUM); if ($result[0] == $password) { session_start(); $_SESSION['id'] = $id1; // Get the actual user name $query = mysql_query("SELECT username FROM users where id=$id1"); $result = mysql_fetch_array($query, MYSQL_NUM); $username = $result[0]; $_SESSION['username'] = $username; $_SESSION['password'] = $password; // Check to see if they want to be logged in for a week. $week = $_POST['week']; if ($week == "yes") { // add the cookie data // find out the time a week from now $time = time(); $time1 = 7 * 24; $time1 = $time1 * 60 *60; $time = $time + $time1; setcookie("username", $username, $time,"/"); setcookie("password", $password, $time,"/"); setcookie("id", $id1,$time,"/"); setcookie("signedin","true",$time,"/"); } header("Location: index.php"); die(); } else { header("Location: main.php?error=3"); die(); } break; }?> I only added one case to test out, so ya...here is the actual form page: <html><head><title>Register</title></head><body><?require("function.php");$error = mysqlconnect(); if ($error === FALSE) { die("Error connecting to MySQL."); }if (isset($_GET['error'])) {print("<b><font color=Red>"); switch ($_GET['error']) { case 1: print("You forgot to enter your username."); break; case 2: print("You forgot to enter your password."); break; case 3: print("You forgot to confirm your password."); break; case 4: print("You forgot to enter your e-mail."); break; case 5: print("Your passwords do not match."); break; case 6: print("Your password must be greater than 4 characters long."); break; case 7: print("Your username must be greater than 4 characters long."); break; case 8: print("Your e-mail must be greater than 4 characters long."); break; case 9: print("Your username may not be more than 15 characters long."); break; case 10: print("Your password may not be more than 50 characters long."); break; case 11: print("Your e-mail cannot be longer than 40 characters."); break; case 12: print("The username, $username, is already in use."); break; case 13: print("The email, $email, is already in use."); break; default: print("Error information not understood. Please contact the webmaster."); break; } print("</font><br><hr>"); }?><form action='process.php' method='post'><input type='hidden' name='mode' value='register'>Username: <input type='text' name='username' size=16 maxlength=15 value='<? print $_GET['username']; ?>'><br>Password: <input type='password' name='password' size=10 maxlength=50><br>Confirm Password: <input type='password' name='cpassword' size=10 maxlength=50><br>E-mail: <input type='text' name='email' size=40 maxlength=40 value='<? print $_GET['email']; ?>'><br><input type="radio" name="class" value="A" selected="selected" /> A<br /><input type="radio" name="class" value="B" /> B<br /><input tupe="submit" name="submit" /><!-- Blahhhh--></form> (again I only have 2 radio form on there and will add more to it later)So do you think you know what could be wrong? I hope I explained what's going on well enough. Should I make class and the other fields in it's own table? Or is it fine in the table of users? Notice from truefusion: For big code, please use CODEBOX instead of CODE
  15. well the way i was previously thinking is this: only problem is idk if that'll work? Edit: Ya it doesn't work, any idea why? registration form still works, it just won't update the information I want it to, infact it doesn't update anything at all
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.