Jump to content

scripterdx

Members
  • Posts

    39
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

scripterdx's Achievements

Member

Member (2/5)

0

Reputation

  1. <?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.
  2. 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: user@server.com). 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.
  3. i´m a bit confusede, i´ve made a very simple mysql query, to show logged users (via Sessions), gets the user id and shows the email linked to that id. <?php $jbl ="SELECT `email` FROM `usuarios` WHERE `id` = '$user_id'"; $con = mysql_query($jbl); $fila = mysql_fetch_assoc($con); $emilio = $fila['email']; ?> that works prefectly on my localhost (appserv) but on my real server the one where my site is, it dosen´t works. yes th DB is the same. thanks
  4. i want to limit the amount of keys on the array, let´s say 10. so when i reach that amount wont let me add more items
  5. <?php include('config.php'); //agarra productos a la lista. $usuario=$_GET['id']; $producto=$_GET['prod']; $sql= "SELECT lista FROM usuarios WHERE id=$usuario"; $consulta = mysql_query($sql); $row = mysql_fetch_assoc($consulta); if($lista = $row['lista']){ $lista = explode(",",$lista); } else { $lista = array(); } if(!in_array($producto,$lista)){ $lista[] = $producto; $lista = implode(",",$lista); mysql_query("UPDATE usuarios SET lista = '$lista' WHERE id=$usuario"); echo "Producto agregado"; }else{ echo "Ya existe"; } ?> what this code does is to add items to an array, works pefectly, now i´m wondering un a way to limit the amount of items on the array and to add the posibility to eliminate a "item" from the array regards
  6. first of all the code: <?php include('config.php'); //include('sesion.php') header('Content-Type: text/plain; charset=utf-8'); $id = $_GET['id']; $sql= "SELECT lista FROM usuarios WHERE id=$id"; $consulta = mysql_query($sql); $row = mysql_fetch_assoc($consulta); echo "&lista=".$row['lista']."&";?> <script type="text/javascript"> <object width="320" height="150" title="Crea Tu Lista Para Navidad"> <param name="movie" value="widget_50_top_wishlist.swf" /> <param name="flashvars" value="var1=<?=$_GET['id'] ?>" /> <embed src="widgets/widget_50_top_wishlist.swf" flashvars="var1=<?=$id = $_GET['id'];?>" width="320" height="150" ></embed> </object> </script> what it does: gets an list of items from my DB, when the user is conected and loged in, will show a list of my selected prodcuts, that works prefectly, but just the user logged in can see that list, my goal is to share that list on Facebook, for that i used flashvars, and the $_GET, but still dosent work, how can i make an individual list. any ideas
  7. i´didn´t posted the code becuase works fine, gets the items and store them on mi DB, each id has it´s own items, now the next step is to make it unique on flash, so i´m thinkin flashvars. thanks anyway.
  8. hi, i´ve made a simple wishlist using sessions, it works fine, but when i want to share my list on facebook or something like that only shows the results of my wishlist to me my frinds see a blank app. help.
  9. works fine, it dosen´t reconize the session eventhoug that i´ve put an include for the session i´ll keep working on that, BTW any of you have an idea to change a value with a clcik (link or button) lsita=0 to lista=1 (on /off) thats the way to choose the items for the widget
  10. for the las couple of days i´ve been working on a widget or app, what this widget does is very simple, gets all the items that a user had picked forn a product list and show them in swf object, to be shared on Facebook, (all that works) but just to a single user (me) <?php include('config.php'); header('Content-Type: text/plain; charset=utf-8'); $sql= "SELECT producto FROM usuarios_actividad WHERE id_usuario=1207 AND lista=1 LIMIT 10"; $consulta = mysql_query($sql); $contador=0; while ($row = mysql_fetch_assoc($consulta)){ $lista=explode(',',$row['producto']); $contador++; ?> &id<?php echo $contador;?>=<?php echo $row['producto'];?> <?php } ?> & as you can see, the query is just for that specific user, i need to be to all users. how could i get to make that value variable: (id_usuario=1207) this must be a variable. thanks in advance
×
×
  • 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.