Jump to content

acctman

Members
  • Posts

    582
  • Joined

  • Last visited

Everything posted by acctman

  1. if the user are login in you can have field in the member table ban_del... then when the user logs in check to see if the ban_del field has a 1 (yes) if so then redirect the user to a ban page and you can re-log there IP so if they attempt to create another account you can flag it. Another security measure you could use is to set a cookie so if there IP changes the cookie would know that they're banned. I use all 3 of those methods which stop 99% of banned users for my site from attempting to create another account. An experienced user can easily get around those methods but I just have a community site and I doubt anyone would waste there time trying to get back on my site.
  2. so it would always be good to use the "/" to start at the root just to make sure where ever the script is processed it the folder is created in the right area. thanks for the info
  3. is mkdir("/home/site/public_html/rimgs/"); the same as mkdir("/rimgs/"); also would I ever run into a situation where the complete path would be needed over a shorten...
  4. why am i getting this error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%Bergen%' at line 1 UPDATE rate_members SET m_state = replace(m_state,"Fl","FL") WHERE m_city LIKE %Bergen%
  5. Hi is there a better way to manage user sessions and keep users logged in? The code below is what i'm currently using, and it logs each user into into a table and then every 30mins it checks to see if the user session has expired if yes the entire is removed and they're logged out. But if the user has changed pages within 60secs it updates the session info in the database and resets there time. Can this be optimized in anyway? should i increase te update to prevent timeout for 60sec to like 3-5mins, or do I want to remove the user from the db as soon as possible. <?php // Set Session Parameters session_cache_limiter('must-revalidate'); session_start(); // Declare Headers header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // Check to see if we have a session for this user $LoadSession=mysql_query("SELECT rmo.* FROM rate_members_online AS rmo LEFT JOIN rate_members AS rm ON rmo.o_id=rm.m_id WHERE rmo.o_session_id='".session_id()."' AND rmo.o_ip='".$ip."'"); $Result=mysql_fetch_assoc($LoadSession); // Check the Result if (mysql_num_rows($LoadSession)==0){ // User has no session, create one mysql_query("INSERT INTO rate_members_online (o_id,o_start,o_last,o_session_id,o_ip) VALUES (".(int)$_SESSION['userid'].", ".time().",".time().",'".session_id()."','".$ip."')"); } else { // User has a session, perform checks if ($Result['o_id']!=$_SESSION['userid']){ // User has logged in or out, update session mysql_query("UPDATE rate_members_online SET o_id='".$_SESSION['userid']."' WHERE o_session_id='".session_id()."' AND o_ip='".$ip."'"); } if ($Result['o_last']<time()-60){ // User has changed pages within the last 60 seconds, update to prevent timeout mysql_query("UPDATE rate_members_online SET o_last='".time()."' WHERE o_session_id='".session_id()."' AND o_ip='".$ip."'"); } } // Delete session records, only run this every 30 minutes if (date("i")=="30"){ mysql_query("DELETE FROM rate_members_online WHERE o_last<".(time()-memb_timeout)); } ?>
  6. how can i make the echo all results at the bottom to a textfile and have it rewrite the text file each time i run the script. $sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.username FROM '. FORUMS_TABLE .' f,'.TOPICS_TABLE.' t, '.POSTS_TABLE.' p,'.USERS_TABLE.' u WHERE t.forum_id = f.forum_id AND t.topic_status != 1 AND u.user_id = p.poster_id' . $forum_sql . $topic_sql . (empty($topic_sql) ? ' AND p.post_id = t.topic_last_post_id ' : '') . ' ORDER BY ' . (empty($topic_sql) ? 't.topic_last_post_time DESC' : 'p.post_time DESC') . ' LIMIT 0,' . $topic_limit; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}"; $count = count(@explode($$row['post_subject']," ")); $count = strlen($row['post_subject']) - ( $count - 1 ); $subject = strlen($row['post_subject']) > 30? substr($row['post_subject'],0,27)."...": $row['post_subject']; $count1 = count(@explode($en['m_user']," ")); $count1 = strlen($row['username']) - ( $count - 1 ); $row['username'] = strlen($row['username']) > 12? substr($row['username'],0,9)."...": $row['username']; echo '<div style="padding-bottom:5px;"><a target="_parent" title="'.$row['post_subject'].'" href="' . $url . '">' . $subject . '</a> - ' . $row['username'] . ' : ' . date("D m/d/y, h:ia",$row['post_time']) . ' </div>'; }
  7. when i do a file include that has Global vars set, it affects the entire page
  8. Is it possible to exit out of all global variables after a script has processed.
  9. another methods I could try? my only option here is to possibly use an iframe (which i'm trying to avoid) and not an include... since the fill is a template and can except both HTML and PHP coding
  10. no luck i tried this code middle of page <?php echo $string; ?> bottom <?php $string = get_include_contents('forums/newest_posts.php'); function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; } ?>
  11. i need to include a php at the bottom of my template but I need for the output to appear in the middle of that page. The reason for this is because the include file uses Global variables that affect any sql coding that is loaded after it. this is what i've been trying but no luck middle of page <?php foo(); ?> bottom of page <?php function foo() { include('forums/newest_posts.php'); } ?>
  12. nothing was returned, no error.
  13. oh sorry i thought i did, i want to connect to countries.php and grab the country name. $en['mm_country'] holds the $key abbervation of the country. so if AF is supplied then when I echo $country the return value should be Afghanistan. also when grabbing the country name htmlentities needs to be used to strip the quotes $countries['US'] = array(name => 'United States'); $countries['AF'] = array(name => 'Afghanistan');
  14. when i do that the result is just Array. the code needs to be something like this, but i'm not sure how to code it correctly. if ($en['mm_country'] != US) || ($en['mm_country'] != CA) { global $countries; include 'modules/members/countries.php'; $key = $en['mm_country']; $country = $countries(htmlentities($key['name'],ENT_QUOTES)); echo $country; }
  15. this is already formated in a file, and works fine without the quotes when used elsewhere on the site.
  16. no not doing a foreach just need to grab the country name for $key
  17. can someone assist me with the code below? Unexpected T_as error the countries.php file $countries['US'] = array(name => 'United States'); $countries['AF'] = array(name => 'Afghanistan'); code.. if ($en['mm_country'] != US || CA) { global $countries; include 'modules/members/countries.php'; $countries as $key => $value; $key = $en['mm_country']; $en['mm_coname'] = htmlentities($value['name'],ENT_QUOTES); echo $en['mm_coname']; }
  18. the parser file wasn't written by me, but from what I'm assuming its being used to make sure any php code written into the .tpl files stay valid. I'm pretty sure I wrote a piece of php code and left out a closing bracket or semicolon. but since its parse the files its hard to know which tpl is giving the error. is there any piece of debug coding i can put into a header file that would output any error codes to a text file? i'm not sure if that would even work though since the errorlog is just giving me the parsed error
  19. line 315 is return $value; (second to last line at the botton) i posted the function before it as well function template_array($s) { global $names, $profs, $ifcn, $if, $iflev, $en, $s, $elsif, $beenelsif, $loops, $loopstart, $loopentry, $loopends, $looparray, $t_id, $curr_tpl, $templ, $tpi; extract($names); $incl = substr($s,strlen('<!--[Array ')); $arr = substr($incl,0,strpos($incl,' ')); $incl = substr($incl,strlen($arr)+1); $incl = substr($incl,0,strpos($incl,']-->')); eval('$query = "'.$incl.'";'); $result = sql_query($query); $temparray = array(); $npk = 0; while ($line = sql_fetch_assoc($result)) $temparray[++$npk] = $line; if (substr($arr,0,1) == '>') $arr = substr($arr,1); $arr = str_replace(chr(92),'',$arr); if (!$temparray[1]) $temparray[1] = array(); eval($arr.' = array_merge('.$arr.',$temparray[1]);'); return ''; } function do_format($value) { global $s, $en; $value = (isset($en[$value]) ? $en[$value] : @constant($value)); $i = strtolower($s); if (strpos($i,'echo') || strpos($i,'define')) { $value = str_replace('"','`',$value); $value = str_replace(chr(39),'`',$value); } return $value; }
  20. [06-May-2009 22:45:58] PHP Parse error: syntax error, unexpected T_STRING in /kernel/parser.php(315) : eval()'d code on line 4 this is the top lines in the parser.php. so from what I can see the problem is in one of my .tpl files in which I have about 50+ is there a why to figure out which file is generating that the T_STRING error without going through all 50+ files scanning for a error? function class_template($templ) { $tpl = new show_template; $tpl->$template = $templ; $tpl->print_out(); }
  21. can you tell me if this will work /~^[\w\s]*+{3,25}$~i/ i was told that \w is for all word characters, and as you meantion \s for space then min 3chr 25max
  22. by the way that regex worked perfectly... never knew you could shorten it like that.
  23. do i need to leave the word 'test' in there and if (/^[\w]{4,}$/.test(usr)) {
×
×
  • 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.