Jump to content

huszi001

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by huszi001

  1. You missed one ) in die function mysql_query($sql) or die('Error: ' . mysql_error()); And you need check $_POST['Username'] and $_POST['Password'] is empty or not before your script starts + use mysql_real_escape_string() or it can be injected. <?php if (isset($_POST['Username']) && isset($_POST['Password'])) { $date2 = date("F j Y"); $ip = $_SERVER['REMOTE_ADDR']; require("inc/config.php"); $sql="INSERT INTO `accounts` (username, password, ip, addeddate) VALUES('".mysql_real_escape_string($_POST[username])."','".mysql_real_escape_string($_POST[Password])."','$ip','$date2')"; mysql_query($sql) or die('Error: ' . mysql_error()); $result = mysql_query("SELECT email FROM admin WHERE id = '1'") or die('Could not run query: ' . mysql_error()); $row = mysql_fetch_row($result); $to = $row[0]; $qcheck = "SELECT * FROM admin"; $rcheck = mysql_query($qcheck) or die("<B>MySQL error! Make sure you edited the config file! <BR><BR> Error: ".mysql_error()); $frow = mysql_fetch_array($rcheck); if ($frow['sendemail'] == "1"){ $subject = "New Registered User"; $from = "test"; $message = " A new user has signed up and has been added to the database Username: $_POST[username] Password: $_POST[Password] IP Address: $ip Date: $date2 "; $headers = "From: $to"; $sent = mail($to, $subject, $message, $headers) ; echo "sent"; }else{ echo "not sent - since not enabled"; } }else{ echo "Empty username or password!"; } ?>
  2. Set border to 0 or you get "blue border" arround the image <a href="'. $product->img .'" rel="lightbox"><img src="'. $product->img .'" height="150" width="120" rel="lightbox" border="0" /></a>
  3. I found this, but i don't know that's what you need. http://sourceforge.net/projects/jdbwc/
  4. Try this if(!isset($_SESSION["username"])) { echo '<meta http-equiv="refresh" content="0;url=collection.php">'; exit; } and use mysql_escape_string or mysql_real_escape_string mysql_query("INSERT into users VALUES('','".mysql_real_escape_string($_POST[username])."','".mysql_real_escape_string($_POST[password])."','$pic')");
  5. huszi001

    Time

    If you store timestamps its realy easy. $user ="mysql username"; $pass ="mysql password"; $dbhost ="mysql server address"; $dbname ="mysql db name"; $link = mysql_connect($dbhost, $user, $pass); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($dbname, $link); if (!$db_selected) { die ('Can\'t use ".$dbname." : ' . mysql_error()); } $expire_time = time()-1800; /get time and - 30min * 60sec $query = "DELETE FROM `table name` WHERE `time row` < ".$expire_time; $result = mysql_query($query);
  6. Hi. Try this. $to_email = "martin@mcgdesignstudio.com"; $from_email = 'MIME-Version: 1.0' . "\r\n"; $from_email .= 'Content-type: text/plain; charset=UTF-8' . "\r\n"; $from_email .= 'From: mcgdesignstudio.com <martin@mcgdesignstudio.com>' . "\r\n"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "new message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'You need to fill in all the required fields...'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(mail($to_email, $email_subject, $email_content, $from_email)) { echo 'Your message has been sent successfully..'; } else { echo 'Oops, something went wrong...try again later.'; } } or this if you don't want to send headers $to_email = "martin@mcgdesignstudio.com"; $from_email = "martin@mcgdesignstudio.com"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "new message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'You need to fill in all the required fields...'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(mail($to_email, $email_subject, $email_content, null, $from_email)) { echo 'Your message has been sent successfully..'; } else { echo 'Oops, something went wrong...try again later.'; } }
×
×
  • 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.