Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Gomo

  • Rank
  1. Hey there! I've got my "opening hours" managed via JS and atm it looks like this: var checkTime = function () { "use strict"; var now = new Date(); var messageDiv = document.getElementById('messageDiv'); var dayOfWeek = now.getDay(); var hour = now.getHours(); if ((dayOfWeek > 0 && dayOfWeek < 3 && hour >= 9 && hour < 18) || (dayOfWeek > 3 && dayOfWeek < 6 && hour >= 9 && hour < 18) || (dayOfWeek === 6 && hour >= 10 && hour < 14) || (dayOfWeek === 3 && hour >= 9 && hour < 14)) { messageDiv.innerHTML = 'We are open!'; messageDiv.className='open'; } else { messageDiv.innerHTML = 'We are closed!'; messageDiv.className='closed'; } }; setInterval(checkTime, 1000); checkTime(); Is there maybe a more "elegant" solution to this? .. I wanted to add launch break for every working from 12:00h to 13:00h and realized how messy it would get. I'm not that experienced with JS, so yeah, your help would mean a lot to me! Thanks in advance!
  2. Gomo

    PHPmailer help

    Did a bit more digging, and managed to fix the problem. This setting was causing problems: App passwords not working If you’ve double-checked to make sure you’ve entered the App Password in correctly but it’s still not working, try going to https://g.co/allowaccess on your device’s browser. Enter your username and password, then type the letters on the screen. Then go back to the application you're trying to access and enter your App Password. https://support.google.com/accounts/answer/185834?hl=en#ASPs Thanks for the help! p.s both TLS and SSL settings/ports work fine
  3. Hello guys, I've been trying to get my PHPmailer to work for quite some time now. What am I doing wrong here? (I keep getting this error message "Message could not be sent.Mailer Error: SMTP connect() failed") This is the PHP code: <?php require 'phpmailer/PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'test@gmail.com'; // SMTP username $mail->Password = 'test'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 465; // TCP port to connect to $mail->setFrom('test@gmail.com', 'Mailer'); $mail->addAddress('test1@gmail.com'); // Add a recipient //$mail->addAddress('ellen@example.com'); // Name is optional //$mail->addReplyTo('info@example.com', 'Information'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name //$mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'Name:'.$_POST['field1'].'<br /> Surname:'.$_POST['field2'].'<br /> Phone:'.$_POST['field3'].'<br /> Email:'.$_POST['field4'].'<br /> Subject:'.$_POST['field5'].'<br /> Message:'.$_POST['field6'].''; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ?> Contents of my "phpmailer" folder. Also, "Access for less secure apps" has been enabled on my Gmail account. Any help would be greatly appreciated! -kind regards- Gomo
  4. Error is not format related, most of the time he gets this "Hersteller not set" even tho he fills out every single field.
  5. Hello guys, I've written this code for my website so that I can upload pictures & attach description to the them. The problem is, it works fine for me (PC & phone), but whenever my friend tries to upload one himself, he gets an error (btw this is for cars). Could somebody please take a look at it, see if I'm doing something wrong, or maybe have a better suggestion for it? Thanks a bunch! HTML: <div id="main"> <form action="upload.php" method="POST" enctype="multipart/form-data"> <div class="clear"> <br><br> <div class="col3"> <input type="file" name="file[]" id="browse" multiple required/><br /> </div> <div class="col3"> <div id="brprev">Bitte eine Bild auswählen!</div> <br /> </div> <div class="col3"> <div class="inp"> <label>Hersteller</label> <input type="text" name="text1" required> </div><br> <div class="inp"> <label>Model</label> <input type="text" name="text2" required> </div><br> <div class="inp"> <label>Baujahr</label> <input type="text" name="text3" required> </div><br> <div class="inp"> <label>Km Stand</label> <input type="text" name="text4" required> </div><br> <div class="inp"> <label>PS / KW</label> <input type="text" name="text5" required> </div><br> <div class="inp"> <label>Kraftstoff</label> <input type="text" name="text6" required> </div><br> <div class="inp"> <label>Getriebe</label> <input type="text" name="text7" required> </div><br> <div class="inp"> <label>TÜV & AU</label> <input type="text" name="text8" required> </div><br> <div class="inp"> <label>Preis</label> <input type="text" name="text9" required> </div><br> <div class="inp"> <label>Beschreibung</label> <textarea name="text10" required></textarea> </div><br> <input type="submit" value="Hochladen" id="submit"/> </div> </div> </form> <br> <br> <form action="delete.php" method="POST"> Bild Nummer eintragen: <input type="text" name="delid" required> <input type="submit" value="Bild Löschen" id="submit"/> </form> PHP (upload): <?php if(!isset($_POST['text1'])||empty($_POST['text1'])) die("Hersteller not set!"); if(!isset($_POST['text2'])||empty($_POST['text2'])) die("Model not set!"); if(!isset($_POST['text3'])||empty($_POST['text3'])) die("Baujahr not set!"); if(!isset($_POST['text4'])||empty($_POST['text4'])) die("Km Stand not set!"); if(!isset($_POST['text5'])||empty($_POST['text5'])) die("Preis not set!"); $kcc=1; $location = 'Images/'; $id = @file_get_contents($location.'c.txt')+1; file_put_contents($location.'c.txt',$id); $data = $_POST['text1']."\r\n"; $data.= $_POST['text2']."\r\n"; $data.= $_POST['text3']."\r\n"; $data.= $_POST['text4']."\r\n"; $data.= $_POST['text5']."\r\n"; $data.= $_POST['text6']."\r\n"; $data.= $_POST['text7']."\r\n"; $data.= $_POST['text8']."\r\n"; $data.= $_POST['text9']."\r\n"; $data.= str_replace("\n", '', $_POST['text10'])."\r\n"; $data.= sizeof($_FILES['file']['name']).'-images'."\r\n"; file_put_contents($location.$id.'.txt',$data); foreach($_FILES['file']['name'] as $k=>$v){ $name = $_FILES['file']['name'][$k]; $size = $_FILES['file']['size'][$k]; $type = $_FILES['file']['type'][$k]; $extension = pathinfo($name, PATHINFO_EXTENSION); $max_size = 20971520; $tmp_name = $_FILES['file']['tmp_name'][$k]; $error = $_FILES['file']['error'][$k]; if (isset($name) && !empty($name)) { if (($extension=='jpg' || $extension=='jpeg' || $extension=='png') && $size<=$max_size) { move_uploaded_file($tmp_name, $location.$id.'_'.($kcc++).'.png'); echo 'Bild wird hochgeladen!<br>'; } else { echo 'Bitte eine Bild auswählen!<br>'; } } else { echo 'Bild muss ein jpg/jpeg/png Typ sein und kleiner als 20mb!<br>'; } } ?> <script> setTimeout(function(){ window.location.href = 'http://www.google.com'; }, 3000); </script> [Every image upload creates a '.txt' file in the folder "Images" where the info is stored] PHP (delete): <?php $id = isset($_POST['delid'])?intval($_POST['delid']):0; if($id){ if(file_exists('Images/'.$id.'.txt')){ $data = file('Images/'.$id.'.txt')[10]; unlink('Images/'.$id.'.txt'); for($i=1;$i<=$data;$i++){ if(file_exists('Images/'.$id.'_'.$i.'.png')) unlink('Images/'.$id.'_'.$i.'.png'); } }elseif(file_exists('Images/'.$id.'_1.png')) unlink('Images/'.$id.'_1.png'); echo 'Bild wurde gelöscht!'; } ?> <script> setTimeout(function(){ window.location.href = 'http://www.google.com'; }, 3000); </script> I'd really appreciate your help!
  • 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.