Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Ok, well there you go then.... if transaction_id is an integer then you shouldn't have the quotes around it, as brianlange suggested. However, you also shouldn't be doing this earlier: $transaction_id = mt_rand() . mt_rand(); You will easily overflow the integer range on a regular basis concatenating these numbers together. On one of my servers the max number that can be returned from mt_rand() is a signed positive integer (21474836470, so mt_rand can return anything between 0 and that number which is already the largest number in the signed integer range.
  2. $sql="INSERT INTO buyer (username, email, first_name, last_name, street, street_2, city, state, zip_code, country, transaction_id, date) VALUES ('$username', '$item_email', '$item_first_name', '$item_last_name', '$item_street', '$item_street2', '$item_city', '$item_state', '$item_zip_code', '$item_country', '$transaction_id', CURDATE())"; echo $sql; die();
  3. Not even close. function Cuenta_Contactos(){ $datos = $this->objDBA->cuentaCampos('tbl_contacto','Order By Fecha DESC'); return $datos[0]['Cuenta']; } That just does a query from the the tbl_contacto and returns the results in an array. There are several functions that use phpMailer, and these could be easily cloned to mail something to you from a contact form. For example: function Envia_Mail_Activacion_Empleado($path, $datos){ $opcion = 0; //$regexmail = "/^[A-Za-z]*[0-9]*[A-Za-z]+@[A-Za-z]*[0-9]*[A-Za-z]+(\.[A-Za-z]{2,4})$/"; //if(isset($_POST['Nombre']) && isset($_POST['Comentario']) && isset($_POST['Email']) && $this->Revisa_Campo_Busqueda($_POST['Nombre']) == true && $this->Revisa_Campo_Busqueda($_POST['Comentario']) == true && preg_match($regexmail, $_POST['Email'])){ echo $opcion = 1; include($path.'../Model/Mailer/PHPMailer.php'); $mailer = new PHPMailer(); $mailer->From = 'noreenviar@ideasdelmar.com'; //$mailer->FromName = $_POST['Nombre']; $mailer->FromName = 'Ideas del Mar'; //$mailer->Subject = $datos[0]['Nombre'].' Rentas DePlaya'; $mailer->Subject = 'Activar cuenta Ventas'; $texto = '</pre> <table width="200" border="0" align="center" cellpadding="3" cellspacing="3"> Bienvenido a la sección de Ventas donde podras ver el estatus los clienes así como sus respectivas vallas e información Su nombre de Usuario: '.$datos[0]['username'].' Para continuar su registro es neceseario activar su cuenta en la siguiente LINK http://www.ideasdelmar.com/ventas/activar.php?ActiveNumber='.$datos[0]['ActiveN'].'&action= Si el LINK no funciona copia y pega la dirección en tu navegador Para accesar a la sección hay que entrar a la siguiente URL www.ideasdelmar.com/ventas/ Atte IDEAS DEL MAR www.ideasdelmar.com Este mensaje se dirige exclusivamente a su destinatario. Contiene información considerada como CONFIDENCIAL, sometida a secreto profesional o cuya divulgación está prohibida por la ley. Si ha recibido este mensaje por error, debe saber que su copia y uso están prohibidos. Le rogamos que nos lo comunique inmediatamente por esta misma vía o por teléfono y proceda a su destrucción. </table>';<br> $mailer->Body = $texto;<br> //$mailer->Body = $_POST['email'].' >>>>> dejo el siguiente pregunta: '.$_POST['Comentario']. ' >>>>>> de la Propiedad >>>> '.$datos[0]['username'].' >>>> http://www.deplaya.com.mx/rentas/propiedad.php?id='.$datos[0]['Id'].'&por='.$promotors[0]['IdPromotor'];<br> $mailer->AddAddress($datos[0]['email'], $datos[0]['username']);<br> $mailer->Send();<br> $mailer->ClearAddresses();<br> //}<br> return $opcion;<br
  4. Again, I asked you to echo out $sql before the insert and to paste it here. Also, what is the structure of the buyer table?
  5. A valid href needs to have the http:// in front of it. You will need to check their link for it at the beginning and if they don't have it you can add it in.
  6. Perhaps, but I doubt it considering how he's using it in the code.
  7. Read this: http://us3.php.net/manual/en/book.ssh2.php
  8. It doesn't. Cookies are associated with the browser, so there's no concept of user. The system has no way of knowing if you are sitting at your computer, get up and someone else sits down in your chair.
  9. This type of problem is best solved with regular expressions because you're looking for patterns that include variables, and regex can capture the variable stuff (in this case the url) making it easy to output your html version. Take a look at preg_replace() instead.
  10. echo out the $sql statement, check that it's what you expect, and run that from command line mysql or phpMyAdmin and make sure you don't have a syntax error.
  11. There's not much point in bolding nothing.
  12. Ok, so open your output file for "Append". This will write the new entries at the bottom. Use a separate file for your counter for simplicity sake. I also noticed you pulled the code you have from a tutorial, but that tutorial doesn't even have valid PHP code in it. You might look at some of the other tutorials that offer a step by step hitcounter, however, a guest book and a hit counter are not the same thing. It sounds like you want a simple guestbook, and that's where you'll need the append, however, with guestbook entries you also need to have a format for the file, so that you can tell the entries apart when you're rendering them back out of the file.
  13. I'm confused. You say it produces a unique number (and you're concatenating the output of 2 calls together)? Then you say that you have seen it's unique but it inserts the same value in the database table?
  14. No, you should use sessions. Sessions already default to using cookies to pass the session id between requests, but the session data remains on the server, so there's no way the user can tamper with it.
  15. Can you try and explain what your problem is? I don't understand your question.
  16. Haha, cool stuff. Years ago I worked for company that ran its financials on an as/400 and the as/400 guy was always trying to convince me to run a webstack on the as/400. We had lots of sun pizza box servers for the websites. Fun to see someone actually doing that show up here. If we ever have someone with any as400 questions I'm going to point them your way, hehe. Good luck with the project and let us know how it goes.
  17. Yeah that is challenging, and something we are pretty used to working around in the webdev world. You definately want to make sure you know where your error logs are, that they are turned on and assuming you have a development site, that you have all the error configuration turned up for php, so that you see runtime errors displayed. If of course you just have an error that is breaking the html rendering, that's harder to debug, but that doesn't happen to much to me. I really advise against people using hosts where they don't have shell access, because you need to be able to jump in and tail the error logs (http and/or php) when you're in active development. Needless to say, you need to have looked into your php.ini file and your httpd.conf so it's clear how these things are all setup, and the locations. The good old phpinfo() function is also very helpful at times for finding out the true locations of your webroot, and which config files are being read.
  18. I think at this point, if what schlumph posted is too complicated, it might be a good idea to just sit down with his code, and the manual and go through it until you do understand it. Write a short script that makes a new user object. In his implementation you pass an associative array to it, and it will automatically add properties to the object that coincide with the key names of the associative array. Then look at his usermapper class. Figure out how to flesh that out so that it actually works. UserMapper is heading towards implementation of a factory pattern in that it will manufacture a user object for you if you call the fetchOne() method. So clearly, fetchOne() would need to be fleshed out to actually open the database, query it by username, fetch the row, create a new User and return it.
  19. Yes, you are correct about the header() function --- it needs to be used first. This is because its purpose is to set values in the http header, so once http packets are flowing, it's too late to set the header. With that said, it looks like you have the basic structure in place. However, rather than trying to include download, what you should have is an anchor tag pointing to your download.php url. You can then use javascript to click that link automatically. Usually people will have the link say: "If your download does not start automatically clink on this link to download the file" or something similar.
  20. Glad to help. I assumed that since you were using an interator you knew about foreach(). Pretty much the goal of using iterators in PHP is so you can use foreach, and as Mchl pointed out, you can make any class foreach-able by implementing the traversable interface, and with php5 they put in a lot of work to make all sorts of builtin classes traversable. By default all arrays are traversable. My Avatar is a funny picture of my daughter when she was still a baby. She's 7 now -- as they say, it's very true that they grow up fast.
  21. Could be what PFMaBiSmAd said, and in general my comment is that you have no error checking. Going even further, you don't make a database connection prior to the query. I assumed that maybe you were already doing that somewhere else, as well as starting the session because without a session_start() and a valid session, even the fix I gave you will still be a problem.
  22. Ok, so basically you need a script that queries your tblimages by IDImage, gets the blob data, sets the headers and returns the data. You need to set the mimetype to match the image. I'm not sure where you can derive that based on your table structure, but perhaps it's in the name, and you can get it from the filename extension. Maybe you will call the script getImage.php So in your html output you would have the img tag echo ""; Your getImage.php script would be something similar to this: // have to setup database connection before this $id = (int)$_GET['id']; $result = mysql_query("SELECT Image, Nom FROM tblimages WHERE IDImage = $id"); $row = mysql_fetch_assoc($result); header('Content-Length: '.strlen($row['Image'])); header("Content-type: image/jpeg"); // note i hardwired this to jpeg, but should detect and set right mimetype for whatever image type it is echo $row['Image']; exit();
  23. Well if the user filled out a form, values from the form will be available to you in the $_POST.
  24. I see a couple possible issues, but one that jumps right out is that you have $senderid = $SESSION... and this should be $_SESSION
  25. Glad we helped. If you get a chance you can click on the bottom and mark your topic as Solved using the Green Mark Solved button.
×
×
  • 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.