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. Hello guys, am new to this forum. I have a question that i'd like some help with, this is part of my dissertation project. So i'm creating a system that will gather hardware parts from the database manually (I have 7 hardware parts for each component which is cpu,gpu,psu,motherboard,ram and case) for each and the user will input the price tag in the listbox ($300-$450) for example and the system will display hardware parts from the database within that price range. How can I link the listbox with the database? And how can I make the total price from hardware parts display depending on what the user pressed? Thanks
  2. I ran into this confusion while trying to write a script for uploading a file using AJAX which would work in IE8. Apparently there is a hack to achieve this which involves the usage of iframes. What I've tried so far is submitting a form with just action attribute which redirects to another page. <form method="post" action="test.php"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> Even if I set the attribute to _self(default value), the page redirects to test.php and shows what ever is printed by the php script. Now when I set the target to _blank, the page test.php opens in a new tab and shows what ever is printed by the php script. <form method="post" action="test.php" target="_blank"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> And if I set the target to an iframe name present in the same page, the php response is printed in the iframe(which is the hack to upload a file) <form method="post" action="test.php" target="some_frame"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> <iframe name="some_frame" /> So what I want to know is how does the action and target attribute work once the form is submitted? When the target attribute is set to _self, the page redirects and then prints(action first and then target), but if the target attribute is set to _blank, first a new tab is opened and then the response is printed(first the target and then action) and when the target attribute is set to a frame_name, it prints within the frame(does it load the response from the page into the frame?). It would be really helpful if someone could assist me with a link or an explanation of the flow of a form submission, the order of execution of the action and target attributes and how do they work and in what order do they run.
  3. I have created a countdown clock that will be counting down from 100 (looping each second). This is the code: <script> $(document).ready(function(){ $("#buttonClick").on('click', function(){ var initialValue = $("#countdown").text(); setInterval(function () { initialValue--; $("#countdown").text(initialValue); }, 1000); }); }); </script> <body> <button id="buttonClick">Click Me</button> <div id="countdown">100</div> </body> When i click the "Click Me" button the number counts down from 100, 99, 98,97.... When try this from a mobile device and while the device is awake, it works just fine. Lets say the counter is on 50 and i press the power button of the mobile device and it sleeps. If i wake the mobile after 40 seconds, i will not see the remaining 10 seconds but something like 40 or 38 seconds. This happens every time and i don't know why. Can someone help? Regards, Christos
  4. This is jquery dialog box. http://jqueryui.com/dialog/#modal-confirmation I am wondering where would be the best place to add the dialog box div, in below html page? <html> <head> </head> <body> </body> </html>
  5. First off, I am very new to php and I am learning the best I can. I am trying to display a dynamic grid style table within a loop and display my mysql data inside of it. The data is a Image URL, directory URL, URL description, and it prints all this data as an image with a link to the gallery. The code works fine as... 5 wide x 5 down. It's supposed to look a little something like this: [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Now that works, however when I change my rows and column variable # to 7 and 7 is when the problems start.. Here is my main code for this function: //define variables $uniqhash = ""; $modelname = ""; $email = ""; $galleryurl = ""; $gallerydesc = ""; $category = ""; $datesubmitted = ""; $gallerythumb = ""; $rows = 0; $count = 0; $columns = 0; $select = "SELECT * From `models`"; $images_rows = mysqli_query($conn, $select); $images = array(); if( empty( $images ) ) { echo 'Sorry, there was a fatal error in selecting images from database.'; } while ($image = mysqli_fetch_assoc($images_rows)) { $images[] = $image; } echo '<table align="center" border="0"><tr>'; $size = sizeOf($images) - 1; //get count of array and put into $size foreach($images as $image){ if($rows == 7) { echo '</tr><tr>'; // if our count is x wide, start a new row $rows = 0; } if ($columns == 7){ echo '</tr><tr>'; $columns = 0; } echo "<td><a href=" . $image['galleryurl'] . " target=\"new\"><img src=" . $image['gallerythumb'] . " height=\"160\" width=\"160\" alt=\"" . $image['gallerydesc'] . "\"></a></td>"; $rows++; $count++; $columns++; echo ($rows == 7 && $columns == 5 && $count != $size) ? '</tr>': ''; } echo '</tr></center></table>'; When I change $rows and $columns to 7 each it will display images like: (sample of 13 images) [] [] [] [] [] [] [] [] [] [] [] [] [] [] I would like it to print x images across for $rows and x amount of rows for $columns in a grid like fashion. If anyone can give me some help on this I would appreciate it...I have been desperately reading up on loops trying to figure it out but so far no luck. P.S I am familiar with sanitizing all my data and that I need to implement this but I want to make sure my code functions first.
  6. Greetings, I'm not 100% sure if this is a server problem so I apologize if this ends up in the wrong thread. So I moved websites from an old server to a new one and everything is working perfectly with the exception of parsing PHP in an HTML file. for instance the following will only work if its in a .php file not an html, otherwise it just pushes the <?php echo "hello world"; ?> ..which tells me that PHP is on and working, but not parsing HTML. I googled and read as much as I could on here about this, and the only thing that I can find is alterations to the .htaccess file to make this work. I already had a .htaccess file, but maybe now it need altering? I currently have (and it looks messy) this... which worked on my old server and I am assuming old PHP software. I am currently running PHP Version 5.5.20. A snippet from my .htaccess AddType application/x-httpd-php php html AddType application/x-httpd-php .html AddType application/x-httpd-php .htm <Files yourpage.html> AddType application/x-httpd-php .htm I have found a bunch of alterations to this online, but nothing appears to work so I thought I would ask the experts. Again PHP seems to work, but only if the extension is .php which I do not want in this situation. Thanks for any help!
  7. I know these are the two most popular ones. http://www.sharethis.com/ https://www.addthis.com/get/sharing But I find them slow to load on a page. So I am asking, is there a better solution to this that won't be slow?
  8. I have been working on a custom form for our office to use, and I am rounding the final corner (checkboxes!) and am stuck. I have finally gotten the code to actually function the way I want, but am greeted with a 500 error instead of the confirmation page. Maybe I'm just tired and missing something... HTML: <form name="htmlform" method="post" action="html_form_send.php"> <p><center><font size="18">Tucker Arensberg IT Equipment Request Form</font></center></p> <center><b><font color="red">Please Fill Out Entire Form, IT Department Is Not Responsible For Incomplete Information On Requests.</font></b></center><br> <table width="450px"> </tr> <tr> <td valign="top"> <label for="first_name"><b>First Name:</b></label> </td> <td valign="top"> <input type="text" name="first_name" maxlength="50" size="30"> </td> </tr> <tr> <td valign="top""> <label for="last_name"><b>Last Name:</b></label> </td> <td valign="top"> <input type="text" name="last_name" maxlength="50" size="30"> </td> </tr> <tr> <td valign="top"> <label for="email"><b>Email Address:</b><br> </label> </td> <td valign="top"> <input type="text" name="email" maxlength="80" size="30"> <br><b><font color="red">FULL EMAIL MUST BE ENTERED OR FORM WILL NOT BE SUBMITTED</font></b><br> </td> </tr> <tr> <td valign="top"> <label for="daterequest"><b>Pickup Date:</b><br> (mm/dd/yyyy)<br> <br> </label> </td> <td valign="top"> <input type="text" name="daterequest" maxlength="10" size="10"> </td> </tr> <tr> <td valign="top"> <label for="datereturn"><b>Estimated Return Date:</b><br> (mm/dd/yyyy)<br> <br> </label> </td> <td valign="top"> <input type="text" name="datereturn" maxlength="10" size="10"> </td> </tr> <tr> <td valign="top""> <b><label class="radio" for="usage">Usage:</label></b> </td> <td valign="top"> <input class="radio" type="radio" name="usage" value="internal" checked /> <span>Internal (On-Site)</span><br> <input class="radio" type="radio" name="usage" value="external" /> <span>External (Off-Site)</span><br><br> </td> <tr> <td valign="top"> <label for="equipment"><b>Equipment Needed:</b><br> (Any items not checked will not be included)</label> </td> <td valign="top"> <input type="checkbox" name="equipment" value="Laptop" /> Laptop<br /> <input type="checkbox" name="equipment" value="Carrying Case" /> Carrying Case<br /> <input type="checkbox" name="equipment" value="Mouse" /> Mouse<br /> <input type="checkbox" name="equipment" value="Hotspot" /> HotSpot/MiFi/Portable WiFi Device<br /> <input type="checkbox" name="equipment" value="usb" /> USB Thumb Drive<br /> <input type="checkbox" name="equipment" value="Vodka" /> Vodka<br /> <br> <br> </td> </tr> <tr> <td valign="top"> <b>Laptop Features Required:</b><br> (Any items not checked cannot be guaranteed on laptop) </td> <td valign="top"> <input type="checkbox" name="features[]" value="cd" /> CD Drive<br /> <input type="checkbox" name="features[]" value="dvd" /> DVD Drive<br /> <input type="checkbox" name="features[]" value="vpn" /> VPN Connection<br /> <input type="checkbox" name="features[]" value="netilla" /> Netilla<br /> <input type="checkbox" name="features[]" value="media" /> Media Playback (video files)<br> (Please include extension/format of video/audio files in COMMENTS section.)<br /> <input type="checkbox" name="features[]" value="vmware" /> VMWare<br /> <br> <br> </td> </tr> <tr> <td valign="top"> <label for="comments"><b>Additional Comments:</b></label> </td> <td valign="top"> <textarea name="comments" maxlength="1000" cols="25" rows="6"></textarea> </td> </tr> <br> <br> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="Submit"> </td> </tr> </table> </form> <br> <br> <center><img src='logo.jpg'> <br> Copyright 2015 Tucker Arensberg IT Department</center> PSP: <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "blank@blank.com"; $email_subject = "New Equipment Checkout Request"; $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $daterequest = $_POST['daterequest']; // not required $datereturn = $_POST['datereturn']; $usage = $_POST['usage']; $features .= implode(', ', $_POST['features']); $comments = $_POST['comments']; // required $comments = $_POST['comments']; // required $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Date Requested: ".clean_string($daterequest)."\n"; $email_message .= "Estimated Return Date: ".clean_string($datereturn)."\n"; $email_message .= "Usage: ".clean_string($usage)."\n"; $email_message .= "Features Requested: ".clean_string($features)."\n"; // $email_message .= "Estimated Return Date: ".clean_string($datereturn)."\n"; // $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '."requests@tuckerlaw.com"."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> Of note, when I comment out the assignment and email-print for the "$features" variable, it runs without emailing the checkboxes, and gives the proper "confirmation" page. Thanks!
  9. Say I have button 1 and I want to replace it with button2 on click. How would I do that? <button id="button1">butto 1</button> <button id="button2">butto 2</button>
  10. Hi, I am struggling to get a htmnl 5 canavas not to work after the back button is pressed in the browser. I have stopped back button being allowed but it stops me using javascript to use go back which i need. The code is as follows. <?php require('globals.php'); if ($ir['wof_spins'] > 0) { error("You have span the wheel this hour"); //this does not work on page back } ?> <!DOCTYPE html> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=euc-kr"> <script type='text/javascript' src='http://code.jquery.com/jquery-compat-git.js'></script> <script type='text/javascript' src="js/jquery.transit.min.js"></script> <style type='text/css'> .wheel-wrap { position: relative; width: 550px; height: 550px; overflow: hidden; margin: 0 auto; z-index: 1; } .marker { top: 10px; left: 247px; z-index: 1; position: absolute; } .wheel { top: 90px; left: 74px; width: 550px; z-index: 1; } </style> <script type='text/javascript'>//<![CDATA[ $(function(){ window.WHEELOFFORTUNE = { cache: {}, init: function () { console.log('controller init...'); var _this = this; this.cache.wheel = $('.wheel'); this.cache.wheelMarker = $('.marker'); this.cache.wheelSpinBtn = $('.wheel'); //mapping is backwards as wheel spins clockwise //1=win this.cache.wheelMapping = [400, 120, 80, 750, 150, 300, 60, 175, 500, 125, 75, 1000, 120, 200, 90, 600, 100, 250].reverse(); this.cache.wheelSpinBtn.on('click touchstart', function (e) { e.preventDefault(); if (!$(this).hasClass('disabled')) _this.spin(); }); //reset wheel this.resetSpin(); //setup prize events this.prizeEvents(); }, spin: function () { console.log('spinning wheel'); var _this = this; // reset wheel this.resetSpin(); //disable spin button while in progress this.cache.wheelSpinBtn.addClass('disabled'); /* Wheel has 10 sections. Each section is 360/10 = 36deg. */ var deg = 1500 + Math.round(Math.random() * 1500), duration = 6000; //optimal 6 secs _this.cache.wheelPos = deg; //transition queuing //ff bug with easeOutBack this.cache.wheel.transition({ rotate: '0deg' }, 0) .transition({ rotate: deg + 'deg' }, duration, 'easeOutCubic'); //move marker _this.cache.wheelMarker.transition({ rotate: '-20deg' }, 0, 'snap'); //just before wheel finish setTimeout(function () { //reset marker _this.cache.wheelMarker.transition({ rotate: '0deg' }, 300, 'easeOutQuad'); }, duration - 500); //wheel finish setTimeout(function () { // did it win??!?!?! var spin = _this.cache.wheelPos, degrees = spin % 360, percent = (degrees / 360) * 100, segment = Math.ceil((percent / 6)), //divided by number of segments win = _this.cache.wheelMapping[segment - 1]; //zero based array console.log('spin = ' + spin); console.log('degrees = ' + degrees); console.log('percent = ' + percent); console.log('segment = ' + segment); console.log('win = ' + win); //display dialog with slight delay to realise win or not. setTimeout(function () { $.ajax({ url: 'spinwheel.php', type: 'post', data: {"win":win}, success: function(data) { if(!alert('You have won 짜'+win)) document.location = 'http://samuraiassault.com/loggedin.php'; } }); }, 700); //re-enable wheel spin _this.cache.wheelSpinBtn.removeClass('disabled'); }, duration); }, resetSpin: function () { this.cache.wheel.transition({ rotate: '0deg' }, 0); this.cache.wheelPos = 0; } } window.WHEELOFFORTUNE.init(); });//]]> </script> </head> <body> <!-- By http://jquery4u.com / Sam Deering --> <h3><u>Wheel Of Fortune</u></h3><hr/> <table><tr> <td class="contentcontent" width="100%"> <div class="wheel-wrap"> <img class="wheel" src="images/wheel.jpg" /> <img class="marker" src="images/marker.png" /> </div> </tr> </td> </table><hr/><?php echo $goback; ?><hr/> </body> </html> thanks for you help in advance
  11. I am trying to create a dynamic form using Jquery but don't know how to post those data using $_POST. The page <html> <head> <title> Dynamically create input fields- jQuery </title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(function() { var addDiv = $('#addinput'); var i = $('#addinput p').size() + 1; $('#addNew').live('click', function() { $('<p><input type="text" id="p_new" size="40" name="p_new_' + i +'" value="" placeholder="I am New" /><input type="text" id="p_new2" size="40" name="p_new_2' + i +'" value="" placeholder="I am New 2" /><a href="#" id="remNew">Remove</a> </p>').appendTo(addDiv); i++; return false; }); $('#remNew').live('click', function() { if( i > 2 ) { $(this).parents('p').remove(); i--; } return false; }); }); </script> </head> <body> <h2>Dynammically Add Another Input Box</h2> <form action="gen.php" method="post"> <div id="addinput"> <p> <input type="text" id="p_new" size="40" name="p_new" value="" placeholder="Input Value" /><input type="text" id="p_new2" size="40" name="p_new2" value="" placeholder="Input Value" /><a href="#" id="addNew">Add</a> </p> </div> </form> </body> </html> Here is live example.. A Pen by Captain Anonymous Whatever, The new fields got an unique name="" value as p_new_1, p_new_21 for first new field, p_new_2, p_new_22 for second new field ...... ...... Now, I know I can display inserted data using <?php echo $_POST["p_new_1"]; ?> and similar way like this... But as a growing field, this form can have unlimited input field. How can I display all of those data in the page gen.php? It must be something like this example: <html> <body> <div class="header">Generated content<div> <p><a href="inserted data of first field of default row">inserted data of second field of default row</a></p> <p><a href="inserted data of first field of first new row">inserted data of second field of first new row</a></p> <p><a href="inserted data of first field of 2nd new row">inserted data of second field of 2nd new row</a></p> <p><a href="inserted data of first field of 3rd new row">inserted data of second field of 3rd new row</a></p> <p><a href="inserted data of first field of 4th new row">inserted data of second field of 4th new row</a></p> And list go on according to submitted form.... </div></body></html> I actually lake of knowledge of PHP and no idea about array or something named loop. Can someone do it for me? What I have to do in gen.php?
  12. I must use a hyperlink like this: <a href="https://www.pic-vert.fr/obm/availabilitycalendar.php?id=1&month=2&year=2015&ln=nl"> I want to make it dynamic so that month=2 changes into month='current month' and year = 2015 changes into year = current year. Any help available ? Thanks a lot, Freddy (beginner)
  13. Hi I am trying to build a contact form and my form isnt sending. Here is my code. (its in a modal window)(I have my email address in the $to variable in the code) <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: Jarrod'; $to = 'email'; $subject = "Landing page"; $body = "From: $name\n Email: $email\n Message:\n $message"; ?> <?php if ($_POST['submit']){ if(mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; }else{ echo '<p>Something went wrong, go back!</p>'; } } ?> <div class="modal fade" id="contact" role="dialog"> <div class=" modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h2>Contact us</h2> </div> <div class="modal-body"> <form method="post" action="index1.php"> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" id="name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" id="email" placeholder="Email"> <label for="Message">Message</label> <textarea class="form-control" id="message" placeholder="Message"></textarea> <input type="submit" value="Send">Send</button> </form> <div class="modal-footer"> <a class="btn btn-default" data-dismiss = "modal">Close</a> </div> </div> </div> </div>
  14. Hi I am currently using bootstrap to design a landing page. I want to add a contact us form and I need to use a text area for long messages. When I use it with bootstrap it just appears as a single line and not a large field. How can I style just 1 field instead of all of them? This is my HTML code. <form> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" id="Name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" id="Email" placeholder="Email"> <label for="Message">Message</label> <input type="textarea" class="form-control" id="Message" placeholder="Message"> </form>
  15. I am having a bit of issue. I have a simple query that loops to find each record, like this. // select query here if(count($result) > 0) { foreach($result as $row) { $userid = $row['user_id']; $_SESSION['userid'] = $userid; } } else { // error here } I want to use the "$userid" on a different page; so I created a session for it. When ever I use that session on another page, it gives me only the last record's user id and not the first one. How can I fix this?
  16. I have a script that resizes and uploads an image. It works great. Now I would like to add a new function to it that will detect if there is a duplicate image already posted. If there is, it will not upload the image. I have found a script that has that function. I am just a little lost on how to incorporate that into my php code. Here is my image upload/resize code. if(Input::exists()) { if(Token::check(Input::get('token'))) { // Setting up image folders based on user id $userDir= 'images/'.$userid.'/'; if(!is_dir($userDir)){ mkdir('images/'.$userid.'/', 0775); } else { // Uploading image with resize and crop. if(isset($_FILES['image'])) { if (empty($_FILES['image']['name'])) { $error = 'Please choose an image!'; } else { function swapHW() { global $height, $width, $newheight, $newwidth; $tempHeight = $height; $tempWidth = $width; $height = $tempWidth; $width = $tempHeight; $tempHeight = $newheight; $tempWidth = $newwidth; $newheight = $tempWidth; $newwidth = $tempHeight; } function getOrientedImage($imagePath){ $image = imagecreatefromstring(file_get_contents($imagePath)); $exif = exif_read_data($imagePath); if(!empty($exif['Orientation'])) { switch($exif['Orientation']) { case 8: $image = imagerotate($image,90,0); swapHW(); break; case 3: $image = imagerotate($image,180,0); break; case 6: $image = imagerotate($image,-90,0); swapHW(); break; } } return $image; } $name = $_FILES['image']['name']; $temp = $_FILES['image']['tmp_name']; $type = $_FILES['image']['type']; $size = $_FILES['image']['size']; $ext = strtolower(end(explode('.', $name))); $size2 = getimagesize($temp); $width = $size2[0]; $height = $size2[1]; $upload = md5(rand(0, 1000) . rand(0, 1000) . rand(0, 1000) . rand(0, 1000)); // Restrictions for uploading $maxwidth = 6000; $maxheight = 6000; $allowed = array('image/jpeg', 'image/jpg', 'image/png', 'image/gif'); // Recognizing the extension switch($type){ // Image/Jpeg case 'image/jpeg': $ext= '.jpeg'; break; // Image/Jpg case 'image/jpg': $ext= '.jpg'; break; // Image/png case 'image/png': $ext= '.png'; break; // Image/gif case 'image/gif': $ext= '.gif'; break; } // upload variables $path = $userDir . $upload . $ext; $thumb_path = $userDir . 'thumb_' . $upload . $ext; // check if extension is allowed. if(in_array($type, $allowed)) { // Checking if the resolution is FULLHD or under this resolution. if($width <= $maxwidth && $height <= $maxheight) { if($size <= 5242880) { // check the shape of the image if ($width == $height) {$shape = 1;} if ($width > $height) {$shape = 2;} if ($width < $height) {$shape = 3;} //Adjusting the resize script on shape. switch($shape) { // Code to resize a square image. case 1: $newwidth = 300; $newheight = 225; break; // Code to resize a tall image case 2: $newwidth = 300; $ratio = $newwidth / $width; $newheight = round($height * $ratio); break; // Code to resize a wide image. case 3: $newheight = 225; $ratio = $newheight / $height; $newidth = round($width * $ratio); break; } // Resizing according to extension. switch($type) { // Image/Jpeg case 'image/jpeg'; $img = imagecreatefromjpeg($temp); $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb, $thumb_path); break; // Image/Jpg case 'image/jpg'; $img = imagecreatefromjpeg($temp); $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb, $thumb_path); break; // Image/png case 'image/png'; $img = imagecreatefrompng($temp); $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagepng($thumb, $thumb_path); break; // Image/gif case 'image/gif'; $img = imagecreatefromgif($temp); $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagegif($thumb, $thumb_path); break; } try { $stmt = $db->prepare("INSERT INTO images(path, thumb_path) VALUES(:path, :thumb_path)"); $stmt->bindParam('path', $path); $stmt->bindParam('thumb_path', $thumb_path); $stmt->execute(); if($stmt == false){ $error = 'There was a problem uploading your image.'; } else { $success = 'Your image has been uploaded.'; move_uploaded_file($temp, $path); } } catch(Exception $e) { die($e->getMessage()); } } else { $error = 'Your image size is too big.'; } } else { $error = 'Your image resolution exceeds the limit.'; } } else { $error = 'Your have uploaded a forbidden extension.'; } } } } } } This guy has found a way to find duplicate images. Here is his script. http://www.catpa.ws/php-duplicate-image-finder/ I could really use some help on integrating his method into mine.
  17. If you search for images on Google images, you will see how they setup their images, side by side and have infinity scroll. I don't care about the infinity scroll part, but I am interested in how they set up the images? My plan is to retrive the images from the database and use pagination numbers.
  18. The text book I am using has 1 page on include files and no examples. I understand how to call the include file and that when I name it I should use the inc_ prefix... Where I am lost is what needs to be inside the include file? What can I omit from the file? Do I just write it like it is part of the .php file I am working on Example...I want to use a include file for a list of links. Starting File <html> <head> </head> <body> <?php> include 'links.php'; ?> </body> </html> Include File <nav> <ul> <li><a href="link1.htlm">Link 1</li> <li><a href="link2.htlm">Link 2</li> <li><a href="link3.htlm">Link 3</li> </ul> </nav> Do I need anything else in the include or would this work?
  19. i am creating a responsive website. I'll give you an example. I am retriving 100 items from mysql database using php. I am only showing 20 items per page using simple pagination with arrows. I keep this format on desktop and tablets. However, I would like to show less items when I am viewing the page on a smartphone. So instead of 20 items per page, it'll show 5 items per page along with the pagination arrows. I was wondering if this is possible with PHP or would I have to use javascript?
  20. Hi, I am new to this forum and I came here because I am a website owner that is a novice in php coding and I want to adjust the coding my web designer created, because I want to update my auto email when members sign up to my site. I found my signup.php page and found the secton where the contents of the auto email are housed but I have no way (or atleast I don't know the way) to test my coding adjustments without going through the signup process on my site and I don't want to do that multiple times just to check code, so I decided to see if I could ask the questions here and maybe someone can "eyeball" my coding adjustments and ensure that they work OR maybe you can instruct me how I can test my code. Keep in mind, this is not an actual page on my site, it's the auto email when users signup. It's sent from my signup.php page once the signup button is "clicked". 1. I'll provide a snippet of the code my webdesigner setup and that should work fine 2. I'll provide my changes to the email contents (basically text, image and html links). Hopefully there is someone who can assist. Thanks A BILLION!!! -Ivan Below is the original code from my webmaster, shouldn't be anything wrong with this code. (You'll notice the links aren't html text links, I wanted to change that) $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: mixrevu.com <noreply@mixrevu.com> \r\n"; $headers .= "Reply-To: noreply@mixrevu.com \r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $to = $_POST["email"]; $subject = "Website Sign Up \r\n"; $body = "<p><img src='http://www.mixrevu.com/img/logo.png'></p> \r\n"; $body .= "<p style='font-weight:bold;'>Welcome! We absolutely love new members!</p> \r\n"; $body .= "<p>Your signup is now complete.</p> \r\n"; $body .= "<p>Your Login details are:<br> \r\n"; $body .= "Current Email: ".$_POST["email"]."<br> \r\n"; $body .= "Password: ".$_POST["pwd"]."</p> \r\n"; $body .= "<p style='font-weight:bold;'>Hang on to this email just in case you forget those details. </p> \r\n"; $body .= "<p>If you need any assistance, don’t worry we are here to HELP! - support@mixrevu.com</p> \r\n"; $body .= "<p style='font-weight:bold;'>Start Here</p> \r\n"; $body .= "<p>#1 Complete your profile so we know more about why you love pro audio mixing.<br> \r\n"; $body .= "#2 Join the conversation in our forum, we’d love to hear from you. - http://forum.mixrevu.com<br> \r\n"; $body .= "#3 Submit your mix in the mix-revu to get feedback you can’t get anywhere else on the internet and maybe even win a winner’s spot on our homepage! - http://www.mixrevu.com<br> \r\n"; $body .= "#4 Our merch store is the place to show others you are a proud member of the mixrevu community, check it out! - http://merch.mixrevu.com<br> \r\n"; $body .= "#5 We need photos of our members in their mix environment, post some!</p> \r\n"; $body .= "<p>-mixrevu team! </p> \r\n"; mail($to, $subject, $body, $headers); Below are my adjustments to the body of the email (it includes image links for social media, and html text links replacing the basic website address links) ** All of the changes I made are within the $body of the email. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: mixrevu.com <noreply@mixrevu.com> \r\n"; $headers .= "Reply-To: noreply@mixrevu.com \r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $to = $_POST["email"]; $subject = "Website Sign Up \r\n"; $body = "<p><img src='http://www.mixrevu.com/img/logo.png'></p> \r\n"; $body .= "<p style='font-weight:bold;'>Welcome! We Absolutely Love New Members!</p> \r\n"; $body .= "<p style='font-weight:bold;'>Follow Us For Mixrevu.com Updates: <a href='https://www.facebook.com/mixrevu'> <img border='0' alt='Facebook page' src='http://www.mixrevu.com/images/Facebook-logo-300x300.jpg' width='45' height='45'> </a> <a href='https://www.twitter.com/MIXREVU'> <img border='0' alt='Twitter page' src='http://www.mixrevu.com/images/Twitter_logo_blue.png' width='45' height='35'> </a> <a href='https://plus.google.com/+Mixrevu'> <img border='0' alt='Google plus' src='http://www.mixrevu.com/images/google_plus_03.png' width='60' height='45'> </a></p> \r\n"; $body .= "<p>Your signup is now complete.</p> \r\n"; $body .= "<p>Your Login details are:<br> \r\n"; $body .= "Current Email: ".$_POST["email"]."<br> \r\n"; $body .= "Password: ".$_POST["pwd"]."</p> \r\n"; $body .= "<p style='font-weight:bold;'>Hang on to this email just in case you forget those details. </p> \r\n"; $body .= "<p>If you need any assistance, don’t worry we are here to HELP! - support@mixrevu.com</p> \r\n"; $body .= "<p style='font-weight:bold;'>Start Here</p> \r\n"; $body .= "<p>#1 Complete your profile by registering in the <a href='http://goo.gl/d2gBZX'>Forum</a>. This is where you’ll have access to our downloads when we upload them. Only members who’ve logged in to both will have access. You can also find previous Head2Head downloads <a href='http://goo.gl/L8gwXP'>HERE</a> that you can use for practice.<br> \r\n"; $body .= "#2 Be sure to check out the Mixrevu <a href='http://goo.gl/AUvo87'>Head2Head Rules</a>.<br> \r\n"; $body .= "#3 Mixrevu Head2Head Free Downloads are announced via Newsletters to all members first. You’ll automatically receive those as a site member. **If you have music of your own you want in a Head2Head, upload that too!!! We have genre specific spaces available.** <a href='http://goo.gl/FqzG6o'>Here’s how to upload</a>.<br> \r\n"; $body .= "#4 Our Sites Best <a href='http://goo.gl/5L8lzM'>Trivia</a>, <a href='http://goo.gl/yShmdh'>Quizzes</a> & <a href='http://goo.gl/smfV8z'>Audio Articles</a> are in our <a href='http://goo.gl/4Nmfqn'>Audio Blog</a>. - Exclusive content guaranteed to improve your mix process.<br> \r\n"; $body .= "#5 Upload your photo to our <a href='http://goo.gl/DOMMbP'>photo wall</a>, If you win a Head2Head this will be your featured photo!<br> \r\n"; $body .= "#6 Ever wanted to understand your studio better? We cover everything from EQ, Compression, Monitors, TDR, to Studio Acoustics & More in the <a href='http://goo.gl/KjCYxn'>Signal Path Series</a> .<br> \r\n"; $body .= "#7 <a href='http://goo.gl/kxQOik'>Exclusive Audio Engineer T-Shirts</a> & <a href='http://goo.gl/6KC31j'>Exclusive Downloads</a> you won’t find anywhere else are in our shop! Everything is ON SALE & Free Shipping in the U.S.!</p><br> \r\n"; $body .= "<p>-mixrevu team! </p> \r\n"; mail($to, $subject, $body, $headers);
  21. Hi guys I would like to get whole content of html file after I submitted a password. The problem is that the my code doesn't access the value for the file. I tried to create a session but i doesn't work. What other option do I have to get the content of the html file? session_start(); $selected_file = $_POST['radio1']; // get the filename of the file $fileinfo = pathinfo($selected_file); $filename = $fileinfo['dirname'] . DIRECTORY_SEPARATOR . $fileinfo['filename']; $password = 'code'; $lines = file("$filename.html"); $_SESSION['selectedfile'] = $selected_file; $_SESSION['file'] = $filename; $_SESSION['Scipt'] = ("$filename.html"); $_SESSION['Scipttext'] = $lines; $_SESSION['file2'] = $fileinfo; if (isset($_POST['submitradio'])) { echo '<div class="imageselected">'; echo '<img src="'.$_SESSION['selectedfile'].'" /></br>'.PHP_EOL; echo '</div>'; // check to see if a html file named the same also exists if(file_exists($_SESSION['Scipt'])) { echo "<form action='test_result.php' method='post'>"; echo '<div class="Password">'; echo 'Type in password to view full Script'; echo "<label><div class=\"Input\"><input type='password' name='passIT' value='passit'/></div>"; echo "<input type='submit' name='submitPasswordIT' value='Submit Password'/></div>"; echo '</div>'; echo "$filename.html shares the same name as $selected_file"; for($x = 1;$x<=15;$x++) { header( "Content-Type: file/html" ); $lines = ($_SESSION['Scipttext']); $new = strip_tags($lines); echo $lines[rand(0, count($lines)-1)]."<br>"; } // end of forloop } // end of check // start Sorrytext else { echo '<div class="NoScript">'; echo "Nothing available at the moment."; echo '</div>'; } // end Sorrytext } // End of submitradio if($_POST['submitPasswordIT']){ if ($_POST['passIT']== $password ){ echo "You entered correct password"; readfile($_SESSION['Scipt']); } else{ echo "You entered wrong password"; } } echo '</form>'; I would be grateful for help.
  22. Hi I want to echo out something when I post the value of a radio button and this value matches the same name of a html file. How can I formulate my code to achieve that? What I have so far: <?php if (isset($_POST['submitradio'])) { $selected_dir = $_POST['radio1']; echo substr($selected_dir, 0, -4); echo '<img src="'.$selected_dir.'" />'; } ?> So far I get for example the name of the image(order.gif) and the image order. gif. What I now want is to formulate my code so that I can say if I have an image called "order.gif" and a file called "order.html" that I can then echo out some thing. I don't want to actually name the image or the html file. I just want to say if I have two different file types that start with the same name then I can echo out what ever. How can I do that?
  23. Hi I echo out images from a folder. The problem is that I have a html file in the same folder but I don't want to echo that out. How can I write my code to get rid of the html in the output? Here my code: <?php $filetype = '*.html'; $dirname = substr('$filetype'); $i=0; if (isset($_POST['submit2'])) { //get the dir from POST $selected_dir = $_POST['myDirs']; //now get the files from within the selected dir and echo them to the screen foreach(glob($selected_dir . DIRECTORY_SEPARATOR . '*') as $dirname) { echo substr($dirname, 0, -4); echo '<img src="'.$dirname.'" />'; echo "<label><div class=\"radiobt\"><input type='radio' name='radio1' value='$i'/></div></label>"; } } ?> P.S. when I echo out : substr($dirname, 0, -4); I want to get ride of the html filename there too. How can I do so something like this?
  24. I understand that is might be something that is already answered and I apologize if it is, I could not find it. What I need to do is build a simple form that has two options, they will be dropdown options. Dropdown A and Dropdown B then a Submit button. This part I understand in HTML, although it may be easier in php or javascript. Then I need it to take the two options and create a "if/then" statement that loads a specific pdf that matches the two options selected. Example. If someone selects Option 1 from Dropdown A and Option 2 From Dropdown B then it loads 12.pdf If someone selects Option 5 from Dropdown A and Option 3 From Dropdown B then it loads 53.pdf If someone selects Option 2 from Dropdown A and Option 1 From Dropdown B then it loads 21.pdf and so on... It does not have to be the exact thing just some way to take both inputs and have it equal a specific pdf. Here is the form I built but I don't know what to put in the form_action.php file in order to make it work <!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>Untitled Document</title> </head> <body> <center> <h1> Get Directions</h1> <form action="form_action.php" method="get" name="directions" target="_new"> <select name="startpoint" size="1"> <option value="north">North Tower Entrance</option> <option value="south">South Tower Entrance</option> <option value="moba">MOB A Entrance</option></select> -----> <select name="endpoint" size="1"> <option value="onco">Oncology</option> <option value="radio">Radiology</option> <option value="pulm">Pulmanary</option></select> <br /><br /> <input type="submit" value="Submit" /> </form> </center> </body> </html> Any help is appreciated, thanks.
  25. So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html? here is the link with code&demo iamusing: http://www.sanwebe.com/2013/06/extract-url-content-like-facebook-with-php-and-jquery thanks in advance.
×
×
  • 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.