Jump to content

Search the Community

Showing results for tags 'html'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. So I am creating a small file manager to manage uploaded files into a certain directory on my sever. I have created the attached code, but the issue is that when I click the download button, the webpage (html file) itself gets downloaded instead of the file in the directory that is supposed to be downloaded. Please note that there is no upload file type restrictions, so there are any file type you can imagine in this directory. I can't recognize the error in my code. Any help will be highly appreciated and that you in advance <html> <head> <title>My first PHP Page</title> </head> <body> <table border="1"> <?php $dir = 'uploads'; $files = scandir($dir); sort($files); $count = -1 ; foreach ($files as $file) { $v_download = "download_".$count; $v_delete = "delete_".$count; $v_rename = "rename_".$count; $fileName = $file; if ($file != '.' && $file != '..') { echo "<tr>"; echo "<td>"; echo $count; echo "</td>"; echo "<td>"; echo $file; echo "</td>"; echo "<td>"; echo "<form action='' method='post'><input type='submit' value='Download' name='".$v_download."'/></form>"; if(isset($_POST[$v_download])) { $filename = $_POST[$file]; header('Content-type: '.filetype($filename).'/'.pathinfo($filename, PATHINFO_EXTENSION)); header('Content-Disposition: attachment; filename="'.$filename.'"'); readfile('uploads/'.$filename); exit(); } echo "</td>"; echo "<td>"; echo "<form action='' method='post'><input type='submit' value='Delete' name='".$v_delete."'/></form>"; if(isset($_POST[$v_delete])) { // Your php delete code here echo "delete file : ".$file; } echo "</td>"; echo "<td>"; echo "<form action='' method='post'><input type='submit' value='Rename' name='".$v_rename."'/></form>"; if(isset($_POST[$v_rename])) { // Your php rename code here echo "rename file : ".$file; } echo "</td>"; echo "</tr>"; } $count++; } ?> </table> </body> </html> list.html
  2. Hi, I have forgotpass.php code. But I dont have a forgotpass.html code. I tray somethink but it's not working. I need cust html code, for the this php code. Thank you and regards. <? include("header.php"); $error = $diplay = ""; if(isset($_POST['sendmepass'])) { $mem_email = $affiliater->GetEmailByUsername($_POST['affiliatername']); if ($mem_email != "") { $newpass = generatePassword(); $affiliater->ReminderPassword($_POST['affiliatername'], $newpass); //Send mail $to = $mem_email; $subject = 'Password Reminder'; $body = str_replace("{USERNAME}", $_POST['affiliatername'], FORGOTMAILDETAIL); $body = str_replace("{NEWPASSWORD}", $newpass, $body); $headers = "Content-Type: text/html; charset=iso-8859-1\n"; mail($to, $subject, $body, $headers); $error = "Your password will be e-mailed to you at the e-mail address you registered with the system! Please check it to recovery your password"; $diplay = "style='display: none;'"; }else $error = "User inactive or not exists! Please type exactly affiliatername which you used to registry"; } $template->set_filenames(array("body" => "forgotpass.html")); $template->assign_vars(array( 'ERROR' => $error, 'DIPLAY' => $diplay, 'USERNAME'=> "Username", )); $template->pparse("body"); include("footer.php"); ?>
  3. Hello PHP freak members I learn how to ecrypt my password using the blow fish method but I'm having trouble decypting the password. Is there anyone that can over see the problem that I'm having? Sample ecrypted password > $2y$09$Q5klufp7bj6iuBA3dHpz5.fLN1sLzeGKE7nuXKunLMKKvE.rZtSTW Original password > 1234 <?php error_reporting(E_ALL & ~E_NOTICE); session_start(); if(isset ($_SESSION['id'])){ header('location: profile.php'); } else { if($_POST['submit']){ include "connect_prompt/connect_query.php"; $email = mysqli_real_escape_string($db_conx,$_POST['email']); $password_one = $_POST['password_one']; ///////////////// Blow Fish /////////////////////////////////// function cryptPass($input, $rounds = 9){ $salt = ""; $saltChars = array_merge(range('A','Z'),range('a','z'),range(0,9)); for($i = 0; $i < 22; $i++){ $salt .= $saltChars[array_rand($saltChars)]; } return crypt($input, sprintf('$2y$%02d$', $rounds) . $salt); } $password_one = $_POST['password_one']; $password = $_POST['password']; $hashedPass = cryptPass($password); if(crypt($password_one, $hashedPass) == $hashedPass){ ///////////////// Blow Fish /////////////////////////////////// $sql = "SELECT id, email, password FROM customer WHERE email='$email' AND password='$password_one' LIMIT 1"; $query = mysqli_query ($db_conx, $sql); if($query){ $row = mysqli_fetch_row($query); $userID = $row[0]; $db_email = $row[1]; $db_password = $row[2]; } if($email == $db_email && $password_one == $db_password){ $_SESSION['email'] = $email; $_SESSION['id'] = $userID; header("location: profile.php"); } else { echo "Sorry, Username or Password was incorrect"; } } } } ?> <form action="login.php" method="POST"> <input type="email" name="email" id="email" placeholder=" your@email.com" /> <br/><br/> <input type="password" name="password_one" id="password_one" placeholder=" ********" /> <br/><br/> <input type="submit" name="submit" value="SIGN IN" /> </form>
  4. this is tricky to explain: I have a raw php script, written by someone else, that sends an email to a list extracted from a CSV file. It requires that certain values in the file be manually edited each time it's used, such as the following: $mail->setFrom('email@email.com', 'From Name'); // <==== change email address, From Name $subject = "Subject Line"; // <==== Adjust this subject $html = ' html here '; // <==== include email html MagicParser_parse("test.csv","myRecordHandler","csv|44|1|34"); // <==== change 'test.csv' file name the function is called by simply calling this email.php file in the browser. I'd like to build a form that would a) edit these values/strings on the fly and then b) call the file in the browser. The thing is, it's been a while since I've messed with PHP forms to any extent, and I can't remember how to get started on something like this. And I'm not familiar at all with fopen and fwrite to edit strings like this without messing up the existing code (there's a lot of other code in the file that needs to be left alone, obviously). I'm hoping someone can help me with a starting point - an idea on how to get this thing going - whether to build the form right in the same file or to build one in another file that posts these values to this existing file... hopefully someone can understand what I'm asking, and thank you much for your help. regards, glenn
  5. <?php $host= "localhost"; $username="root"; $password="root"; $db_name= "test2.0"; $tbl_name="permohonan"; mysql_connect("$host","$username","$password")or die ("cannot connect"); mysql_select_db ("$db_name")or die("cannot select DB"); if(isset($_POST['submit'])) { $Jabatan = mysql_real_escape_string($_POST['Jabatan']); $unit = mysql_real_escape_string($_POST['unit']); $lain2 = mysql_real_escape_string($_POST['lain2']); $nama_pemohon = mysql_real_escape_string($_POST['nama_pemohon']); $destinasi = mysql_real_escape_string($_POST['destinasi']); $tujuan = mysql_real_escape_string($_POST['tujuan']); $maklumat_ = mysql_real_escape_string($_POST['maklumat_']); $datedepart_= mysql_real_escape_string($_POST['datedepart_']); $timedepart_= mysql_real_escape_string($_POST['timedepart_']); $datearrive_ = mysql_real_escape_string($_POST['datearrive_']); $timearrive_ = mysql_real_escape_string($_POST['timearrive_']); $query1 = mysql_query("INSERT INTO permohonan VALUES(NULL,'$Jabatan','$unit','$lain2','$nama_pemohon','$destinasi','$tujuan','$maklumat_','$datedepart_','$timedepart_,'$datearrive_',$timearrive_')"); if($query1) { header("location : reservationform.php"); } } ?>
  6. I've got an HTML 5 date input box working on my site. Anyone know how to make the whole thing selectable like a drop down (select) box? Currently you can only select it by clicking on the arrow at the far right of it. I don't mind about losing the cross or up and down arrows. I just want the field to be fully selectable like a drop down box. Any ideas please? Thanks.
  7. Hello there, my name is Ryan. I am a Web Developer from England that specialises in creating mobile-responsive websites. Whether you need a website that takes monthly payments, one-off purchases or runs ads I will take your idea and craft an elegant solution. Skills - PHP HTML5 CSS Javascript I have built user-interfaces and backend database systems, in my 10 years of web development there is little I haven't touched upon. If you are interested in my services you can contact me at: Email ryansocratous@gmail.com Skype ryanify Thank you.
  8. Hi all, I have some data in a table to do with 20 users appointments every day for a month. I am trying to organise the appointments in to a large table so the clients can see all the appointments of every colleague by date (in columns) and by user name (in rows). for example: 20th May | 21st May | 22nd May | 23rd May Mike Jones London, Paris | Paris, Rome | Rome, London | London, New York 06:15 - 10:15 | 08:20 - 14:00 | 03:30-05:30 | 05:25-09:30 ----------------------------------------------------------------------------------------------------------------------------------------- Bethan Cray OFF | Belfast, Madrid | Madrid, Fez | Fez, Athens 11:15 - 16:35 | 08:45 - 12:10 | 13:55-15:30 | 09:25-13:20 The data is currently stored in the mysql table such as below, and has over 40 users with over 30 rows each in the same format. SectorDate Code BeginTime Dep Arr EndTime 2016-05-20 Mike Jones 06:15 London Paris 10:15 2016-05-21 Mike Jones 08:20 Paris Rome 14:00 2016-05-20 Bethan Cray 11:15 OFF 16:35 Please can someone show how best to arrange the mysql database to give the output above! Thanks
  9. I can't figure out how to make this script (twitch(dot)tv) to show only online/live channels not all... Here is Javascript (function () { 'use strict'; angular .module('twitch', []) .controller('TwitchCtrl', TwitchCtrl); function TwitchCtrl($http, $scope) { $scope.streams=[]; var apiEndPoint = 'https://api.twitch.tv/kraken/streams/'; var streamers = ['Chizijs','tornis', 'elveeftw', 'piecits', 'lobosjr', 'fattypillow']; var apiSuccess = function(response, streamer){ console.log(response); var stream = response.data; stream.Name = streamer; var offline = stream.stream === null if(offline){ stream.stream = {game: 'offlines', channel:{ 'logo': '' }}; $scope.streams.push(stream); } else{ $scope.streams.unshift(stream); } console.log(stream); }; var apiError = function(response, streamer){ console.log(response); if(response.status === 422){ var stream = response.data; stream.Name = streamer; stream.stream = {game: 'Account Closed', channel:{ 'logo': ''}}; console.log(stream); $scope.streams.push(stream); } }; var setupSuccess = function(streamer){ return function(response){ return apiSuccess(response, streamer); }; }; var setupError = function(streamer){ return function(response){ return apiError(response, streamer); }; }; for(var i = 0; i < streamers.length; i++){ var onSuccess = setupSuccess(streamers[i]); var onError = setupError(streamers[i]); $http({url: apiEndPoint + streamers[i], method:'GET'}) .then(onSuccess, onError); } } })();
  10. Hello im new to PHP and i have problems getting PHP working for my websites contac form Here the HTML form code <form action="" method="post"> <div class="form_settings"> <p><span>Name</span><input class="contact" type="text" name="your_name" value="" /></p> <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="" /></p> <p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="your_enquiry"></textarea></p> <p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p> </div> </form> Heres the PHP code <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'example@gmail.com'; $subject = 'Message from '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Sent'); window.location = 'kontakt.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Error'); window.location = 'kontakt.html'; </script> <?php } ?> I would be really thankful if someone could fix the PHP code for me and make it work with the html above.
  11. Hello! I hope someone can help me with an issue I'm having. Recently, I have had an issue displaying my banner on my website, which is has a .php file source. I have had any known changes to my php version (currently on 5.6, and considering to switch to 7.0); also, I am hosted through Dreamhost. If someone could look at the following code and offer any advice, I'd be greatly appreciative! My link on the design: <img src= "http://hayalkarga.com/theme/10/images/banner/banner.php" alt= "" /> The Image Code: <?php $dir = ''; $file = ''; $num = 0; $count = 0; $array = array(); $allowedExtensions = array('jpeg', 'jpe', 'jpg', 'gif', 'png', 'bmp'); mt_srand((double)microtime()*1000000); $dir = opendir('.'); while (false !== ($file = readdir($dir))) { if(!is_dir($file) && in_array(strtolower(substr(strrchr($file,'.'), 1)), $allowedExtensions)){ $array[] = $file; } } $count = count($array); $num = mt_rand(0, $count-1); if($count > 0) { $size = getimagesize($array[$num]); $stream = fopen($array[$num], 'rb'); if(is_array($size) && $stream !== false){ header('Content-type: '.$size['mime']); fpassthru($stream); exit(); } } else { echo 'Error: No Images'; } ?> I should note that the image works in my browser at http://www.hayalkarga.com/theme/10/images/banner/banner.php, but does not incorporate into the design when utilizing the link in HTML. Thank you in advance!
  12. Hi, I have the following code for playing a video on my page. The problem is that the video works good on desktop browsers, but on desktop safari and mobile browsers it displays me only the cover image not playing the video. I've tried a couple of solutions but none of them seems to be working for me. <video autoplay class="embed-responsive-item" poster="videos/cover.jpg"> <source src="videos/landing_page_video_vimeo5_converted.mp4" type="video/mp4"> <source src="videos/landing page video vimeo5.ogg" type="video/ogg"> <source src="videos/landing page video vimeo5.ogg" type="video/webm"> </video>
  13. Hello, I'm having a bit of trouble interpolating Bootstrap HTML from database rows. It's coming out kind of right, but I have font-awesome flags popping up everywhere, and my footer doesn't stretch the entire screen. Kind of like a div isn't being closed. I'd appreciate any help offered. Every three items is a row. There are three columns per row. PHP CODE foreach($retrievedListings as $key => $val) { if($key === 0) { echo '<div class="row"> <div class="col-lg-4"> <div class="column-1"> <h4 style="color:darkblue;"><i style="color:yellow;" class="fa fa-star"></i> '.htmlentities($retrievedListings[$key]['title']).'</h4> <p>By <strong>'.$retrievedListings[$key]['username'].'</strong><br/> '.htmlentities($retrievedListings[$key]['intro']).'</p> <p class="word"><i class="fa fa-flag flag-button"></i>'; $tagsArr = explode(',', $retrievedListings[$key]['tags']); foreach($tagsArr as $tag) { echo '<span class="label label-default label-buffer"><a>'.htmlentities($tag).'</a></span>'; } echo '</p> </div> </div>'; }elseif($key % 3 != 0) { echo '<div class="col-lg-4"> <div class="column-1"> <h4 style="color:darkblue;"><i style="color:yellow;" class="fa fa-star"></i> '.htmlentities($retrievedListings[$key]['title']).'</h4> <p>By <strong>'.$retrievedListings[$key]['username'].'</strong><br/> '.$retrievedListings[$key]['intro'].'</p> <p class="word"><i class="fa fa-flag flag-button">'; $tagsArr = explode(',', $retrievedListings[$key]['tags']); foreach($tagsArr as $tag) { echo '<span class="label label-default label-buffer"><a>'.htmlentities($tag).'</a></span>'; } echo '</p> </div> </div>'; }else{ echo '</div> <div class="row"> <div class="col-lg-4"> <div class="column-1"> <h4>'.htmlentities($retrievedListings[$key]['title']).'</h4> <p>By <strong>'.$retrievedListings[$key]['username'].'</strong> <br/> '.htmlentities($retrievedListings[$key]['intro']).'</p> <p class="word"><strong>Tags :</strong> <span>One,Two,Three</span></p> </div> </div>'; } } What I'm trying to interpolate: <div class="row"> <div class="col-lg-4"> <div class="column-1"> <h4 style="color:darkblue;"><i style="color:yellow;" class="fa fa-star"></i> Lorem Ipsum</h4> <p>By <strong>Ipsum is simply</strong><br/> dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.</p> <p class="word"><i class="fa fa-flag flag-button"></i><span class="label label-default label-buffer">playstation 4</span> <span class="label label-default label-buffer">playstation 4</span><span class="label label-default label-buffer">playstation 4</span> </p> </div> </div> <div class="col-lg-4"> <div class="column-1"> <h4 style="color:darkblue;"><i style="color:yellow;" class="fa fa-star"></i> Lorem Ipsum</h4> <p>By <strong>Ipsum is simply</strong><br/> dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.</p> <p class="word"><i class="fa fa-flag flag-button"></i><span class="label label-default label-buffer">playstation 4</span> <span class="label label-default label-buffer">playstation 4</span><span class="label label-default label-buffer">playstation 4</span> </p> </div> </div> <div class="col-lg-4"> <div class="column-1"> <h4 style="color:darkblue;"><i style="color:yellow;" class="fa fa-star"></i> Lorem Ipsum</h4> <p>By <strong>Ipsum is simply</strong><br/> dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.</p> <p class="word"><i class="fa fa-flag flag-button"></i><span class="label label-default label-buffer">playstation 4</span> <span class="label label-default label-buffer">playstation 4</span><span class="label label-default label-buffer">playstation 4</span> </p> </div> </div> </div> Thanks, Jeremy.
  14. <?php include_once("init.php"); // Use session variable on this page. This function must put on the top of page. if(!isset($_SESSION['username']) || $_SESSION['usertype'] != 'admin'){ // if session variable "username" does not exist. header("location: index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php } else { error_reporting(0); if(isset($_GET['sid'])) { echo $_GET['sid']; ?><!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=iso-8859-1"/> <title>Simple invoice in PHP</title> <style type="text/css"> body { font-family: Verdana;; } div.invoice { border:1px solid #ccc; padding:10px; height:740pt; width:570pt; } div.company-address { border:1px solid #ccc; float:left; width:200pt; } div.invoice-details { border:1px solid #ccc; float:right; width:200pt; } div.customer-address { border:1px solid #ccc; float:right; margin-bottom:50px; margin-top:100px; width:200pt; } div.clear-fix { clear:both; float:none; } table { width:100%; } th { text-align: left; } td { } .text-left { text-align:left; } .text-center { text-align:center; } .text-right { text-align:right; } </style> </head> <body> <div class="invoice"> <div class="company-address"> <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); echo $phpdate; ?><?php echo $sid; ?> <?php $line4 = $db->queryUniqueObject("SELECT * FROM store_details "); ?> <?php echo $line4->name; ?> <br /> <?php echo $line4->address; ?>,<?php echo $line4->place; ?> <br /> LPhone <strong>:<?php echo $line4->phone; ?></strong> <br /> </div> <div class="invoice-details"> Invoice no : <?php echo $sid;?> <br /> Date: <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); echo $phpdate; ?> </div> <div class="customer-address"> To: <br /> <?php echo $line->customer_id; $cname = $line->customer_id; $line2 = $db->queryUniqueObject("SELECT * FROM customer_details WHERE customer_name='$cname' "); echo $line2->customer_address; ?> <br /> 123 Long Street <br /> London, DC3P F3Z <br /> </div> <div class="clear-fix"></div> <table border='1' cellspacing='0'> <tr> <th width=250>Description</th> <th width=80>Quantity</th> <th width=100>Unit price</th> <th width=100>Total price</th> </tr> <?php $db->query("SELECT * FROM stock_sales where transactionid='$sid'"); while ($line3 = $db->fetchNextObject()) { ?> echo("<tr>"); echo("<td><?php echo $line3->stock_name; ?></td>"); echo("<td class='text-center'><?php echo $line3->quantity; ?></td>"); echo("<td class='text-right'><?php echo $line3->selling_price; ?></td>"); echo("<td class='text-right'><?php echo $line3->amount; ?></td>"); echo("</tr>"); } ?> echo("<tr>"); echo("<td colspan='3' class='text-right'>Sub total</td>"); echo("<td class='text-right'><?php $subtotal = $line3->subtotal;?></td>"); echo("</tr>"); echo("<tr>"); echo("<td colspan='3' class='text-right'>VAT</td>"); echo("<td class='text-right'><?php $discount = $line3->discount;?></td>"); echo("</tr>"); echo("<tr>"); echo("<td colspan='3' class='text-right'><b>TOTAL</b></td>"); echo("<td class='text-right'><b><?php $payment = $line3->payment;?></b></td>"); echo("</tr>"); </table> </div> </body> </html> <?php } else "Error in processing printing the sales receipt"; } ?>
  15. In the following pages I'm trying to validate if a user is signed in or not. If the user is signed in I would like to see 'Log Out' printed to the screen(I'll do more with that later). If the user is not signed in I would like to see a login form at the top right of the screen. As it stands I'm only seeing 'Log Out' on the screen, I can't get the form to show up anymore. I thought it might be because the session variable was still hanging around but I restarted my computer to make absolutely sure but I'm still just getting 'Log Out'. At the moment I need this program to work as is as much as possible. If you see an entirely different approach that you would use that's fine but I don't currently have the time to go changing a lot, I need to get this going kinda quick. Thanks. records-board.php <?php require_once('includes/init.php'); if(!isset($_SESSION)) { init_session(); } ?> <html> <head> <Title>Pop Report</title> <link rel="stylesheet" type="text/css" href="styles/popreport2.css"> <h1>Pop Report</h1> </head> <body> <?php if(isset($_POST['nameinput']) && isset($_POST['passinput'])) { $nameinput = $_POST['nameinput']; $passinput = $_POST['passinput']; User::sign_in($nameinput, $passinput); } if(!isset($_SESSION['user'])) { print_form(); } else { echo "Log Out "; echo $_SESSION['user']->name; // this line was just trouble shooting, it told me nothing! } ?> user.php <?php if(!isset($_SESSION)) { init_session(); } class User { public $name; public function __construct($username, $password) { $connection = get_db_connection(); $query = $connection->query("SELECT * FROM users WHERE username='$username' AND password='$password'"); if(!$query) { echo "Invalid username or password"; } else { $result = $query->fetch(PDO::FETCH_ASSOC); if(!$result['username'] == $username || !$result['password'] == $password) { echo "Invalid username or password"; } else { $this->name = $result['username']; } } } public static function sign_in($username, $password) { $_SESSION['user'] = new User($username, $password); } } ?> <?php function print_form() { echo "<form id='loginform' name='loginform' action='records-board.php' method='post'>"; echo "Username: <input type='text' name='nameinput'>"; echo "Password: <input type='text' name='passinput'><br />"; echo "<input type='submit' value='Sign In'>"; echo "</form>"; } ?>
  16. If I have a php file that generates an html form from another php file which file would be the default file that would try to execute if I leave the action field blank in the html form? The php file that the form sits in or the php file that it's called from? Thanks.
  17. Hi guys, I am trying to make an iframe that contains another website so my users can login to the external website and view a partiicular html table on the external website. Once the user is on that page, I want them to be able to click a button hovering over the iframe that will copy all the html code and send back to my php. With this source code I will use the information in my website. One problem, I think the external website has disabled iframes from getting past the login page. Does anyone have a good idea where to start for this project? Thanks in advance!
  18. Hey guys, i am trying to create a box to show images or content once a user selects a link within a gallery. So for example i have an image --> user scrolls over --> image overlay shows a link ---> link actions to a jquery action to where a hidden field shows more data. right now i have everything to the point to where the links default action is disabled and the "overlay" div that will show the content is hidden. when i then go ahead and add some jquery to add a class when the link is clicked nothing seems to happen. <section class="work_area" id="WORK"> <div class="container"> <div class="row"> <div class="col-md-12 text-center"> <div class="work_title wow fadeInUp animated"> <h1>demo<span style="color: #64bdec; font-weight: bolder;">33</span> PORTFOLIO</h1> <img src="images/arrow486.png" alt=""> </div> <div id="dataBox"></div> </div> </div> </div> <div class="container-fluid"> <div class="row"> <div class="col-md-2 no_padding"> <div class="single_image"> <img src="images/REGISTERE.png" alt=""> <div class="image_overlay"> <h2>Lorem ipsum</h4> <a id="link" href="portfolio.php" >Popup link</a> </div> </div> </div> </div> </div> </section> CSS #dataBox{ width: 800px; height: 500px; margin: auto; padding: 100px 100px; position: relative; border: 2px solid black; margin-bottom: 10px; } #pData{ background: red; width: 800px; height: 500px; margin: auto; padding: 100px 100px; position: relative; border: 2px solid black; } JS. $(document).ready(function(){ $('#dataBox').hide(); $('#link').click(function(e){ e.preventDefault(); $('div #dataBox').removeClass().addClass('pData'); console.log("link is working"); }); }); everything works other than the div showing up.
  19. hey guys, i am trying to auto generate an email. i have a function that calls for the following use of : <?php $emailSub = 'Test Subject'; $emailTo = 'myemail@gmail.com'; $emailMsg = 'You have a new email that must be read below:<br> '; mail($emailTo,$emailSub,$emailMsg); ?> i dont seem to get any email. any suggestions as to why ?
  20. Hey guys, i am trying to create a contact form that by passes the page refresh and uses Jquery and Ajax to direct to a php file server side. So far i have everything work fine. until the final part where i pass the json data type into PHP and look to catch an error, success, or completion value. Currently i have an error coming back with the following: SyntaxError: Unexpected token < error due to a parsererror condition I do not see any errors in the console of of chrome, and i have no idea why i am getting this syntax error. These does not seem to be any conflicting data going into the json or out to php. really been stuck on this for a day now This is my .js file $(document).ready(function(){ $('form #alertMessage').hide(); $('#submit').click(function(e){ e.preventDefault(); var valid = ''; var name = $('form #name').val(); var email = $('form #email').val(); var subject = $('form #subject').val(); var message = $('form #message').val(); var honeypot = $('form #honeypot').val(); var humancheck = $('form #humancheck').val(); if(name = '' || name.length <= 5 ){ valid += '<p>Sorry, Your name is required!</p> '; } if(!email.match( /^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/ )){ valid += '<p>A Valid Email is required</p> '; } if(subject = '' || subject.length <= 2 ){ valid += '<p>A Valid name is required</p> '; } if(message = '' || message.length <= 5 ){ valid += '<p>A brief description of you is required.</p> '; } if(honeypot != 'http://'){ valid += '<p>Sorry spambots not allowed.</p> '; } if(humancheck != ''){ valid += '<p>Sorry only humans allowed past this point.</p> '; } if(valid != ""){ $('form #alertMessage').removeClass().addClass('error') .html('<br><br>' + valid).fadeIn('fast') }else{ $('form #alertMessage').removeClass().addClass('processing') .html('<br><br>We are processing your form now...').fadeIn('fast') var formData = $('form').serialize(); submitForm(formData); } }); }); function submitForm(formData){ $.ajax({ type: 'POST', url: 'feedback.php', data: formData, dataType: 'json', cache: false, timeout: 7000, success: function(data){ $('form #alertMessage').removeClass().addClass((data.error === true) ? 'error' : 'success' ) .html(data.msg).fadeIn('fast'); if($('form #alertMessage').hasClass('success')){ setTimeout("$('form $alertMessage').fadeOut('fast')", 5000); } }, error: function(XMLHttpRequest, testStatus, errorThrown){ $('form #alertMessage').removeClass().addClass('error') .html(' <p>There was an ' + errorThrown + ' error due to a ' + testStatus + ' condition.</p>').fadeIn('fast'); }, complete: function(XMLHttpRequest, status){ $('form')[0].reset(); } }); }; Here is the php script. <? sleep(3); $name = trim($_POST['name']); $name = trim($_POST['email']); $name = trim($_POST['subject']); $name = trim($_POST['message']); $name = $_POST['honeypot']; $name = $_POST['humancheck']; if ($honeypot == 'http://' && empty($humancheck)){ $errorMsg = ''; $reg_exp = "/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$/ "; if(!preg_match($reg_exp, $email)){ $errorMsg .= "<p>A valid email is required</p>"; } if(empty($name)]){ $errorMsg .= '<p>Please provide your name</p>'; } if(empty($message)]){ $errorMsg .= '<p>Please provide a message</p>'; } if(!empty($errorMsg)){ $return['error'] = true; $return['msg'] = 'Sorry the request was successful but your form was not correctly filled.' . $errorMsg; echo json_encode($return); exit(); }else{ $return['error'] = false; $return['msg'] = 'Thank you for your feedback ' .$name . ' ' . $errorMsg; echo json_encode($return); } } else { $return['error'] = true; $return['msg'] = 'Oops...there was a problem with your submission. Please try again' ; echo json_encode($return); } ?> HTML side. <form id="contact_us" class="contact-form" action="feedback.php" enctype="multipart/form-data" method="post"> <div id="alertMessage"> </div> <div class="row"> <div class="col-md-6"> <input type="text" name='name' class="form-control" id="name" placeholder="Full Name"> <input type="email" name='email' class="form-control" id="email" placeholder="Your Email"> <input type="text" name='subject' class="form-control" id="subject" placeholder="Company or Project name"> </div> <div class="col-md-6"> <textarea class="form-control" name="text" id="message" rows="25" cols="10" placeholder=" Brief Description"></textarea> <input id='submit' name='submit' type="submit" class="btn btn-default submit-btn form_submit"> </div> <input type="hidden" name="honeypot" id="honeypot" value="http://" /> <input type="hidden" name="humancheck" id="humancheck" value="" /> </div> </form> Image of the error output
  21. You know when you type text into a form input and it automatically types the same text in another div? Well I am trying to do the same thing but instead show the same text value from the div 1 to div 2. Here is my code. It works with the input text field but not with the textarea. Can you tell me why? <input type="text" name="title" id="title" value="" maxlength="55" /> <textarea name="details" id="details" value="" maxlength="160" ></textarea> <!-- Values show up in these inputs --> <input type="text" name="seo_page_title" id="seo_page_title" value="" maxlength="55" /> <textarea name="seo_page_description" id="seo_page_description" maxlength="160" ></textarea> <script> $('#title').on("input", function() { var dInput = this.value; console.log(dInput); $('#seo_page_title').val(dInput); }); $('#details').on("input", function() { var dInput = this.value; console.log(dInput); $('#seo_page_description').val(dInput); }); </script>
  22. There are two parts to my question. Part 1. I have a form. You know when you submit a form and if there is an error, the form will reset the input values unless you have the them "selected"? Well I have an issue with one of those inputs. Here is the code. For some reason the input value doesn't get selected on form reset. It inserts to the database fine. <fieldset> <label>Expiry Date</label> <select name="expiry_date"> <?php $date = date('Y-m-d H:i:s'); $expiry_1 = date("Y-m-d H:i:s", strtotime("$date + 1 week")); $expiry_2 = date("Y-m-d H:i:s", strtotime("$date + 2 weeks")); ?> <option value="0">Expires In</option> <option value="<?php echo $expiry_1; ?>" <?php if(empty($_POST['expiry_date'])) {} else { if($_POST['expiry_date'] == $expiry_1) { echo 'selected'; } } ?> >1 week</option> <option value="<?php echo $expiry_2; ?>" <?php if(empty($_POST['expiry_date'])) {} else { if($_POST['expiry_date'] == $expiry_1) { echo 'selected'; } } ?> >2 weeks</option> </select> </fieldset> This is another example of select drop down. But this one below works fine. // this select option's input values get selected on form reset. <fieldset> <label>City</label> <select name="city_id"> <option value="0">Select City</option> <?php $get_city = $db->prepare("SELECT city_id, city_name FROM cities WHERE city_id > :city_id"); $get_city->bindValue(':city_id', 0); $get_city->execute(); $result_city = $get_city->fetchAll(PDO::FETCH_ASSOC); if(count($result_city) > 0){ foreach($result_city as $row) { $get_city_id = intval($row['city_id']); $get_city_name = $row['city_name']; ?><option value="<?php echo $get_city_id; ?>" <?php if(empty($_POST['city_id'])) {} else { if($_POST['city_id'] == $get_city_id) { echo 'selected'; } } ?> ><?php echo $get_city_name; ?></option><?php } } else {} ?> </select> </fieldset> Part 2. This relates to my previous topic. I am trying to do the same thing as above, which is show input values on form reset. But this is slightly more complicated as it is an array. Looking at the code, you can see that you can add more fields through jquery. That all works. Inserting their values from multiple groups of fields into the db also works fine. But once again, if the form resets or submits, only the 1st group of fields show the selected values in the input fields. The 2nd or 3rd group of fields generated through the jquery disappear after submit. But again, their values do insert into the db fine. Here's the html and jquery code. <div id="options-parent"> <h2>Add Options</h2> <button class="add_field_button">Add More Fields</button> <div class="options-child-row"> <div class="option-float"> <label>Quantity</label> <input type="number" name="option_quantity[]" multiple min="1" max="1000000" step="1" value="<?php if(!empty($_POST['option_quantity'])) { echo $_POST['option_quantity'][0]; } else {}; ?>" /> </div> <div class="option-float"> <label>Retail Price</label> <input type="number" name="option_retail_price[]" multiple min="5" max="1000000" step="1" value="<?php if(!empty($_POST['option_retail_price'])) { echo $_POST['option_retail_price'][0]; } else {}; ?>" /> </div> <div class="option-float"> <label>Discount Price</label> <input type="number" name="option_discount_price[]" multiple min="1" max="1000000" step="1" value="<?php if(!empty($_POST['option_discount_price'])) { echo $_POST['option_discount_price'][0]; } else {}; ?>" /> </div> </div> </div> <script> $(document).ready(function() { var max_fields = 20; //maximum input boxes allowed var wrapper = $("#options-parent"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var x = 1; //initlal text box count $(add_button).click(function(e){ //on add input button click e.preventDefault(); if(x < max_fields){ //max input box allowed x++; //text box increment $(wrapper).append( '<div class="options-child-row">'+ '<div class="option-float">'+ '<label>Quantity</label>'+ '<input type="number" name="option_quantity[]" min="1" max="1000000" step="10" value="" />'+ '</div>'+ '<div class="option-float">'+ '<label>Retail Price</label>'+ '<input type="number" name="option_retail_price[]" min="1" max="1000000" step="10" value="" />'+ '</div>'+ '<div class="option-float">'+ '<label>Discount Price</label>'+ '<input type="number" name="option_discount_price[]" min="1" max="1000000" step="10" value="" />'+ '</div>'+ '</div>' ); //add input box } }); $(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).parent('.options-child-row').remove(); x--; }) }); </script> What do you think?
  23. I have this js code that works great. Now the new option I would like to add is the "days". Right now it's only based on hours, mins, seconds. Can you show me how you would add the "days" option to it? function Timer(container, timeLeft) { // get hour, minute and second element using jQuery selector var hoursContainer = $(container).find('.hour'); var minsContainer = $(container).find('.min'); var secsContainer = $(container).find('.sec'); // hold time left var currentTimeLeft = timeLeft; // 1 second = 1000 ms var secondsForTimer = 1000; // hold ID value return by setInterval() var timerInterval; // call setInteval() only when timeLeft is greater than 0 if (currentTimeLeft == 0) { return; } else { //Call setInterval()function and store ID value to timerInterval. timerInterval = setInterval(countdown, secondsForTimer); } //function being passed to setInterval() function countdown() { currentTimeLeft = parseInt(currentTimeLeft - secondsForTimer); if (currentTimeLeft == 0) { //stop calling countdown function by calling clearInterval() clearInterval(timerInterval); return; } else { //calculate hours left var wholeSeconds = parseInt(currentTimeLeft / 1000,10); var wholeMinutes = parseInt(currentTimeLeft / 60000,10); var wholeHours = parseInt(wholeMinutes / 60,10); //calculate minutes left var minutes = parseInt(wholeMinutes % 60,10); //calculate seconds left var seconds = parseInt(wholeSeconds % 60,10); //prefix 0 to hour, min and second counter $(hoursContainer).text((wholeHours < 10 ? "0" : "") + wholeHours + (wholeHours <=0 ? " hr" : " hrs")); $(minsContainer).text((minutes < 10 ? "0" : "") + minutes + (minutes <=0 ? " min" : " mins")); $(secsContainer).text((seconds < 10 ? "0" : "") + seconds + (seconds <=0 ? " sec" : " secs")); } } } Thanks.
  24. Hello, I'm trying to output my database on my website but it's not working, it shows up just a blank page ( http://prntscr.com/90dfbf ), here's the code : <html> <head> <title>Untitled</title> </head> <body> <?php require_once(‘conn.php’); $sql = ("SELECT * FROM oglasi"); $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) { $naziv = $row[‘naziv’]; $sadrzaj = $row[‘sadrzaj’]; echo $naziv; echo $sadrzaj; }; ?> </body> </html> And conn.php is: <?php $conn = mysql_connect(‘localhost’, ‘root’, ‘ELsk0l@r00t’) or die (mysql_error()); mysql_select_db(‘elskoglasi’) or die (‘Database selection incorrect’); ?>
  25. First let me start by saying I'm not looking to copy someone else's code but better understand where the line is drawn for people copying my own code. All developers at some point will have used others code in there own work. If you see something that inspires you, you may decided to use that code in your design. In some degree this maybe classed as fair use depending on the quantity of code you copy. Another developer may taken an entire php file, function, class, CSS sheet, HTML file and use this in there work / pass this off as there own work. This is blatant plagiarism. However what is stopping a developer from taking an entire piece of code and editing every aspect of the file to make it his own? For instance a designer my change the names of the styles and perhaps change the order of the properties and there values slightly; He may also move around parts of the html. In doing so causes the design to look different to your own but still the copying your work no the less. Another instance maybe that a PHP developer uses your entire code / software package and change the names of the variables, classes and methods; He may also change the order in which the methods appear and even change some similar functions to use alternatives such as loops. Again this causes the program to do exactly what your intends to do, however the source code will now look different to your own. How far can someone go back doing these actions? Is this legal? How best would you be able to prove it?
×
×
  • 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.