Jump to content

Muncey

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by Muncey

  1. Thanks a lot! Will check out the link.
  2. Both lol, you use the info between the bbcode. For example... [bbcode]test[/bbcode] Then $a = "www.randomsite.com/ ".$x Where $x = the data between the bbcode.. in this case it would be test. After that you take $a and gather the information from the url. So you'd find "Title:" and get the information after that...
  3. Pull the data from another site. So when [album]____[/album] is put in the part inbetween the album brackets is taken and put into the url and then it takes the relevant data from the url. EG. [album]RandomName[/album] Would get data from www.albumsite.com/RandomName/ and it would then take the information from there.
  4. Hi, was planning on making a bbcode and i wanted to know how to get data from a site. For example a site displays information about albums. Link example: albumsite.com/albumname/ Each album has it's own page but all the pages are layed out the same... for example: Artist: Name here Album Title: Title here Year: Year here ect. How do i pull the data out of artist/album title ect depending on what is put inbetween the bbcode. [album]albumname[/album] Hope that makes sense, Thanks in advanace.
  5. Muncey

    Dates

    Im confused, what do i store the date as?
  6. Muncey

    Dates

    Well i made it so when somebody clicks a certain button it logs the date in a database then it pulls it out when needed and matches it to todays date and if it matches it displays Today, instead of the date. Im trying to do the same thing but for Yesterday, so i need to match the date in the database to the date of yesterday. How do i find the date then take away a day? Im using date('F d, Y'); btw... i need to take a day away but im not sure how. Thanks in advance.
  7. My bad, needed to add 30 on.
  8. No problem now, i used an array instead and it got it fine.
  9. Well im making a very basic forum system and i've got everything done and im just editing it making it gradually better. I have a topic table in the database with topic id and forum id (the id of the forum the topic is in). So i did a query "select forum id from topics where id = $_GET['id']" thats basically it... i echoed the result and got "Resource id #7" What does this mean? I thought it ment id = 7 but it's not, it's 2. I need the forum id it's in so i can match that id to the forum in the forums table so i can then retrieve the name of the forum and display it. Thanks in advance.
  10. Muncey

    Dates

    Unsure of what you mean, what exactly am i storing as a date type? Im inporting $date into the database under join_date... what do i need $date to equal in order to make the date display as something i can use for various things such as how many days been a member but also display join date as xx/xx/xx
  11. So is that how it's done on this site? If so that's enough for me to go ahead with it. The thing im making is very basic and will be improved, im just thinking of a way that will work but not cause too many problems for now.
  12. If i was to make a last active field in a members table in my database and had it update the field every page they went on, would this effect anything like speed? I was just thinking if say 100 people are using it at the same time and it's updating the database EVERYTIME someone clicks on a different part of the site, it may get a bit slow or something? Will this happen or is it fine to do this?
  13. Muncey

    Dates

    Basically im putting a join date into the database but i don't want it displayed as a date, i want it as pure numbers so that i can use it to work out things such as how long they've been a member, comments per day (by dividing the posts by how many days they've been a member) ect ect So whats the best way of putting that into the database? I have a vBulletin forum and looked in the database at what they had for the join date and i saw stuff like 112823... is that seconds or something? I also need to display the date as a real date xx/xx/xx so that must be possible aswell.
  14. Im having some trouble with my mysql query, basically im trying to add a integer to a field called "group". I tried: $group = 6; and adding $group to the field $group = "6"; and adding it to the field also tried group)VALUES('6' but again im getting a syntax error. Any help please? Im pretty sure my field is set to an int so that shouldn't be the problem.
  15. Never thought of that! Thanks a lot, i would also check for the -- which comments out the rest of the query.
  16. Sorry i didn't explain it very well. Im fully aware of what sql injection is, how to do it and how to prevent it. Im making a workshop type thing with like levels and one of the questions is give an example of a sql injection... when they input a correct sql injection i need to show one thing and show another if it's wrong.
  17. Basically im making a input in which i need someone to input an sql injection. I thought of just doing a simple if statement and say if their input is ' or 1=1 -- then it's right but they could also put ' or 2=2 -- and it's still right, or x' or 2=2 -- or hello' or 100000=100000 -- and they would be right yet i dont know how to test to see if the user input a successful sql injection line. I really need help with this, thanks.
  18. Thanks i thought ajax would probably be the way around it lol. Ill look into this.
  19. Would the clock stop and save the variable if the person suddenly closed the page or something though? cause they may spend an hour on one page then click off and the timer wouldn't save and jsut restart therefore not showing the true time the person was on there... (more explained in my previous post, i edited it)
  20. I'm terrible at javascript so this will give me a reason to brush up on it lol Thanks for the reply, i wasn't sure if it could be done in PHP or not.. i looked about and saw some reference to javascript. Edit: after some quick reading i realise that the timer will count up and obviously stop when they hit a button or something... so really all the person would need to do is find out the answer, hit refresh and put in the answer therefore completing the level within a few seconds. Do you know if it could update a number on the database every second that goes by... that way when they refresh they don't get rid of what they already done because it was stored in the database. I need to store the seconds without them doing anything. Is there a way of doing this?
  21. Basically im doing this kind of game thing where each member (who has registered and is in the database ect) goes onto a series of pages trying to figure out the answer to whatever. Basically i want to be able to calculate how long each person has taken on 1. each level and 2. altogether. Each level isn't a must, a must is basically an altogether total time for each member. I only want the time to increase on certain pages, the level pages. I'd probably like the time to be kept in the database too. In the database is a members table with a field labeled "level". Each time they complete a level the level goes up one in the database, this way the person can only access a further level if they have completed the previous. Im not asking someone to make me this, im asking for someone to point me in the direction of learning about this because as of yet i have no idea how to calculate time spent on certain pages. (For example on this forum.. Total time logged in: 3 hours and 9 minutes.) Thanks
  22. Well i've made a pretty damn good registration form (i think it's good for my 1st proper one anyway). Im not working on the login and a main page (which if your logged in will display one thing if not something else). Im really confused, i've wrote 150 lines amazingly and i don't have a clue what i've done lol Basically this is the code: <?php session_start(); include("db.php"); ////// Connect to database ////// mysql_pconnect($dbhost,$dbuser,$dbpass)or die('Error connecting to database'); mysql_select_db($dbname); if($logged_in != true){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>Login</h1> <form action="" method="post"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="username" maxlength="30"></td></tr> <tr><td>Password:</td><td><input type="password" name="password" maxlength="30"></td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember"> <font size="2">Remember me</td></tr> <tr><td colspan="2" align="right"><input type="submit" name="sublogin" value="Login"></td></tr> <tr><td colspan="2" align="left"><a href="register.php">Join</a></td></tr> </table> </form> </body> </html> <?php if(isset($_POST['sublogin'])){ if(!$_POST['username'] || !$_POST['password']){ die('You didn\'t fill in a required field.'); } $username = $_POST['username']; $password = $_POST['password']; $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $data = mysql_fetch_array($info); $salt = $data[salt]; $password = md5($password . $salt); if($data[password] != $password) { echo "Wrong password!"; }else{ /* Username and password correct, register session variables */ $_SESSION['user'] = $_POST['username']; $password = $_POST['password']; $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $data = mysql_fetch_array($info); $salt = $data[salt]; $password = md5($password . $salt); $_SESSION['password'] = $password; /** * This is the cool part: the user has requested that we remember that * he's logged in, so we set two cookies. One to hold his username, * and one to hold his md5 encrypted password. We set them both to * expire in 100 days. Now, next time he comes to our site, we will * log him in automatically. */ if(isset($_POST['remember'])){ setcookie("cookname", $_SESSION['user'], time()+60*60*24*100, "/"); setcookie("cookpass", $_SESSION['password'], time()+60*60*24*100, "/"); } /* Quick self-redirect to avoid resending data on refresh */ echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[php_SELF]\">"; return; } } } /* Sets the value of the logged_in variable, which can be used in your code */ $logged_in = checkLogin(); function checkLogin(){ /* Check if user has been remembered */ if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass'])){ $_SESSION['user'] = $_COOKIE['cookname']; $_SESSION['password'] = $_COOKIE['cookpass']; } /* Username and password have been set */ if(isset($_SESSION['user']) && isset($_SESSION['password'])){ /* Confirm that username and password are valid */ if(confirmUser($_SESSION['user'], $_SESSION['password']) != 0){ /* Variables are incorrect, user not logged in */ unset($_SESSION['user']); unset($_SESSION['password']); return false; }else{ $logged_in = true; return true; } } /* User not logged in */ else{ $logged_in = false; return false; } } function confirmUser($username, $password){ $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $data = mysql_fetch_array($info); if($data['password'] != $password) { return 1; }else{ return 0; } } ?> The loggedIn variable is messing me about, i think all the sessions work ok but when i refresh the loggedIn variable doesn't seem to equal true and it just messes up.
  23. Contacted my host about this they told me that i cannot edit the phpini file but the file is configured to allow php emails.. i cannot find any other reason why it's not sending and my host are complete ... you know what i mean. Also i have vBulletin which also sends validation emails and that works fine.. so is there another way i can do this? A fairly simple way would be nice lol.
  24. Thanks i've checked my spam and nothing. Also $to = $_POST['email']; which if was empty it wouldn't have got that far in the script because i make it check that $_POST['email'] isn't null and i do more tests on it too. I'll check the php.ini now... I checked the phpinfo and i got: sendmail_from no value sendmail_path no value I have no idea what to do or what this means lol.
×
×
  • 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.