Jump to content

Ricky55

Members
  • Posts

    100
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Ricky55

  1. Thanks man. He's now saying this can be done in the Apache config using two ports. Getting a bit out of my depth to be honest.
  2. Hi guys, I have hired a developer to help me create an e-commerce project using Laravel. The customer admin and checkout were written by an in house dev that has since left who wrote these outside of Laravel, using Laravel for just the main admin to control orders etc. I told the new dev to throw away anything that didn’t make good sense or fit with modern best practices. He kept the two sections outside of Laravel, although he is using Laravel for authorisation. Looking at his code I have lost all confidence, I’m no expert but he has functions all over the place, repeated in different files there’s no OOP it looks a mess then yesterday he announced that I’d need two instances of php running on my server to get the site to even work. Not two different versions, the same version. I’ve never even heard of this. He said one for Laravel and one for the other parts of the site. Long story I know but what do you guys think? Is this possible? Is it a bad idea? What do you think of what I’ve said? I’ve googled around and it seems possible to run two different versions of php but that’s not what he’s talking about. Any advice very welcome and sorry if I’ve posted in wrong category. Thanks Richard
  3. Hi guys sorry for being a total noob but when I type this code I'm getting an error. Should this be wrapped in a if ? <?php $selector = (isset($_GET['selector']) ? isset($_GET['selector'] : false; switch($selector) { case 'supreme': $href = '/folding-beds/browse-by/supreme'; $text = 'Supreme Collection'; break; case 'deluxe': $href = '/folding-beds/browse-by/deluxe'; $text = 'Deluxe Collection'; break; case 'airflow': default: $href = '/folding-beds/browse-by/airflow'; $text = 'Beds with Airflow Fibre Mattresses'; break; } ?>
  4. As per usual you guys didn't let me down, best forum on the web is this IMO and I'm not just saying that. You can keep your Stack Overflow with their over restrictive rules. Thanks so much guys I really mean that. I do help people with stuff I know, I'm not just one of these lazy sods. I think I'll use Pyscho's suggestion. Mac_gyver yours looks cool but I don't fully understand it :-) Once again thanks!!!! Ps There are 10 options thats why I asked!
  5. Hi guys I only use PHP every now and again so my knowledge is basic at best. I have this code which is working. I was just wondering if there was a better way of writing this. <?php if(isset($_GET['selector'])) { $selector = $_GET['selector']; } if ($selector == 'airflow') { $href = '/folding-beds/browse-by/airflow'; $text = 'Beds with Airflow Fibre Mattresses'; } if ($selector == 'supreme') { $href = '/folding-beds/browse-by/supreme'; $text = 'Supreme Collection'; } if ($selector == '') { $href = '/folding-beds/browse-by/airflow'; $text = 'Beds with Airflow Fibre Mattresses'; } ?>
  6. Thanks for the reply. I didn't think it was actually specific to the plugin. It's more related to just php than it is to the plugin. Surely all info is in my post to provide an answer?
  7. Hi guys I'm using WordPress and the advanced Custom Fields plugin. I have a basic loop that spits out the code for a slider. I'm using the image caption to populate the href of the link. Currently only the first image carries a caption and therefore a link. I need to set my code up so it uses the link when the caption exists and without the link when it doesn't. The advanced custom fields plugin does have a "if field exists" but I just don't know how to write the code. Posted below is my code. <?php $the_query = new WP_Query(array( 'post_type' => 'slider', 'posts_per_page' => '1', )); while ($the_query->have_posts()) : $the_query->the_post(); ?> <?php $images = get_field('image_gallery'); if($images) : ?> <!-- Flex Slider --> <div class="flexslider entry-thumbnail"> <ul class="slides"> <?php foreach ($images as $image) : ?> <li><a href="<?php echo $image['caption']; ?>" data-lity><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>"></a></li> <?php endforeach; ?> </ul> </div> <?php endif; endwhile; ?> This is the basic example the advanced custom fields plugin gives you to use the if field exists. <?php if( get_field('field_name') ): ?> <p>My field value: <?php the_field('field_name'); ?></p> <?php endif; ?>
  8. where else can it be configured? I was changing it in Plesk in the PHP settings.
  9. Hi guys Bit of a PHP noob and the dev I use is away on holiday and I've got a client screaming at me, the usual carry on :-( I'm getting the following error Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32 bytes) in /var/www/vhosts/XXXXX.co.uk/httpdocs/os/system/database/drivers/mysql/mysql_result.php on line 167 The memory allocation was set to the default option of 128M I've tried increasing this to 2048M and it still errors. Php Info is reporting the new allocation too. Do I need to set this in the script? or restart the server? any tips would be massively appreciated. I think the app was created using Codeigniter, it uses the MVC framework anyway I know that much. (not sure if that has any bearing) Cheers guys.
  10. Guys just going back to the version, which would you recommend 5.5 or 5.6? A lot of my websites are wordpress if that has any bearing?
  11. oh I didn't realise it was an issue. I thought it sounded recent 5.3 to 5.4. Its my server actually so i better get that sorted. That worked by the way guys thanks very much. I just want to say that I find this the best forum I have use / used. You are all sound guys and are super quick and super helpful. Brilliant! Thanks Richard
  12. Hi guys I'm very much a PHP noob. I only use the very basics. I have the code below that I created with the help of this forum some time back. It just generates some random images. I've just uploaded this to my new server and all I get is a blank screen. I've tried displaying errors but none seem to display. My new server has PHP version 5.3.3 and my old server was using 5.4 I think. Can you spot anything that might be causing this issue? Is it something to do with that server root? Cheers in advance, as always any help will be very much appreciated. Richard <?php $root = $_SERVER['DOCUMENT_ROOT']; $path = '/_/images/brand-logos/'; $random = 4; $images = array_filter(glob($root . $path . "*.*"), function($v){ return in_array(strtolower(pathinfo($v, PATHINFO_EXTENSION)), ["gif", "jpg", "png"]); }); shuffle($images); $randomImages = array_slice($images, 0, $random); foreach($randomImages as $v) echo "<img src='" . substr($v, strlen($root)) . "' alt='" . ucfirst(pathinfo($v, PATHINFO_FILENAME)) . " Logo'>"; ?>
  13. Thanks guys. It turned out to be. Just wanted to also say how much I appreciate your answers. I've used this forum a few times and my questions have always been answered correctly and quickly. Great job guys. if(isset($_GET['varname'])) { $isTtex = $_GET['varname']; }
  14. Hi Guys PHP beginner here. I'm passing a variable via a link just so I can conditionally load some javascript. Its all working fine but I'm getting an undefined variable error. On my link I have: <form id="jtex" method="get" action="/folding-beds/"> <input type="hidden" name="varname" value="jtex"> <p><a href="javascript:{}" onclick="document.getElementById('jtex').submit(); return false;">View our range of J-Tex™ Folding Beds »</a></p> </form> Then on the page that this form links to I have $isTtex = $_GET['varname']; Then in my footer I'm using this code to conditionally load some javascript. <?php if (isset($isTtex)) : ?> // Run some JS <?php else : ?> // Run some other JS <?php endif; ?> I've turned off error reporting for a temp fix but I really want to fix properly. I've tried a few solutions I've found online but they seemed to prevent the variable being set at all. Should also say that this isn't anything to do with showing private data or anything like that so security is not a concern for this one. If you guys could shed any light I'd be very grateful. Thanks in anticipation. Ricky
  15. Unbelievable!!!! spent about an hour messing about with that. Thanks very much!!!!!!!
  16. Hi guys Hoping you can help me with this. I'm very much a front end person, I know HTML, CSS and some JS but when it comes to PHP and very much a newbie. I'm using this code to process a straight forward contact form. I'm using the PHP Mailer as I need to use an external smtp server and the company I use for this provided some basic code. Its working but I'm getting a error flash up before I see the success page that says "Undefined variable: message in send.php on line 25. Why is this happening and how do I fix it? Thanks guys. my code <?php require("PHPMailerAutoload.php"); // path to the PHPMailer class. $after = "/contact/thanks.php"; $oops = "/contact/error.php"; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Mailer = "smtp"; $mail->Host = "smtpcorp.com"; $mail->Port = "2525"; $mail->SMTPAuth = true; $mail->Username = "name@hotmail.com"; $mail->Password = "xxx"; $mail->From = "name@hotmail.com"; $mail->FromName = "Richard Dale"; $mail->AddAddress("name@hotmail.com", "Rachel Recipient"); $mail->AddReplyTo("name@hotmail.com", "Sender's Name"); $mail->Subject = "Contact enquiry from the website"; $message .= "How can we help: {$_POST['help']} \n\n"; $message .= "Name: {$_POST['name']} \n\n"; $message .= "Email: {$_POST['email']} \n\n"; $message .= "Telephone: {$_POST['tel']} \n\n"; $message .= "Message: {$_POST['message']} \n\n"; $message .= "Address: {$_POST['address']} \n\n"; $mail->Body = $message; $mail->WordWrap = 50; if(!$mail->Send()) { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$oops\">"; } else { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">"; } ?>
  17. Tried that guys but it just prints the strong tags i.e. it doesn't make the text bold. What else do I need to do to make the HTML be inerpreted? The code I used was $message = 'Cushion Refilling Service: <strong>' . htmlspecialchars($_POST['cushion-refilling'], ENT_QUOTES, 'UTF-8') . "</strong>\n\n";
  18. Hi, Total PHP noob, obviously. I want some form submission results to be in bold text. So I have: $open = echo htmlentities("<strong>"); $close = echo htmlentities("</strong>"); $message .= 'Cushion Refilling Service: ' . $open . $_POST['cushion-refilling'] . $close . "\n\n"; How should I be doing this? Thanks Richard
  19. Thanks. After further testing, it seems that its working in OS X Safari but not in Windows 7 Chrome. Totally bizarre. I've turned on error reporting but nothing is shown. Some errors appear in the log but none of them seem to relate to this. When you get redirected the URL is correct, if you hit refresh the page loads. For some reason it just hangs when left, if you leave it long enough the content does load. Is there anything else I can try?
  20. Hi guys New to OpenCart. Just created a site using it. I'm using Sage Pay. Payments are going through correctly but following the final stage of Sage Pay I get bounced back to: domain/index.php?route=checkout/success Which is the correct behaviour but this page doesn't load correctly. The page title appears but I just get a blank screen with no content. After about 30 minutes the page loads. I can visit the page directly so the page is there and working. Is there anything I can check to see why its not loading? Should also say that payments are being processed correctly and the correct emails are going to customers etc.
  21. Hi guys I've cobbled together this script to process a form with a file attachment. It works fine but it doesn't have any validation for the form or the file which isn't great and I'd like to add, currently I'm just using Javascript validation. Before I move on to the validation, can you see why the form processes twice? I get one email with the processed info and one or two blank. My knowledge of PHP is beginner at best. My code. Thanks in advance. <?php $recipient = "richard@domain.com"; $subject = "Job Application"; $message .= "Name: {$_POST['name']} \n\n"; $message .= "Date of Birth: {$_POST['dob']} \n\n"; $message .= "Telephone: {$_POST['telephone']} \n\n"; $message .= "Email: {$_POST['email']} \n\n"; $message .= "Home Address: {$_POST['address']} \n\n"; $message .= "The Question Section\n\n"; $message .= "Showroom answer: {$_POST['showroom']} \n\n"; $message .= "Latex cushions answer: {$_POST['latex']} \n\n"; $message .= "Window seat answer: {$_POST['cushion']} \n\n"; $message .= "Directions answer: {$_POST['directions']} \n\n"; $message .= "Competitors answer: {$_POST['competitors']} \n\n"; $message .= "Benefits answer: {$_POST['benefit']} \n\n"; $headers .= "From: {$_POST['email']}"; // GET FILE VARIABLES $tmpName = $_FILES['attachment']['tmp_name']; $fileType = $_FILES['attachment']['type']; $fileName = $_FILES['attachment']['name']; if (file($tmpName)) { // READING IN FILE BINARY $file = fopen($tmpName,'rb'); $data = fread($file,filesize($tmpName)); fclose($file); // A BOUNDARY STRING $randomVal = md5(time()); $mimeBoundary = "==Multipart_Boundary_x{$randomVal}x"; // HEADER FOR FILE ATTACHMENT $headers .= "\nMIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed;\n" ; $headers .= " boundary=\"{$mimeBoundary}\""; // MULTIPART BOUNDARY ABOVE MESSAGE $message = "This is a multi-part message in MIME format.\n\n" . "--{$mimeBoundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // ENCODING FILE DATA $data = chunk_split(base64_encode($data)); // ADDING ATTACHMENT TO MESSAGE $message .= "--{$mimeBoundary}\n" . "Content-Type: {$fileType};\n" . " name=\"{$fileName}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mimeBoundary}--\n"; } $flgchk = mail ($recipient, $subject, $message, $headers); if($flgchk) { echo ('<p style="font-family: sans-serif; font-size: 1.2em; padding-top: 2em; text-align: center;">Thanks your application was sent successfully. You can now close this window.</p>'); } else { echo ('<p style="font-family: sans-serif; font-size: 1.2em; padding-top: 2em; text-align: center;">Sorry but there was an error sending your application, try emailing andrew@foamforcomfort.co.uk instead.</p>'); } ?>
  22. Hi I am wanting to create this basic HTML5 video player as detailed in this wireframe https://dl.dropboxusercontent.com/u/508261/screen.png One of my colleagues has given me some basic code that seems like it will work, I was just wondering if this is the best way of achieving this? I don't really want to use a javascript solution as these video tags will contain multiple source files. The code: <?php $div_contents = array("<video>I am video one</video>", "<video>I am video two</video>", "<video>I am video three</video>"); ?> <div id="video-container"> <?php echo $div_contents[$_GET['div_id']]; ?> </div> <a href='index.php?div_id=1'>Next Video</a> Thanks Richard
×
×
  • 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.