-
Posts
136 -
Joined
-
Last visited
About ambo
- Birthday 06/15/1988
Contact Methods
-
Website URL
http://www.Runkys.com
Profile Information
-
Gender
Male
ambo's Achievements
-
<?php session_start(); include_once '/functions/dbconnect.php'; if(isset($_SESSION['user'])!="") { header("Location: home.php"); } if(isset($_POST['btn-login'])) { $email = mysql_real_escape_string($_POST['email']); $uname = mysql_real_escape_string($_POST['uname']); $upass = mysql_real_escape_string($_POST['pass']); $email = trim($email); $uname = trim($uname); $upass = trim($upass); $res=mysql_query("SELECT user_id, user_name, user_pass FROM users WHERE user_name='$uname'"); $row=mysql_fetch_array($res); $count = mysql_num_rows($res); // if uname/pass correct it returns must be 1 row if($count == 1 && $row['user_pass']==md5($upass)) { $_SESSION['user'] = $row['user_id']; header("Location: home.php"); } else { ?> <script>alert('Username / Password Seems Wrong !');</script> <?php } } ?> <html lang="en"> <head> <meta charset="UTF-8"> <title>Runkys Small Engine Repair</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <!--[if lte IE 8]><script src="js/html5shiv.js"></script><![endif]--> <script src="js/jquery.min.js"></script> <script src="js/skel.min.js"></script> <script src="js/skel-layers.min.js"></script> <script src="js/init.js"></script> <noscript> <link rel="stylesheet" href="css/skel.css" /> <link rel="stylesheet" href="css/style.css" /> <link rel="stylesheet" href="css/style-xlarge.css" /> </noscript> </head> <body class="landing"> <!-- Header --><!-- Banner --> <section id="banner"> <h2>Runkys</h2> <p>Small Engine Repair</p> <ul class="actions"> <li> <form method="post"> <table id="form" align="center" width="30%" border="0"> <tr id="trlogim"> <td><input type="text" name="uname" placeholder="Username" required /></td> </tr> <tr id="trlogim"> <td><input type="password" name="pass" placeholder="Your Password" required /></td> </tr> <tr id="trlogim"> <td><button type="submit" name="btn-login">Sign In</button></td> </tr> </table> </form> I have a simple login script that I have been playing with and it was working on my local wamp server but when I uploaded it to the web server all works except the login part I know my dbconnect.php file is accurate because I can register new users I just cant sign them in
-
session_start(); if(isset($_SESSION['user'])!="") { header("Location: home.php"); } include_once 'dbconnect.php'; if(isset($_POST['btn-signup'])) { $uname = mysql_real_escape_string($_POST['uname']); $email = mysql_real_escape_string($_POST['email']); $upass = md5(mysql_real_escape_string($_POST['pass'])); $phone = mysql_real_escape_string($_POST['phone']); $fname = mysql_real_escape_string($_POST['fname']); $lname = md5(mysql_real_escape_string($_POST['lname'])); $uname = trim($uname); $email = trim($email); $upass = trim($upass); $phone = trim($phone); $fname = trim($fname); $lname = trim($lname); // email exist or not $query = "SELECT user_name FROM users WHERE user_name='$uname'"; $result = mysql_query($query); $count = mysql_num_rows($result); // if email not found then register if($count == 0){ if(mysql_query("INSERT INTO `users` (`user_id`, `user_name`, `user_email`, `user_pass`, `user_phone`, `user_fname`, `user_lname`, `user_level`) VALUES(NULL,'$uname','$email','$upass','$phone','$fname','$lname',1)")) { ?> <script>alert('successfully registered ');</script> <?php } else { ?> <script>alert('error while registering you...');</script> <?php } } else{ ?> <script>alert('Sorry Email ID already taken ...');</script> <?php } } ?> <!DOCTYPE html PUBLIC > <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Runkys</title> <?php include_once 'csslist.php'; ?> </head> <body> <?php include_once 'header.php'; ?> <div id="body"> <div id="login-form"> <form method="post"> <table align="center" width="30%" border="0"> <tr> <td><input type="email" name="email" placeholder="Your Email" required /></td> </tr> <tr> <td><input type="text" name="uname" placeholder="User Name" required /></td> </tr> <tr> <td><input type="password" name="pass" placeholder="Your Password" required /></td> </tr> <tr> <td><input type="text" name="phone" placeholder="Phone Number" required /></td> </tr> <tr> <td><input type="text" name="fname" placeholder="First Name" required /></td> </tr> <tr> <td><input type="text" name="lname" placeholder="Last Name" required /></td> </tr> <tr> <td><button type="submit" name="btn-signup">Sign Me Up</button></td> </tr> <tr> <td><a href="index.php">Sign In Here</a></td> </tr> </table> </form> </div> </div> </body> </html> I am new to this and cant figure out what I am missing I modeled it after another page that I have that works this is a learning curve for me please teach me what I did wrong its simple register script where it checks to see if the username is already in the db
-
never mind I figured it out
-
<?php $notesget = mysql_query("SELECT * FROM notes ORDER BY note_date"); // selecting data through mysql_query() $notesfill = mysql_fetch_array($notesget); $notedate = $notesfill['note_date']; $time = strtotime($notedate); $notedateformat = date("n/j g:ia", $time); // we are running a while loop to print all the rows in a table echo'<tr>'; // printing table row echo '<td id="notename" align="right">'.$notesfill['note_user'].'</td></tr><tr><td id="notedata">'.$notesfill['note_data'].'</td></tr><tr><td id="notedate" align="right">'.$notedateformat.'</td></tr>'; ?> Having trouble looping data after date formatting
-
Thank you just a new way of thinking I am blind sometimes
-
SELECT cl_lname ,cl_fname FROM clientdata WHERE cl_lname='$cl_lname' AND cl_fname='$cl_fname' so something like this
-
<?php include_once 'dbconnect.php'; include_once 'securitycheck.php'; if(isset($_POST['btn-signup'])) { $cl_fname = mysql_real_escape_string($_POST['cl_fname']); $cl_lname = mysql_real_escape_string($_POST['cl_lname']); $cl_address = mysql_real_escape_string($_POST['cl_address']); $cl_city = mysql_real_escape_string($_POST['cl_city']); $cl_state = mysql_real_escape_string($_POST['cl_state']); $cl_zipcode = mysql_real_escape_string($_POST['cl_zipcode']); $cl_hphone = mysql_real_escape_string($_POST['cl_hphone']); $cl_cphone = mysql_real_escape_string($_POST['cl_cphone']); $cl_fname = trim($cl_fname); $cl_lname = trim($cl_lname); $cl_address = trim($cl_address); $cl_city = trim($cl_city); $cl_state = trim($cl_state); $cl_zipcode = trim($cl_zipcode); $cl_hphone = trim($cl_hphone); $cl_cphone = trim($cl_cphone); // Checks to see if the names from the form exist in DB $query1 = "SELECT cl_lname cl_fname FROM clientdata WHERE cl_lname='$cl_lname'"; $result1 = mysql_query($query1); $count1 = mysql_num_rows($result1); $query2 = "SELECT cl_fname FROM clientdata WHERE cl_fname='$cl_fname'"; $result2 = mysql_query($query2); $count2 = mysql_num_rows($result2); if($count1 == 0){ if(mysql_query("INSERT INTO clientdata(cl_fname,cl_lname,cl_address,cl_city,cl_state,cl_zipcode,cl_hphone,cl_cphone) VALUES('$cl_fname','$cl_lname','$cl_address','$cl_city','$cl_state','$cl_zipcode','$cl_hphone','$cl_cphone')")) { ?> <META http-equiv="refresh" content="0;URL=client_list.php"> <?php } else { ?> <script>alert('There was a Error');</script> <?php } } else{ if($count2 == 0){ if(mysql_query("INSERT INTO clientdata(cl_fname,cl_lname,cl_address,cl_city,cl_state,cl_zipcode,cl_hphone,cl_cphone) VALUES('$cl_fname','$cl_lname','$cl_address','$cl_city','$cl_state','$cl_zipcode','$cl_hphone','$cl_cphone')")) { ?> <META http-equiv="refresh" content="0;URL=client_list.php"> <?php } else { ?> <script>alert('There was a Error');</script> <?php } } else{ ?> <script>alert('Customer already exists');</script> <?php } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Runkys</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body id="body"> <center> <?php include_once 'header.php'; ?> <div id="mainbody"> <form id="login-form" method="post"> <table id="inputtable" align="center" width="70%" border="0"> <tr> <td><input type="text" name="cl_fname" placeholder="First Name" required /></td> <td><input type="text" name="cl_lname" placeholder="Last Name" required /></td> </tr> <tr> <td><input type="text" name="cl_address" placeholder="Address" required /></td> <td><input type="text" name="cl_city" placeholder="City" required /></td> </tr> <tr> <td> <select name="cl_state"> <option value="CT">Connecticut</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> </td> <td><input type="text" name="cl_zipcode" placeholder="Zipcode" required /></td> </tr> <tr> <td><input type="text" name="cl_hphone" placeholder="Home Phone" required /></td> <td><input type="text" name="cl_cphone" placeholder="Cell Phone" required /></td> </tr> <tr> <td><button type="submit" name="btn-signup">Add Client</button></td> </tr> <tr> <td><a href="home.php">Cancel</a></td> </tr> </table> </form> </div> </center> </body> </html> I have a simple script and I am new to this so the basic thing is I have a form that I can input client data into a database for later recall... if you fill out the form it will add the info to database so far I am able to grab the data have the script check the last name if the last name is in the DB it then checks to see if the first name is in the database. if the first name isn't in the database then its a new client with same last name it will add.. the issue is after it pulls the last name and there is a duplicate it then checks all the rows for the first name so if you have fname1, lname1 fname2,lname2 and I want to add fname2,lname1 I cant any ideas?