Jump to content

Mark2024

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Mark2024

  1. Hello there is no duplicates in the database
  2. Hello Guys im using the code to update my password in my login system my question is how do i hide the form once it has been submitted so it just shows the echo message? <?php include('styles/top.php'); ?> <div id="left"> <img src="images/john.png" height="600px" width="300px" /> </div> <div id="right"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /> <?php if (($user_level !=1 && $user_level !=2)){ echo " Coming Soon "; } else { if(isset($_POST['update'])) { $n_password = md5($_POST['n_password']); $c_password = md5($_POST['c_password']); if($c_password === $n_password) { $sql="update customers set password='$n_password' where username='$username'"; $res=mysqli_query($con,$sql); if($res) { //Password Successfully Changed. echo "Password Has Been Changed"; } else { //Sorry, Something went wrong, Please Try Again. echo "Sorry, Something went wrong, Please Try Again."; } } else { //Password do not Match. echo "Passwords do not match."; } } ?> <h2>Change Your Password</h2> <form action="" method="post"> <input type="password"”" name="n_password" placeholder="Enter new username" required> <input type="password" name="c_password" placeholder="Enter confirm password" required> <input type="submit" value="Submit" name="update"> </form> <?php } ?> </div> <?php include('styles/bottom.php'); ?>
  3. Hello, Im using the code below to display all my records what im trying to do it display them in order by date the only issue i can think of is that im using the field in mysqli as a varchar(50) to sotore the date like 29/04/1984 does anyone have any ideas to help solve this please? <?php include('styles/top.php'); ?> <div id="full"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /><br /> <?php //error_reporting(0); if (($user_level !=1) && ($user_level !=2)){ echo "No Access Allowed"; } else { if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 1; } if($page == '' || $page == 1){ $page1 = 0; } else { $page1 = ($page*4)-4; } $sql = "SELECT * FROM orders Where customer_name= '$customer_name' AND Status='Layon' LIMIT ".$page1.", 4"; //$sql = 'SELECT * FROM orders LIMIT '.$page1.', 4'; $data = $con->query($sql); ?> <h3>View Orders</h3> <table border=1"> <tr> <th>FULL NAME </th> <th>DATE GOT </th> <th>PAY DATE</th> <th>MONEY DUE</th> </tr> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> </tr> <?php $totmoney = 0; $strmoney = ""; while ($myrow = mysqli_fetch_array($data)) { $strmoney = $myrow["money"]; $strmoney = str_replace(',','',$strmoney); if(is_numeric($strmoney)) { settype($strmoney, "float"); $strmoney = number_format($strmoney, 2); } echo "<TR><TD><a href=\"_view.php?id=".$myrow['id']."\">".$myrow["customer_name"]."</A>&nbsp;</TD><TD>".$myrow["gotdate"]."&nbsp;</TD><TD>".$myrow["paydate"]."&nbsp;</TD><TD>&pound;".$strmoney."&nbsp;</TD>"; echo "</TR>"; $totmoney = $totmoney + (int)$myrow["money"]; } ?> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>TOTAL DUE</td> <td>&pound;<?=number_format($totmoney, 2);?>&nbsp;</td> <td></td> </tr> </table> <br /> <?php $sql = "SELECT * FROM orders Where orderby= '$username' AND Status='Layon'"; $data = $con->query($sql); $records = $data->num_rows; $records_pages = $records/4; $records_pages = ceil($records_pages); $prev = $page-1; $next = $page+1; echo '<ul class="paganation">'; if($prev >= 5){ echo '<li><a href="?page=1">First Page</a></li>'; } if($prev >=1){ echo '<li><a href="?page='.$prev.'">Previous</a></li>'; } if($records_pages >= 2 ){ for($r=1; $r <= $records_pages; $r++){ $active = $r == $page ? 'class="active"' : ''; echo '<li><a href="?page='.$r.'" '.$active.'>'.$r.'</a></li>'; } } if($next <= $records_pages && $records_pages >= 2){ echo '<li><a href="?page='.$next.'">Next</a></li>'; } if($page != $records_pages && $records_pages >= 5){ echo '<li><a href="?page='.$records_pages.'">Last Page</a></li>'; } echo '</ul>'; ?> <?php } ?> </div> <?php include('styles/bottom.php') ?>
  4. Hello Guys, im new to this and was looking for some help. I have the following code <?php include ("styles/top.php"); ?> <div id="left"> <img src="images/john.png" height="600px" width="300px" /> </div> <div id="right"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /> <?php if(loggedin()){ ?> <h3><font color="Yellow">Welcome, <?php echo $customer_name; ?></font> <h3>Money That Your Due Today</h3> <table border=1"> <tr> <th>FULL NAME </th> <th>DATE GOT </th> <th>MONEY DUE</th> <th>UPDATE</th> </tr> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> </tr> <?php error_reporting(0); $result = mysqli_query($con,"SELECT * FROM orders WHERE OrderBy = '$username' AND Status = 'Layon'"); $totmoney = 0; $strmoney = ""; $current_date = date("d/m/Y", time()); //Gets the current date, in dd/mm/yyyy format while ($myrow = mysqli_fetch_array($result)) { //Gets the date from the current record $record_date_string = $myrow['PayDate']; //Gets the string date from the database $record_date_elements = explode("/", $record_date_string); //Seperate the date into three parts (dd, mm and yyyy) $record_date = date("d/m/Y", strtotime($record_date_elements[2]."-".$record_date_elements[1]."-".$record_date_elements[0])); //Assembles these elements in a way PHP will understand and creates a new date from the record //If the record date matches the current date, display in the table if($record_date == $current_date){ $strmoney = $myrow["Money"]; $strmoney = str_replace(',','',$strmoney); if(is_numeric($strmoney)) { settype($strmoney, "float"); $strmoney = number_format($strmoney, 2); } echo "<TR><TD><a href=\"_view.php?id=".$myrow['id']."\">".$myrow["FullName"]."</A>&nbsp;</TD><TD>".$myrow["GotDate"]."&nbsp;</TD><TD>&pound;".$strmoney."&nbsp;</TD>"; echo "<TD><center><a href=\"update_order.php?id=".$myrow['id']."\"><img class=\"displayed\" alt=\"View\" src=\"images/edit.png\" width=\"175\" height=\"25\" /></a></center></TD>"; echo "</TR>"; $totmoney = $totmoney + (int)$myrow["Money"]; } } ?> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>TOTAL DUE</td> <td>&pound;<?=number_format($totmoney, 2);?>&nbsp;</td> <td></td> </tr> </table> <br /> <br /><br /> <?php } else { ?> <h3>Login To Your Account</h3> <form method="post" action="login.php"> <table cellspacing="10" cellpadding="10"> <tr> <td>Username</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password" /></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="Login To Your Account" /></td> </tr> </table> </form> <?php } ?> </div> <?php include ("styles/bottom.php"); ?> What im trying to do is use the below code <?php if( ($user_level == 1) ){ echo "<a href='admin.php'>Admin Panel</a> |"; } ?> i want to insert this code in to the above code so if user 1 logs in it shows the table above and if someone else logs in it will show something else just just a website link for example can anyone help me please?
  5. Hello Guys, Im trying to display my records in the database by the field PayDate field as i have all different dates and they are not in order for example 29/10/2024 and 27/10/2024 and 15/09/2024 im trying to display them all in order im using the code below can anyone help me please? <?php include('styles/top.php'); ?> <div id="full"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /><br /> <?php //error_reporting(0); if (($user_level !=1) && ($user_level !=2)){ echo "No Access Allowed"; } else { if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 1; } if($page == '' || $page == 1){ $page1 = 0; } else { $page1 = ($page*4)-4; } $sql = "SELECT * FROM orders Where orderby= '$username' AND Status='payon' LIMIT ".$page1.", 4"; //$sql = 'SELECT * FROM orders LIMIT '.$page1.', 4'; $data = $con->query($sql); ?> <h3>View Orders</h3> <table border=1"> <tr> <th>FULL NAME </th> <th>DATE GOT </th> <th>PAY DATE</th> <th>MONEY DUE</th> <th>UPDATE ORDER STATUS</th> </tr> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> <td></td> </tr> <?php $totmoney = 0; $strmoney = ""; while ($myrow = mysqli_fetch_array($data)) { $strmoney = $myrow["Money"]; $strmoney = str_replace(',','',$strmoney); if(is_numeric($strmoney)) { settype($strmoney, "float"); $strmoney = number_format($strmoney, 2); } echo "<TR><TD><a href=\"_view.php?id=".$myrow['id']."\">".$myrow["FullName"]."</A>&nbsp;</TD><TD>".$myrow["GotDate"]."&nbsp;</TD><TD>".$myrow["PayDate"]."&nbsp;</TD><TD>&pound;".$strmoney."&nbsp;</TD>"; echo "<TD><center><a href=\"edit_order.php?id=".$myrow['id']."\"><img class=\"displayed\" alt=\"View\" src=\"images/edit.png\" width=\"175\" height=\"25\" /></a></center></TD>"; echo "</TR>"; $totmoney = $totmoney + (int)$myrow["Money"]; } ?> <tr> <td>&nbsp;</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>TOTAL DUE</td> <td>&pound;<?=number_format($totmoney, 2);?>&nbsp;</td> <td></td> <td></td> </tr> </table> <br /> <?php $sql = "SELECT * FROM orders Where orderby= '$username' AND Status='Layon'"; $data = $con->query($sql); $records = $data->num_rows; $records_pages = $records/4; $records_pages = ceil($records_pages); $prev = $page-1; $next = $page+1; echo '<ul class="paganation">'; if($prev >= 5){ echo '<li><a href="?page=1">First Page</a></li>'; } if($prev >=1){ echo '<li><a href="?page='.$prev.'">Previous</a></li>'; } if($records_pages >= 2 ){ for($r=1; $r <= $records_pages; $r++){ $active = $r == $page ? 'class="active"' : ''; echo '<li><a href="?page='.$r.'" '.$active.'>'.$r.'</a></li>'; } } if($next <= $records_pages && $records_pages >= 2){ echo '<li><a href="?page='.$next.'">Next</a></li>'; } if($page != $records_pages && $records_pages >= 5){ echo '<li><a href="?page='.$records_pages.'">Last Page</a></li>'; } echo '</ul>'; ?> <?php } ?> </div> <?php include('styles/bottom.php'); ?>
×
×
  • 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.