Jump to content

lore_lanu

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by lore_lanu

  1. As an update, after messing around with the code, I still can't get it to work, which is odd considering I've done more complicated stuff on other directories on the same site. The code below works like it is supposed to: Options +FollowSymlinks RewriteEngine on RewriteRule ^(.+)/(.+)$ /users/account.php?mod=$2 [NC] But when I change it to this, it doesn't work.. .which makes absolutely no sense to me. Options +FollowSymlinks RewriteEngine on RewriteRule ^account/(.+)$ /users/account.php?mod=$1 [NC] I'm stumped as to why this is not working. Once again, any help is appreciated!
  2. If I understand correctly, couldn't you just move your <table> tag out of the while loop and make a row of table headers there? That way the headers won't repeat while the the results will be displayed underneath. It seems that you are creating a new table for each row of data. Also: This is assuming your data is outputting correctly... and you don't seem to be closing your <td> tags....
  3. I wasn't sure which forum to ask this in, so hopefully its okay to post it here... I'm having trouble with a simple .htaccess RewriteRule (below) Options +FollowSymlinks RewriteEngine on RewriteRule ^account/([^/]+)$ account.php?mod=$1 [NC] On account.php I check to see if $_GET['mod'] is set, and try to print out its contents, but it never seems to be set... even with a url like www.mysite.com/account/text (which is what I am going for) Could anyone tell me what I am doing wrong here? Any help is appreciated!
  4. EDIT: Never mind, I just updated to php 5. Hey all, I'm currently experimenting with php object interfaces. However, whenever I try to implement one, I get a php error. interface iTemplate { public function setVariable($name, $var); public function getHtml($template); } The error is: Parse error: parse error, unexpected T_STRING in /path/test.php on line 1 What am I doing wrong? If it matters, my server is running php version 4.3.11. Thanks in advance!
  5. Hey all! So, I am currently working on the backend of my site and I was wondering how I would be able to do something. I would like to enter a string (in this case, an IP address) into a form and have the form add deny from xxx.xxx.xxx.xxx to an htaccess file. (to ban the IP) And, to enter the address into a different form and have it search the .htaccess file and delete the line with the IP address entered. (to unban the IP) How could I accomplish this? I'm pretty sure this is possible to do, but is it the most efficient way to ban an IP Address? Would I better off, storing the banned addresses in a database and then deleting them from the mysql row? That seems a little less efficient to me. Thanks in advance for any help and/or advice!
  6. Oh my, that is very simple. I didn't expect it to be that easy. Thanks a ton for your help! I'll leave this unsolved for now until I can test it out, though.
  7. Thanks for your help so far. Could you tell me what functions I could use to compare the stored time and the current time? I'm a little confused on that part. I'm pretty new at this.
  8. I save the current time using now() in the datetime column expirelost. Is using a timestamp to store this kind of request better? I'm open to all suggestions. My question is, how can I check to see if the time is older than 30 minutes?
  9. Hello everyone! I am currently working on a reset password script, where, in the case of a lost password, a user can reset their password. (Duh.) In the script, the user is prompted to enter their username and email, and, if that combination exists, the users are given an email with a link such as http://www.mysite.com/lostpass?=9dfk32l5rhe894h. The hash at the end is generated randomly. When the email is sent, the hash is stored in a mysql database (column lostpass) and the time is stored in a datetime column (expirelost). When the user clicks the link, the hash is stored by the $_GET method and checked against the database. If it exists, the user gets a new password. I am having no problems with this part. However, I would like the link to expire after 30 minutes of the time stored in expirelost. I am thinking something like this: if(conditional that would allow date to be checked) { //your password has been reset } else { // error: link has expired } I have done many google searches, but nothing has worked. I think I have to use the DATE_SUB function? Not sure.. If anyone has any ideas or examples, please share them with me! Thanks in advance!
  10. To use sessions, you must have session_start; at the top of your page. Regardless of whether you are echoing or setting them.
  11. <?php session_start(); if($_SESSION['myusername'] != "Josh"){ header("location:http://justinledelson.com/includes/errors/unauthorized.php"); } ?> However, this script will have to be modified once you have many users, and you don't need to have an empty else statement taking up space.
  12. header("location:http://www.justinledelson.com/login/users/" . $myusername . ".php");//create a success page And it won't create the target page for you, if you don't write a code to make it/create one, you'll get a 404 error.
  13. the code actually has to be: $db = mysql_select_db('wowcms', $systemc); $sql = "SELECT value FROM wowcms_config WHERE setting = 'site_title'"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $site_title = $row["site_title"]; }
  14. Ag, I hate it when I do that. Thanks for the correction, Q.
  15. What exactly is happening when you run the script? If you are getting "http://www.justinledelson.com/login/users/$myusername.php" in your address bar, then php is not recgnizing the use of your variable. If it is going to a 404 page that means that you have not created a page for that user.
  16. What Bendude14 said is essentially correct. Try this, however: $sql = "SELECT value FROM (yourprefix)_config WHERE setting = 'site_title'"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $site_title = $row["site_name"]; } // You can now echo the variable echo "The site name is" . $site_title; You can then add more fields that you would like retrieved to the while loop.
  17. If you havent already, you should include this into your code: session_start(); $_SESSION['myusername'] = $myusername;
  18. take a look at this site: http://aidanlister.com/2004/04/making-time-periods-readable/
  19. I agree completely, but I think we are done anyways. Thanks a ton for your help! You rock! Topic Solved.
  20. I did a little testing and it seems that print $rooms[$_SESSION['pos']][$_GET['number']]; Outputs the right code but since that is the value of $_SESSION['pos'] the code foreach ($rooms[$_SESSION['pos']] as $K=>$roomid) { turns out equaling foreach ($rooms[$rooms[$_SESSION['pos']][$_GET['number']]] as $K=>$roomid) { Or something along those lines. I think that is causing problems..
  21. if(empty($_SESSION['pos'])) { $_SESSION['pos'] = 0; }else{ $_SESSION['pos'] = $rooms[$_SESSION['pos']][$_GET['number']]; } if(!isset($rooms[$_SESSION['pos']])) { echo "Room error!";//attempting to bypass rooms will cause this exit; } foreach ($rooms[$_SESSION['pos']] as $K=>$roomid) { //$roomid isn't used but its the room your going into //you may use this later !! echo "<a href=\"?number=$K\">$roomid</a><br>"; } Okay so that's what I have posted under my array. Anytime I click on one of the room ids, it should change to a different set of room ids, right? Whenever I do click, however, the url updates (ie ?number=1) but the numbers stay the same.
  22. Oh, sorry, about that. My code was actually was the one that was posted, I was just testing something. But, unfortunately, it still is'nt updating correctly...
  23. Okay, so I tried the code that you submitted. $rooms = array( 0 => array(1 => 30, 1, 29, 28, 31), 1 => array(1 => 3, 2, 7, 29, 0, 30), 2 => array(1 => 4, 5, 7, 1, 3), 3 => array(1 => 0, 0, 2, 1, 36), 4 => array(1 => 0, 0, 43, 5, 2), 5 => array(1 => 4, 43, 44, 0, 6, 2), 6 => array(1 => 5, 0, 7), 7 => array(1 => 2, 6, 0, 0, 8, 1), 8 => array(1 => 7, 9, 0, 14, 10, 29), 9 => array(1 => 8, 0, 0, 11, 13), 10 => array(1 => 29, 8, 14, 15), ... ); if(empty($_SESSION['position'])) { $_SESSION['position'] = 0; } else { $_SESSION['position'] = $rooms[$_SESSION['position']][$_GET['cavern']]; } foreach ($rooms[$position] as $key => $value) { echo "<a href='?cavern=" . $key . "'><img src='i/door.png' width='130px' height='170px'></a>"; } But it doesn't seem to be working correctly. When I try it, I'm not sure it changes rooms because there are always 5 doors. And I can't reach the end. I can't figure it out because the code looks like it should update $_SESSION['position'], but I don't think it is..
  24. lets say that I had this array. $room = array( 0 => array(1 => 30, 1, 29, 28, 31), 1 => array(1 => 3, 2, 7, 29, 0, 30), 2 => array(1 => 4, 5, 7, 1, 3), 3 => array(1 => 0, 0, 2, 1, 36), 4 => array(1 => 0, 0, 43, 5, 2), 5 => array(1 => 4, 43, 44, 0, 6, 2), 6 => array(1 => 5, 0, 7), 7 => array(1 => 2, 6, 0, 0, 8, 1), 8 => array(1 => 7, 9, 0, 14, 10, 29), 9 => array(1 => 8, 0, 0, 11, 13), 10 => array(1 => 29, 8, 14, 15), ); How could I get a foreach loop to print out the values of a certain index number? For example if $currentroom = 6 then the loop would be 5<br>0<br>7<br>. I'm wanting to use the $_POST method to send my results as the $_GET method would diplay results in the url. Also, how could I store the room numbers in a variable? (ie 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) I'm sorry this is taking so long!
  25. Okay, it makes sense. Thanks for the explanation! So I set up my arrays as you did in your last post (by the way I have 71 rooms...) But how would I set up my foreach loop? The loop would have to count how many doors in the room numbers array and I only know how to get it to display the index array.. Thanks!
×
×
  • 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.