Guilhermenunes Posted April 15, 2015 Report Share Posted April 15, 2015 Gostaria de obter o conteudo da variavel codigo do arquivo login.php e utilizar no arquivo insert.php ************************** LOGIN.PHP ************************** $sql_selecao = "SELECT * FROM usuarios WHERE codigo='".$_POST['codigo']."' AND senha=".$_POST['senha]."'"; $res_selecao = selecionar($sql_selecao); $linhas = mysql_num_rows($res_selecao); if($linhas != 0){ //retorno positivo da query while($res = mysql_fetch_assoc($res_selecao)){ //coleta todos os valores do usuario $_SESSION['senha'] = $res['senha']; $_SESSION['codigo'] = $res['codigo']; ************************* FUNCOES.PHP ************************* function create_thread($codigo, $groupid, $username, $remoteHost, $referer, $lang, $userid, $userbrowser, $initialState, $link) { global $mysqlprefix; $query = sprintf( "insert into ${mysqlprefix}chatthread (usercod, userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate" . ($groupid ? ",groupid" : "") . ") values " . "('%s','%s','%s',%s,'%s','%s',%s,'%s','%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,%s" . ($groupid ? "," . intval($groupid) : "") . ")", mysql_real_escape_string($username, $link), mysql_real_escape_string($userid, $link), intval(next_token()), mysql_real_escape_string($remoteHost, $link), mysql_real_escape_string($referer, $link), intval(next_revision($link)), mysql_real_escape_string($lang, $link), mysql_real_escape_string($userbrowser, $link), intval($initialState)); perform_query($query, $link); $id = mysql_insert_id($link); $newthread = thread_by_id_($id, $link); return $newthread; } ******************** INSERT.PHP ******************** $thread = create_thread($codigo, $groupid,$visitor['name'], $remoteHost, $referrer,$current_locale,$visitor['id'], $userbrowser,$state_loading,$link); Quote Link to comment Share on other sites More sharing options...
Question
Guilhermenunes
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.