scripterdx Posted November 27, 2009 Share Posted November 27, 2009 first of all let me tell you what does my script do, it´s a very simple query to show a email from a database, (EX: Welcome: [email protected]). i get the email whit the id. <?php $jbl ="SELECT `email` FROM `usuarios` WHERE `id` = '$user_id'"; $con = mysql_query($jbl); $fila = mysql_fetch_assoc($con); $emilio = $fila['email']; ?> works just fine on my localhost. (yes it´s only the query) i repeat the script works just fine on my localhost. the problem is when it´s on a real server. it dose´nt show any thing. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/ Share on other sites More sharing options...
cags Posted November 27, 2009 Share Posted November 27, 2009 Your not doing any error trapping so I suspect that something is different in your online database to your local database. Change... $con = mysql_query($jbl); ...to... $con = mysql_query($jbl) or trigger_error("SQL: $jbl, ERROR: " . mysql_error(), E_USER_ERROR); ...and assuming you have error reporting on it will show you if it's failing. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966412 Share on other sites More sharing options...
scripterdx Posted November 27, 2009 Author Share Posted November 27, 2009 i´ll try that now Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966415 Share on other sites More sharing options...
scripterdx Posted November 27, 2009 Author Share Posted November 27, 2009 no erros. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966424 Share on other sites More sharing options...
mrMarcus Posted November 27, 2009 Share Posted November 27, 2009 post your script, especially how you're setting $user_id. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966435 Share on other sites More sharing options...
scripterdx Posted November 27, 2009 Author Share Posted November 27, 2009 <?php function registraActividad($id, $act, $ide){ if($_SESSION['user_id']){ $fecha = date("Y-m-d G:i:s"); mysql_query("INSERT INTO usuarios_actividad (id_usuario, actividad, $act, fecha) values ('$id', '$act', '$ide', '$fecha')"); return "si"; } else { return "no"; } } function sesion(){ if(!$_SESSION['user_id']): if(isset($_COOKIE["usuario_50"])): $_SESSION['user_id'] = $_COOKIE["usuario_50"]; //registro logueo $fecha = date("Y-m-d G:i:s"); mysql_query("INSERT INTO usuarios_actividad (id_usuario, actividad, fecha) values ('".$_SESSION['user_id']."', 'login', '$fecha')"); endif; endif; } function form($url){?> <?php if(!$_SESSION['user_id']): ?> <script type="text/javascript"> $(function() { var url = '<?=$url?>'; var abre; function dialogo(){ if(url=='no') autoO = false; else autoO = true; $("#dialog").dialog({ bgiframe: true, position: 'center', autoOpen: autoO, draggable: false, resizable: false, dialogClass: 'registro', width: 430, height: 300, modal: true }); function enviaRegistro(){ var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; str = $("input[name='email']").val(); if(str.match(emailRegEx)){ $.get("login.php", { email: str }, function(data) { window.location = url; }); }else{ alert('Por favor ingresa un email real!'); } } //boton ingresar $('div.modal-contenido a').one("click", function(e){ e.preventDefault(); enviaRegistro(); //lo dejo sin click para un segundo click $(this).click(function(e) { e.preventDefault(); }) }) //submit de form (por si no aprietan el boton) $('div.modal-contenido form').submit(function() { enviaRegistro(); return false; }) //centro el dialog cuando hago scroll o resize $(window).scroll(function () { $("#dialog").dialog('option', 'position', 'center'); }); $(window).resize(function () { $("#dialog").dialog('option', 'position', 'center'); }); //boton cerrar $('div.modal-cerrar a').click(function(e) { e.preventDefault(); $('#dialog').dialog('close'); }) if(abre == 'si') $('#dialog').dialog('open'); //abre dialogo (desde link) } //abro dialogo al comenzar dialogo(); //abro dialog en cada link de la lista (si no esta logueado) $('div.cuadro a').click(function(e) { e.preventDefault(); url = $(this).attr('href'); abre = 'si'; dialogo(); }) }); </script> <div id="dialog" title="Ingresa tu email"> <div class='modal-contenido'> <div class='titulo'> [50+]quiere saber más de ti </div> <div class='subtitulo'>Estamos trabajando para poder entregarte toda la información sobre tus productos favoritos. Ingresa tu e-mail, entrarás a la base de datos de <b>[50+]</b> Podrás acceder a grandes beneficios.</div> <div class='form over_flow'> <form> <label for="email">mail_</label> <input type="text" name="email" id="email" class="text" /> </form> </div> <div class='ingresar'><a href="#">ingresar</a></div> <div class='pie'> <b>[50+]fashionhunter</b> respeta tu privacidad. Tu e-mail es parte de nuestra información confidencial... Nosotros también odiamos el spam!! </div> </div> <div class='modal-cerrar'><a href="#"></a></div> </div> <?php endif; } ?> AND <?php session_start(); //inicio session include('config.php'); if($email=$_GET['email']): $fecha = date("Y-m-d G:i:s"); //la fecha pues echo $email; //existe en la DB? lo meto si no, y extraigo id $sql="SELECT id FROM usuarios WHERE email = '$email'"; $consulta = mysql_query($sql); $existe_user = mysql_num_rows($consulta); if($existe_user == 0) mysql_query("INSERT INTO usuarios (email, fecha_ingreso) values ('$email', '$fecha')"); $consulta = mysql_query($sql); $row = mysql_fetch_assoc($consulta); $id = $row['id']; //registro logueo mysql_query("INSERT INTO usuarios_actividad (id_usuario, actividad, fecha) values ('$id', 'login', '$fecha')"); //seteo tiempo duracion sesion (1 mes) y creo cookie $expire=time()+(31 * 24 * 60 * 60); setcookie('usuario_50', $id, $expire); //creo session con la id del user $_SESSION['user_id'] = $id; //listo! echo $id; echo $mail; else: echo $_SESSION['user_id']; endif; ?> i repeat, on my localhost works just fine. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966527 Share on other sites More sharing options...
mrMarcus Posted November 27, 2009 Share Posted November 27, 2009 i don't see $user_id or the query in question, anywhere. please post relevant code. Link to comment https://forums.phpfreaks.com/topic/183114-welcome-screen/#findComment-966547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.