Jump to content

silversinner

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

silversinner's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, i have created a database that stores customers that purchase something from my site. the problem is, lets say there are two customers with the same name, when i browse the induvisual values it shows the same value (name) but with double the rows is something i cant get away from or if i use php to output that data will it show it both as seperate or is it something to do with Mysql to change that. any suggestions? Regards SS
  2. Hi, thank its working now. another question, what would i have to do to make the same information going into the MySQL DB also be sent as an email? and then let the user be directed to a payment page, or a signup error? so far ive come up with this: <?php if ($_POST['name'] != "" && $_POST['contact'] && $_POST['paypal'] && $_POST['domain'] && $_POST['username'] && $_POST['password'] ) { $subject="You Have A New Customer Sign-Up!"; $name=$_POST['name']; $address=$_POST['address']; $line1=$_POST['line1']; $line2=$_POST['line2']; $postcode=$_POST['postcode']; $county=$_POST['county']; $country=$_POST['country']; $phone=$_POST['phone']; $contact=$_POST['contact']; $paypal=$_POST['paypal']; $domain=$_POST['domain']; $username=$_POST['username']; $password=$_POST['password']; $plan=$_POST['plan']; $comments=$_POST['comments']; $ip=$_SERVER["REMOTE_ADDR"]; $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); $host = $ip.".".$host; $mon=date(m); $day=date(j); $year=date(y); $hour=date(g); $min=date(i); $sec=date(s); $hour=$hour-2; if($hour<=0) { $hour+=12; } $ts = "$hour:$min:$sec on $day/$mon/$year"; $to="$orders_email"; $body=" Your Name = $name Address = $address Line 1 = $line1 Line 2 = $line2 Post Code = $postcode County = $county Country = $country Phone = $phone Contact E-Mail Address = $contact Paypal E-Mail Address = $paypal Your Domain Name = $domain Requested User Name = $username Requested Password = $password Plan = $plan Additional Comments = $comments Host: $host Time: $ts"; $email = "From: $site_title Sign-up Form <$to>"; mail($to, $subject, $body, $email); $db=mysql_connect("localhost", "unlimite_customers", "******") or die("Could not connect to localhost."); mysql_select_db("unlimite_customers", $db) or die("Could not find customers."); $querySQL = "INSERT INTO `customers` (`name`, `address`, `line1`, `line2`, `postcode`, `county`, `country`, `phone`, `contact`, `paypal`, `domain`, `username`, `password`, `plan`, `comments`) VALUES ('$name', '$address', '$line1', '$line2', '$postcode', '$county', '$country', '$phone', '$contact', '$paypal', '$domain', '$username', '$password', '$plan', '$comments')"; mysql_query($querySQL) or die(mysql_error()); ?> <? include_once "template/header.html"; include_once "body/signup_pay.html"; include_once "template/footer.html"; ?> <?php } else { ?> <? include_once "template/header.html"; include_once "body/signup_error.html"; include_once "template/footer.html"; ?> <? } ?> but it hasnt worked! anyone know why? i cant figure it out. regards SS
  3. Hi. its still not showing up in the database, im not sure what im doing wrong. heres the whole of the code that handles it: <?php if ($_POST['name'] != "" && $_POST['contact'] && $_POST['paypal'] && $_POST['domain'] && $_POST['username'] && $_POST['password'] ) { $name=$_POST['name']; $address=$_POST['address']; $line1=$_POST['line1']; $line2=$_POST['line2']; $postcode=$_POST['postcode']; $county=$_POST['county']; $country=$_POST['country']; $phone=$_POST['phone']; $contact=$_POST['contact']; $paypal=$_POST['paypal']; $domain=$_POST['domain']; $username=$_POST['username']; $password=$_POST['password']; $plan=$_POST['plan']; $comments=$_POST['comments']; $db=mysql_connect("localhost", "unlimite_customers", "*******") or die("Could not connect to localhost."); mysql_select_db("unlimite_customers", $db) or die("Could not find customers."); $querySQL = "insert into customers (name, address, line1, line2, postcode, county, country, phone, contact , paypal, domain, username, password, plan, comments) values ($name, $address, $line1, $line2, $postcode, $county, $country, $phone, $contact , $paypal, $domain, $username, $password, $plan, $comments)"; mysql_query($querySQL) or die(mysql_error()); ?> I know my form is correct. must be something im doing wrong kind regards SS
  4. Hi. I need a bit of help, Im not sure how to get information from radio boxes into a mysql database. This is the code from partf of the form that used the radio box: <input type="radio" name="plan" style="border: 1px solid #cccccc; background-color: #ffffff;" value="Beginner"/>Beginner </font><font face="verdana" size="2" color="#FF0000"></font><font face="verdana" size="1"><br> <input type="radio" name="plan" style="border: 1px solid #cccccc; background-color: #ffffff;" value="Semi-Pro"/>Semi-Pro </font><font face="verdana" size="2" color="#FF0000"></font><font face="verdana" size="1"><br> <input type="radio" name="plan" style="border: 1px solid #cccccc; background-color: #ffffff;" value="Advanced"/>Advanced And this is the code should put the information into the Mysql Database: <?php $db=mysql_connect("localhost", "unlimite_customers", "*******") or die("Could not connect to localhost."); mysql_select_db("unlimite_customers", $db) or die("Could not find customers."); $querySQL = "insert into customers (name, address, line1, line2, postcode, county, country, phone, contact , paypal, domain, username, password, plan, comments) values ($name, $address, $line1, $line2, $postcode, $county, $country, $phone, $contact , $paypal, $domain, $username, $password, $plan, $comments)"; if(!$querySQL) error_message(sql_error()); ?> the * indicate sensitive info. Im not the most experianced PHP programmer. can anyone see my errors or what im missing out. Regards SS
  5. Hey there im setting up a website for customers, and basicly i need to use a login script in php as a form of customer managment, im new to php, and since im self employed i dont have anyone to look to, i created a mysql database with the correct tables and feilds and i got the php script and edited ect so it would connect to my database but when i intergrate this script into my index.php this come up: Ive rechecked the code and didnt find any errors, but there has to be like a variable or something isnt definded right i will supply the code for people to have a look at: <?php // Connects to your Database mysql_connect("crudewars.athost.net", "6124", "") or die(mysql_error()); mysql_select_db("6124") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?> im not sure what to do at this stage, im stuck, its just im lacking in php knowledge. If anyone can find the problem id be more that appreciated Marcus McClorey
×
×
  • 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.