Jump to content

ramiwahdan

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by ramiwahdan

  1. Hi, I have a video to play at the load of the page but I have a problem. autoplay is set and i don't want to start muted as i need the sound to be heard. The weird part is, if the page is loaded it won't start but if i moved to different page then go back to the main page, it will start the video with sound! <div align="center"> <video width="100%" height="25%" controls poster="img\thumb\overview.jpg" autoplay> <source src="vids\cs-cdi\overview.mp4"> </video> <br> <b>Featured Video from student to classmates - G12A1 - CDI</b> </div> Please help.
  2. Hi, I have made picture slideshow and included many pictures for the slideshow but i also added a video, how to make it apear as it is not appearing. code: <?php //index.php $connect = mysqli_connect("dbhost", "dbuser", "dbpassword", "dbname"); function make_query($connect) { $query = "SELECT * FROM banner ORDER BY banner_id ASC"; $result = mysqli_query($connect, $query); return $result; } function make_slide_indicators($connect) { $output = ''; $count = 0; $result = make_query($connect); while($row = mysqli_fetch_array($result)) { if($count == 0) { $output .= ' <li data-target="#dynamic_slide_show" data-slide-to="'.$count.'" class="active"></li> '; } else { $output .= ' <li data-target="#dynamic_slide_show" data-slide-to="'.$count.'"></li> '; } $count = $count + 1; } return $output; } function make_slides($connect) { $output = ''; $count = 0; $result = make_query($connect); while($row = mysqli_fetch_array($result)) { if($count == 0) { $output .= '<div class="item active">'; } else { $output .= '<div class="item">'; } $output .= ' <img src="banner/'.$row["banner_image"].'" alt="'.$row["banner_title"].'" /> <div class="carousel-caption"> <h3>'.$row["banner_title"].'</h3> </div> </div> '; $count = $count + 1; } return $output; } ?> <!DOCTYPE html> <html> <head> <title>How to Make Dynamic Bootstrap Carousel with PHP</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <br /> <div class="container"> <h2 align="center">How to Make Dynamic Bootstrap Carousel with PHP</h2> <br /> <div id="dynamic_slide_show" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <?php echo make_slide_indicators($connect); ?> </ol> <div class="carousel-inner"> <?php echo make_slides($connect); ?> </div> <a class="left carousel-control" href="#dynamic_slide_show" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#dynamic_slide_show" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div> </div> </body> </html> in the database i have the names of the photos from 1 to 5 then a video. The photos are shown but the video is not showing. Is there a way to include it in the slideshow? If not, is it possible to have a video player instead. Thanks.
  3. Hi, I am trying to fill the boxes of flag shape with colors. Is it possible in python terminal? here is the code: print(" _____________________________________________________") print(" | | |") print(" | | |") print(" | | |") print(" | |_________________________________________|") print(" | | |") print(" | | |") print(" | | |") print(" | |_________________________________________|") print(" | | |") print(" | | |") print(" | | |") print(" |_________|_________________________________________|") the left is red, top green, middle is same (white) and bottom is black.
  4. or if i can just click the image as the one you have above then it can save it as image or print it. Thanks.
  5. Thanks it works now, if i right click on the image to save then it saves as html not image. is there a way to add a button under the image to download the certificate or print it?
  6. i need to get the name in arabic but connected together and inside the certificate which should be شهد
  7. Thanks, When i put this in image it gives me your code instead of name: $name = strtoupper($_POST['name']); $name_len = strlen($_POST['name']); $im= "<svg width='500' height='100'> <rect x='1' y='1' width='499' height='99' style='fill:#000; stroke:#000' /> <text x='20' y='60' style='font-family:calibri; font-size:30pt; fill:#FFF;'>$name</text> </svg> "; $certificate_text = $im; //function to display name on certificate picture $text1 = imagettftext($createimage, $font_size, $rotation, $origin_x, $origin_y, $black, 'c:/windows/fonts/calibri.ttf', $certificate_text); i am getting the code for $im instead! I need to get the name there.
  8. Thanks but as you can see the letters are not connected with each other.
  9. Hi, I am generating certificates in php i can display the name in arabic but it will not print on the certicate. It can show the English names though! is there a special code to be able to show that? code: <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <title>Certificate Generator</title> </head> <body> <center> <br><br><br> <h3>Certificate Generator</h3> <br><br><br><br> <form method="post" action=""> <div class="form-group col-sm-6"> <input type="text" name="name" class="form-control" id="name" placeholder="Enter Name Here..."> </div> <button type="submit" name="generate" class="btn btn-primary">Generate</button> </form> <br> <?php if (isset($_POST['generate'])) { $name = strtoupper($_POST['name']); $name_len = strlen($_POST['name']); if ($name == "" ) { echo " <div class='alert alert-danger col-sm-6' role='alert'> Ensure you fill all the fields! </div> "; }else{ echo " <div class='alert alert-success col-sm-6' role='alert'> Congratulations! $name on your excellent success. </div> "; //designed certificate picture $image = "certi.png"; $createimage = imagecreatefrompng($image); //this is going to be created once the generate button is clicked $output = "certificate.png"; //then we make use of the imagecolorallocate inbuilt php function which i used to set color to the text we are displaying on the image in RGB format $white = imagecolorallocate($createimage, 205, 245, 255); $black = imagecolorallocate($createimage, 0, 0, 0); //Then we make use of the angle since we will also make use of it when calling the imagettftext function below $rotation = 0; //we then set the x and y axis to fix the position of our text name $origin_x = 200; $origin_y=240; //we then set the x and y axis to fix the position of our text occupation $origin1_x = 120; $origin1_y=90; //we then set the differnet size range based on the lenght of the text which we have declared when we called values from the form if($name_len<=7){ $font_size = 25; $origin_x = 190; } elseif($name_len<=12){ $font_size = 30; } elseif($name_len<=15){ $font_size = 26; } elseif($name_len<=20){ $font_size = 18; } elseif($name_len<=22){ $font_size = 15; } elseif($name_len<=33){ $font_size=11; } else { $font_size =10; } $certificate_text = $name; //font directory for name $drFont = dirname(__FILE__)."/developer.ttf"; //function to display name on certificate picture $text1 = imagettftext($createimage, $font_size, $rotation, $origin_x, $origin_y, $black,$drFont, $certificate_text); imagepng($createimage,$output,3); ?> <!-- this displays the image below --> <img src="<?php echo $output; ?>"> <br> <br> <!-- this provides a download button --> <a href="<?php echo $output; ?>" class="btn btn-success">Download My Internship Certificate</a> <br><br> <?php } } ?> </center> <footer> <center><p>Built with &#10084; by <a href="https://olawanlejoel.github.io/portfolio/">Olawanle Joel</a></p></center> </footer> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> </body> </html>
  10. is there a way to do this without a cron job or is there cron jobs running xampp server?
  11. Hi, In my attendance system i want to add email alert using php. I want the system to check the records in my db and send email to everyone that forgot to clock-in after 7:30AM from Sunday to Thursday. What i need to use for this, ideas?
  12. Hi, when i try to insert to table date value it gives me wrong current date. $joindate = date('m-d-Y'); $sql = mysqli_query($con,"INSERT INTO staff (OracleID,StaffName,Des,joindate,username,password,isadmin) VALUES ('$oracleid','$name','$des','$joindate','$username', '$pass','$isadmin')"); i get this in the main page after making date("d-m-Y",strtotime(date)) 30-11--0001 why is that?
  13. got it, <form action="deletestaff.php?GetID=<?php echo $userid?>" method="post"> Thanks for the big help
  14. after running the function how to redirect to my deletestaff.php?id=???
  15. thanks for the help. your function will return Boolean of true or false. After i get the answer how to delete the records? before i had: <td><a href="deletestaff.php?GetID=<?php echo $userid?>">Delete</a></td> with your code i have: <td><button class="btn btn-primary" name="delete" onclick="return confirmDelete()">Delete</button></td> so after the function confirms yes for both, how to pass the link href="deletestaff.php?GetID=<?php echo $userid?>" thanks
  16. is there a way to do this by php only? I read about JS but i didn't use it before. You can point to easy tutorial to do it with JS if not possible in php.
  17. Hi, i have delete link for records and it goes to other page to delete all related records in tables. is there away to get confirmation before the delete process starts? <?Php include('session.php'); include('dbcon.php'); if(isset($_GET['Del'])) { $userid = $_GET['Del']; $query = "delete from staff where OracleID='".$userid."'"; $result = mysqli_query($con,$query); if($result) { echo "staff deleted"; } else { echo 'check the errors!'; } $query2 = "delete from attendance_records where OracleID='".$userid."'"; $result2 = mysqli_query($con,$query2); if($result2) { echo "records deleted"; } else { echo 'check the errors!'; } header("location:viewstaff.php"); } else { header("location:viewstaff.php"); } ?> how to add confirm message with php before deletion is processed?
  18. structure and data of my tables i am working with now. there are some fields i am not using now but included in the php file.
  19. there is option in the db if the staff no longer in the company to delete his staff records and will no longer be considered in the attendance system.
  20. right now what i can do, click a link for each staff to generate that pdf file. what if i have 100 staff members, I don't want to click on all of them so i want to generate one pdf file for all of them.
  21. yes it downloads the file instead of asking to download. I am done for today, I will resume tomorrow. Thanks
  22. i just need to know the concept. If i need all records why will i need to pass the dates? I will then still use a link for each staff as you mention here. Is there a way or video demonstrate how to make separate fpdf file and php file and make them work together with a loop if no one can help. I did paste my full code so you can get better idea what i am doing. I am getting totals for each staff then want all of them to be printed in one report file. i dont want to use one line for each staff. how to make a continuous pdf from the file made. right now each staff will have 2 pages one for attendance and one for absent, how to go to pages 3,4 with new staff and so on...
  23. i really am struggling with this, I just need to know if i am not passing anything to the fpdf functions how to pass all information to it? if i put the fpdf included in the php, the page is blank! can someone help? php: <?Php include('session.php'); include('dbcon.php'); ?> <html> <head> <link rel="stylesheet" type="text/css" href="bootstrap.css"> </head> <body> <div class="container"> <div class="row"> <div class="col m-auto"> <div class="card mt-5"> <table class="table table-bordered"> <?php $servername = "localhost"; $username = "?"; $password = "?"; $conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $res = $conn->query("SELECT oracleid , name , des , theday , clockingindate as clockin , permissionoutdate as perout , permissionindate as perin , clockingoutdate as clockout , fullday , reason , timediff(permissionindate,permissionoutdate ) as perduration , timediff(clockingoutdate, clockingindate) as duration , total , total2 FROM attendance_records JOIN ( SELECT oracleid , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total , sec_to_time(sum(timestampdiff(SECOND, permissionoutdate, permissionindate))) as total2 FROM attendance_records where isdone =-1 GROUP BY oracleid ) tots USING (oracleid) where isdone =-1 ORDER BY oracleid, clockingindate "); ?> <?php $t=time(); $curdate = date("d-m-Y",$t); $curTime = date("g:i:s A",$t); $arr = array(); $previd = 0; $previd2 = 0; foreach ($res as $row) { if ($row['oracleid'] != $previd) { // id changed so output total if ($previd != 0) { $theid = $row['oracleid']; echo "<tr><td colspan='6'></td><td>Total Permission Time:</td><td>$total2</td></tr>"; echo '<tr>'; echo "<tr><td colspan='7'><h3><a href='fpdf.php?oracleid=$userid&sdate=$thefirstday&edate=$curdate' target='_blank'>Print Attendance Reports for $name</a></h3></td><td>Total Attendance Time:</td><td>$total</td></tr>"; echo "<tr><td colspan='9' bgcolor='red'></td>"; echo "<tr><td colspan='9' bgcolor='red'></td>"; $previd2 = $row['oracleid']; array_push($arr,$previd2); $qry = "select joindate from staff where OracleID = '".$theid."'"; $answ = mysqli_query($con, $qry); $rowanswer = mysqli_fetch_assoc($answ); $thejoindate = date("d-m-Y",strtotime($rowanswer['joindate'])); echo " <tr> <td>OracleID</td> <td>{$row['oracleid']}</td> <td>Name</td> <td>{$row['name']}</td> <td>Designation</td> <td>{$row['des']}</td> <td>Joining Date</td> <td>{$thejoindate}</td> </tr> "; $userid = $row['oracleid']; } else{ $userid = $row['oracleid']; $qry = "select joindate from staff where OracleID = '$userid'"; $answ = mysqli_query($con, $qry); $rowanswer = mysqli_fetch_assoc($answ); $thefirstday = $rowanswer['joindate']; $thefirstday2 = date("d-m-Y",strtotime($rowanswer['joindate'])); $thejoindate = date("d-m-Y",strtotime($rowanswer['joindate'])); $previd2 = $row['oracleid']; array_push($arr,$previd2); echo " <tr> <td>OracleID</td> <td>{$row['oracleid']}</td> <td>Name</td> <td>{$row['name']}</td> <td>Designation</td> <td>{$row['des']}</td> <td>Joining Date</td> <td>{$thejoindate}</td> </tr> "; } $previd = $row['oracleid']; $name = $row['name']; } $fullday = $row['fullday']; $perindate = $row['perin']; $perduration = $row['perduration']; $peroutdate = $row['perout']; if ($peroutdate != Null) { if ($fullday == -1) { $fullday = "Yes"; if ($perindate == Null) { $perindate = "All Day"; } if ($perduration == Null) { $perduration = "All Day"; } } else { $fullday = "No"; } } else{ $fullday = Null; $perindate = Null; $perduration = Null; } ?> <th colspan='9'></th> <?php echo " <tr> <td>Day</td> <td>Clocking In</td> <td>Permission Out</td> <td>Full Day?</td> <td>Permission Reason</td> <td>Permission In</td> <td>Clocking Out</td> <td>Permission Duration</td> <td>Normal Duration</td> </tr> <tr> <td>{$row['theday']}</td> <td>{$row['clockin']}</td> <td>{$row['perout']}</td> <td>{$fullday}</td> <td>{$row['reason']}</td> <td>{$perindate}</td> <td>{$row['clockout']}</td> <td>{$perduration}</td> <td>{$row['duration']}</td> </tr> "; $total = $row['total']; $total2 = $row['total2']; if ($perduration == "All Day") { if ($total2 == Null) { $total2 = "All Day"; } } } echo "<tr><td colspan='4'</td><td><td><td>Total Permission Time:</td></td></td><td>$total2</td></tr>"; echo '<tr>'; echo "<tr><td colspan='7'><h3><a href='fpdf.php?oracleid=$userid&sdate=$thefirstday&edate=$curdate' target='_blank'>Print Attendance Reports for $name</a></h3></td><td>Total Attendance Time:</td><td>$total</td></tr>"; echo "</td></tr>"; $ids = join("','",$arr); $qry = "select OracleID, StaffName,joindate from staff WHERE OracleID NOT IN ('$ids')"; $answ = mysqli_query($con, $qry); while ($row2 = mysqli_fetch_assoc($answ)) { $thestaffname = $row2['StaffName']; $absentstaff = $row2['OracleID']; $absentstaffjoined = $row2['joindate']; echo "<tr><td colspan='9' bgcolor='red'></td>"; echo "<tr><td colspan='9' bgcolor='red'></td>"; echo "<tr>"; echo "<td colspan='7'><h3><a href='fpdf.php?oracleid=$absentstaff&sdate=$absentstaffjoined&edate=$curdate' target='_blank'>Print Attendance Reports for $thestaffname</a></h3></td>"; echo "</tr>"; } ?> </table> <a href="viewreports.php" width="100%">Click here to go back to Main Menu</a> </div> </div> </div> </div> </body> </html> and fpdf: <?php require('fpdf/fpdf.php'); // ADD YOUR OWN PDO CONNECTION CODE // $servername = "localhost"; $username = "??"; $password = "??"; $conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); class attendPDF extends FPDF { protected $today; protected $headbase; protected $conn; protected $oracleid; protected $staffname; protected $sdate; protected $edate; //constructor public function __construct($conn, $oracleid, $sdate, $edate) { parent::__construct(); $this->today = date('jS M Y'); $this->db = $conn; $this->oracleid = $oracleid; $this->sdate = new DateTime($sdate); $this->edate = new DateTime($edate); $res = $this->db->prepare("SELECT staffname FROM staff WHERE oracleid = ? "); $res->execute([$oracleid]); $this->staffname = $res->fetchColumn(); } //Page header public function Header() { //Helvetica bold 12 $this->Image('./img/bg.png',-20,-2,210); $this->SetFont('Helvetica', '', 14); $this->Cell(0, 20, "Attendance Report", 0, 1, 'C'); //Title $sd = $this->sdate->format('l jS F Y'); $ed = $this->edate->format('l jS F Y'); $this->SetFont('Helvetica', '', 12); $this->Cell(60,15,$this->oracleid . ' - ' . $this->staffname,1,0,'L'); $this->Cell(120, 15, "$sd - $ed" , 1, 0, 'C') ; $this->Ln(); $this->headbase = $this->GetY(); } //Page footer public function Footer() { $this->setY(-22); $this->setX(15); $this->SetFont('Helvetica', '', 10); $this->Cell(0,5,'( '.$this->today.' )', 'T'); } public function attendanceReport() { $widths = [60, 60, 60]; $aligns = [ 'L', 'L', 'C' ]; $heads = ['Clocked In Time', 'Clocked Out Time', 'Duration']; $this->SetY(50); $this->SetFont('Helvetica', 'B', 12); $this->Cell(0, 10, 'Attendances', 0, 1); $this->SetFontSize(10); foreach ($heads as $k => $h) { $this->Cell($widths[$k], 10, $h, 1, 0, $aligns[$k], 1); } $this->Ln(); $this->setFont('', ''); $res = $this->db->prepare("SELECT date_format(clockingindate, '%a %d/%m/%Y %l:%i %p') as clkin , date_format(clockingoutdate, '%a %d/%m/%Y %l:%i %p') as clkout , timediff(clockingoutdate, clockingindate) as duration FROM attendance_records WHERE oracleid = ? AND DATE(clockingindate) BETWEEN ? AND ? ORDER BY clockingindate "); $res->execute([ $this->oracleid, $this->sdate->format('Y-m-d'), $this->edate->format('Y-m-d') ] ); while ( $r = $res->fetch(PDO::FETCH_NUM) ) { foreach ($r as $k => $v) { $this->Cell($widths[$k], 6, $v, 0, 0, $aligns[$k]); } $this->Ln(); } } public function absenceReport() { $this->SetY(50); $this->SetFont('Helvetica', 'B', 12); $this->Cell(0, 10, 'Absences', 0, 1); $this->SetFontSize(15); $this->Cell(0, 10, 'Dates Absent', 1, 0, 'L', 1); $this->setFont('', ''); $this->Ln(); // set up a temporary date table - each working day in the reporting period $this->db->exec("CREATE TEMPORARY TABLE date(date date)"); $incr = DateInterval::createFromDateString('next weekday'); $sd = clone $this->sdate; $ed = clone $this->edate; $sd->modify('+1 days'); // adjust for Islamic working week $ed->modify('+2 days'); // adjust for Islamic working week $range = new DatePeriod($sd, $incr, $ed); foreach ($range as $d) { $dt = $d->sub(new DateInterval('P1D'))->format('Y-m-d'); // adjust for Islamic working week $dates[] = "('$dt')"; } $this->db->exec("INSERT INTO date VALUES " . join(',', $dates)); // get days absent $res = $this->db->prepare("SELECT DATE_FORMAT(date, '%W %d/%m/%Y' ) as date FROM staff s CROSS JOIN date d LEFT JOIN attendance_records a ON s.oracleid = a.oracleid AND d.date = DATE(a.clockingindate) WHERE s.oracleid = ? AND a.oracleid IS NULL "); $res->execute( [ $this->oracleid ] ); foreach ($res as $r) { $this->Cell(0, 10, $r['date'], 0, 1); } } }# end class if (!isset($_GET['oracleid']) || !isset($_GET['sdate']) || !isset($_GET['edate'])) { exit; } // // GENERATE REPORT // $pdf = new attendPDF($conn, $_GET['oracleid'], $_GET['sdate'], $_GET['edate']); $pdf->AliasNbPages(); $pdf->setAutoPageBreak(1,25); $pdf->setMargins(15,15,15); $pdf->SetDrawColor(102); $pdf->SetFillColor(220); $pdf->AddPage(); $pdf->attendanceReport(); $pdf->AddPage(); $pdf->absenceReport(); $pdf->output('D','filename.pdf'); ?> where i can modify the code so that it will take all to one pdf file page?
×
×
  • 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.