-
Posts
271 -
Joined
-
Last visited
Everything posted by blacknight
-
Really odd php-mysql-session interaction
blacknight replied to blacknight's topic in PHP Coding Help
affected rows: 1 result var dump bool(true) -
Really odd php-mysql-session interaction
blacknight replied to blacknight's topic in PHP Coding Help
have allready done this... -
Really odd php-mysql-session interaction
blacknight replied to blacknight's topic in PHP Coding Help
this is teh funny part.. Array ( [0] => 5b526b535b979265ee138cd3ade1c085 [sess_id] => 5b526b535b979265ee138cd3ade1c085 [1] => 6m7js82r848kk2s90sjfmuj325 [session_id] => 6m7js82r848kk2s90sjfmuj325 [2] => 0 [session_user_id] => 0 [3] => 0 [session_last_visit] => 0 [4] => 1331567561 [session_start] => 1331567561 [5] => 1331568461 [session_time] => 1331568461 [6] => 127.0.0.1 [session_ip] => 127.0.0.1 [7] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) [session_browser] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) [8] => [session_forwarded_for] => [9] => index.php [session_page] => index.php [10] => 0 [session_viewonline] => 0 [11] => 0 [session_autologin] => 0 [12] => 0 [session_admin] => 0 ) the var dump is normal the insert is normal the data mutates after entry -
Really odd php-mysql-session interaction
blacknight replied to blacknight's topic in PHP Coding Help
the whole function function UserTracker ($table="UTracker",$cookie="roster_hash",$minutes=15) { global $roster; if($minutes<15) $minutes=15; $this->expireTime=$minutes; $this->cookieName=$cookie; $this->time_now = time(); $this->cookie_data = array('u' => '', 'k' => ''); $this->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : ''; $this->referer = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : ''; $this->forwarded_for = (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? htmlspecialchars((string) $_SERVER['HTTP_X_FORWARDED_FOR']) : ''; $this->host = $this->extract_current_hostname(); $this->page = $this->extract_current_page($roster->config['website_address']); //remove all the expired sessions . no need to keep them . cookies are long gone anyway . $queryd="DELETE FROM `".$roster->db->table('sessions')."` WHERE `session_time` <= '".(time())."'"; //echo $queryd.'<br>'; $resultd = $roster->db->query($queryd); $roster->db->free_result($resultd); $this->trackerID= (isset($this->uuid) ? $this->uuid : md5($_SERVER["HTTP_USER_AGENT"].$_SERVER["REMOTE_ADDR"]) ); $aquery="SELECT * FROM `".$roster->db->table('sessions')."` WHERE `session_id`='".session_id()."'"; $result = $roster->db->query($aquery); $rows = $roster->db->num_rows($result); $rec = array(); if ($rows == 1) { $rec = $roster->db->fetch($result); } $roster->db->free_result($result); if(isset($rec['session_id']) && $rec['session_id'] == session_id()) { $page = implode('-',$roster->pages); //make the life of the cookie longer and update time and IP . $xsql = "UPDATE `". $roster->db->table('sessions') ."` SET `session_user_id` = '".$this->uid."', `session_last_visit` = '".time()."', `session_browser` = '".$this->browser."', `session_ip` = '".$this->getIP()."', `session_time` = '".(time()+60*15)."', `session_page` = '".substr($this->page['page'], 0, 199)."' WHERE `session_id` = '" . session_id() . "'"; $rx = $roster->db->query($xsql); $roster->db->free_result($rx); $this->newSession=0; return true; } else if ($rows == 0) { $domain = $_SERVER['HTTP_HOST']; $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $p = parse_url($url); $page = $p['query']; $xsql_ary = array( 'sess_id' => $this->trackerID, 'session_id' => session_id(), 'session_user_id' => $this->uid, 'session_start' => (int) time(), 'session_last_visit' => (int) $this->data['session_last_visit'], 'session_time' => (int) time()+(60*15), 'session_page' => substr($this->page['page'], 0, 199), 'session_browser' => (string) trim(substr($this->browser, 0, 149)), 'session_forwarded_for' => (string) $this->forwarded_for, 'session_ip' => (string) $this->getIP(), 'session_autologin' => ($session_autologin) ? 1 : 0, 'session_admin' => ($set_admin) ? 1 : 0, 'session_viewonline' => ($viewonline) ? 1 : 0, ); // this allways errors out because the session exists... i hate this class.... $sql = 'REPLACE INTO `' . $roster->db->table('sessions') . '` ' . $roster->db->build_query('INSERT', $xsql_ary); $s = $roster->db->query($sql); $qry1 = "UPDATE `" . $roster->db->table('user_members') . "` SET `online` = '1' WHERE `id` = '".$sql_ary['session_user_id']."'"; $q = $roster->db->query($qry1); $this->newSession=1; return true; } else { $roster->set_message( ' An erroro has occured in your session it will now be reset', 'Sessions', 'notice' ); } } -
Really odd php-mysql-session interaction
blacknight replied to blacknight's topic in PHP Coding Help
$xsql = "UPDATE `". $roster->db->table('sessions') ."` SET `session_user_id` = '".$this->uid."', `session_last_visit` = '".time()."', `session_browser` = '', `session_ip` = '".$this->getIP()."', `session_time` = '".(time()+60*15)."',`session_page` = '".nl2br($page)."' WHERE `session_id` = '" . session_id() . "'"; $rx = $roster->db->query($xsql); if (!$rx) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $xsql; die($message); } $roster->db->free_result($rx); is the update query i free every query result in the script after its used.. -
so i work on wowroster.net making upgrades to roster i have created a user lib for the sit and im now adding sessions but im getten some odd issues.... this is one of the inserts and sent to mysql_query example UPDATE `roster_sessions` SET `session_user_id` = '0', `session_last_visit` = '1331544818', `session_browser` = '', `session_ip` = '127.0.0.1', `session_time` = '1331545718', `session_page` = 'p=guild-main&a=g:1' WHERE `session_id` = '6m7js82r848kk2s90sjfmuj325' YET.. this is what i get in my database sql dump from my admin INSERT INTO `roster_sessions` (`sess_id`, `session_id`, `session_user_id`, `session_last_visit`, `session_start`, `session_time`, `session_ip`, `session_browser`, `session_forwarded_for`, `session_page`, `session_viewonline`, `session_autologin`, `session_admin`) VALUES ('5764d5713a7f24c82b30d271460bf68c', '6m7js82r848kk2s90sjfmuj325', '3', 0, 1331544818, 1331545718, '127.0.0.1', '', '', 'addons-main-images-shadow', 0, 0, 0); any clue at all...
-
mysql for select using sum in another table
blacknight replied to charles07's topic in PHP Coding Help
did it work? i would have joined the paymentstable insted of having a imbeded select query tho.... -
depends on teh file type search google for video embed code for **** with the file types you want
-
yea then restart your webserver
-
question is how big is the file you are uploading
-
good open your php.ini search for "File Uploads" make sure they are on whats the max upload size find "post_max_size" whats its value?
-
are you using a webhost.. and tell me the form and code are in the video.php file...
-
Updating a column in a mysql table with php help me
blacknight replied to clivetwo's topic in PHP Coding Help
really /facepalm http://dev.mysql.com/doc/refman/5.0/en/update.html wala read ... it will help alot.... -
check your webhost for file types not allowed that could be your issue
-
seee xyph signature put that code at the top of the page the form posts too then try agian
-
what error are you getting so we can help more lol
-
uploading multiple files is easy on the field name for the files add [] for an array for multiple this is a function i use in my phpbb download section.. while(list($key,$value) = each($_FILES[upload_image][name])) { if(!empty($value)) { // this will check if any blank field is entered $filename = $value; // filename stores the value $filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line $fanme = $dlid . "_" . $filename; //$target_path = "../dlfiles/screens/" . $fanme; $this->setMessage($target_path); $sql = "INSERT INTO `".DL_SS_TABLE."` (`did`, `url`, `uploaded`) VALUES ('" . $dlid . "', '" . $target_url . "','1')"; $this->setMessage($sql); //* if (move_uploaded_file ( $_FILES ['upload_image'] ['tmp_name'], $target_path )) { $this->setMessage("The image " . $_FILES ['upload_image'] ['name'] . " has been uploaded"); $this->makethumb ( $_FILES ['upload_image'] ['name'], $target_path, $id2 ); $sql = "INSERT INTO `".DL_SS_TABLE."` (`did`, `url`, `uploaded`) VALUES ('" . $dlid . "', '" . $target_path . "','1')"; $result = $db->sql_query ( $sql ); } else { $this->setMessage("Your uploaded was unseccessful"); exit (); } //*/ } } upload_image is ofcourse the name of my file field on my form i hope this helps..
-
The same code in 2 areas showing different. HELP
blacknight replied to devilangel's topic in PHP Coding Help
why 2 css classes if they are the same ... id put them in the same file and call it on each page .... -
insted of a while loop since you are only getting 1 record try $u = mysql_fetch_assoc($auth_key_query); login($u['username'], $u['password'], true);
-
change if($logged_in === false) to == true and it should work .. otherwise your script is saying yea your login but we are going to remove your session anyway... and destroy your auth cookie
-
have you searched google ....... http://stackoverflow.com/questions/3432/multiple-updates-in-mysql the first 10 results answered your question....
-
dosent matter how many drop dows or input boxes you have just call them with the $_POST valueits allways $_POST['namehere'] example $_POST['q4_model4']