Jump to content

Destramic

Members
  • Content Count

    954
  • Joined

  • Last visited

Everything posted by Destramic

  1. hey guys im wanting to check if a row exists then update, else insert. i've been trying to get this query to work, but i'm not having much luck...i know some of you will say to use ON DUPLICATE KEY and make column phone_number primary key but that won't work as contract type column could be TABLET which has no phone number. IF EXISTS (SELECT network_contract_id FROM network_contracts WHERE phone_number = 123456 AND user_id = 1) UPDATE network_contracts SET verification_pin = 9891 WHERE user_id = 1 ELSE INSERT INTO network_contracts(user_id, phone_number, contract_type, v
  2. thank you kicken for the useful information...i've look into purchasing a GSM Router and hopefully will go ahead with setting up my own gateway, but firstly i need to speak with the mobile network providers in the UK to ensure i'm not breaking any the T&C's by doing this. seems like a simple process to set up the hardware, also i see some scripts online that can process the AT commands to the com device....not sure if this is any good though. https://drive.google.com/file/d/0B0NgcxAkZSCHS2MzUEtQMWZYWUc0QmF0RzNBMUItck8wZUtR/edit thanks again
  3. hey guys, im wanting to send sms via php, but have no real know how or experience with it....and don't want to be throw my money into the wrong places. i see there is a lot of companies out there where i can buy text bundles from and then use thier api to send an sms, which is great...but is there a way to cut the middle man out? if not could someone recommend me a company? thank you
  4. Oh also Cross Site Scripting Attacks...hackers will have a field day on your server
  5. You need to check $_GET['id'] exists...also your code is vulnerable to Cross-Site Request Forgery Atacks (CSRF) and SQL Injection I'd suggest to use PHP PDO instead of the mysqli extension.
  6. why would you want store html in a database? what you need to do it store necessary data, such as article name, article, user_id, timestamp etc. what parts are you struggling with so we can help you further?...creating a database table...using PDO?
  7. what i also i should of mentioned is that you need to escape all user data using mysqli_escape_string() failure to do so can result in SQL injection $username = mysql_escape_string($_POST['username']); this wouldn't be a problem if you used PDO and prepared queries.
  8. seriously?...i just gave you the documentation referring to mysqli_query as well as the code for your first mysql insert $data = mysqli_query ($query)or die(mysqli_error()); should be $data = mysqli_query($con, $query) or die(mysqli_error($con)); i'm more than sure you can work out the other...if not, give up but i would suggest to use PDO http://php.net/manual/en/book.pdo.php
  9. mysqli_query($con, $query); as seen here http://php.net/manual/en/mysqli.query.php
  10. hey guys i wish to make a simple form for users/guest to share my wesbite to friends etc. i'm mostly concerned that this will allow people to spam address from my site...should i be concerned?...if so what is the best approach please? i was thinking about collecting the shared email's to a db? ensuring only 1 ever gets sent...is this enough thank you
  11. please use the code tags so it makes things easier for people to read. i can see an error here: if (isset($_REQUEST ["flavour"]) ) { //<input name = "flavor" type = "text"> which should be if (isset($_REQUEST["flavour"])) { //<input name = "flavour" type = "text"> why don't you try something like this? <html> <head> <title> using one page to accept and process data. </title> </head> <body> <h1> using one page to accept and process data. </h1> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { print_r($_POST); } el
  12. what errors have you got?...also if your storing in the database you want to be using DATE field type
  13. sorry i after a second glance i saw this...sorry! (no0b) embarrassing
  14. my age is displaying as 29 although i'm 30...not complaining but something isn't right. also my dob is correct on my profile thank you
  15. check out fgetcsv http://www.php.net/manual/de/function.fgetcsv.php why are you exporting database table, then reading from a csv?...why not read directly from the database?
  16. the script isn't fully functional but something like this...i guess you have a list of news or whatever it is your listing form the database, which you want to be able to delete but also keep the list in view with successful/error messages. jquery $(document).ready(function(){ $('span[data-delete-news-id]').click(function(event) { var data = { id: $(this).data('delete-news-id') csfr: 'token here' }; $.ajax({ url: 'http://domain/delete', type: 'POST', data: data, dataType: 'text', success: function(result) { //chec
  17. There is probably a much easier way but why don't you check the phone make is apple and image is portrait then just rotate? Wouldn't be a bad solution if the script is only for your personal use...although would be nice to make the script universal
  18. i'd check the orginal image orientation before uploading...as i can't see anything obvious that would rotate the image before saving the image may have embedded image rotation infomation set by your phone. check for orientation key print_r(exif_read_data($filename)); i come across this function also which may help. function image_fix_orientation(&$image, $filename) { $exif = exif_read_data($filename); if (!empty($exif['Orientation'])) { switch ($exif['Orientation']) { case 3: $image = imagerotate($image, 180, 0);
  19. Check $_GET['xmax'] value as i would say it's empty
  20. also what i forgot to mention is that if your using user inputted data ie. $_POST then you need to escape it using $_POST['email'] = htmlspecialchars($_POST['email'], ENT_QUOTES, 'UTF-8'); your code is vulnerable to cross site scripting attacks (XXS)
  21. you should be able to read this better...also using the echo where it is, is incorrect. $form_output = '<p><label for="email">Notification email (IMPORTANT!) <span>*</span><br><input type="text" name="email" value="' . $_POST["email"] . '"></label></p>'; this should do the trick
  22. i had a brain storm last night and sent the email via phpmailer and viewed what was actually being sent to the server...this format works perfectly now for alternative mail with embedded images. Content-Type: multipart/alternative; boundary="fae15ab6820aee7cab838cf3b8f5ef37" Content-Transfer-Encoding: 8bit This is a multi-part message in MIME format. --fae15ab6820aee7cab838cf3b8f5ef37 Content-Type: text/plain; charset="utf-8" plain email here --fae15ab6820aee7cab838cf3b8f5ef37 Content-Type: multipart/related; boundary="aaf2651d4917027cd4c6a335082910a5" --aaf2651d4917027cd4c6a335082910a5 C
  23. i tried what you said kicken and still have no joy...i also tried cid:logo@mydomain.co.uk here is my altered code [7] => SUBJECT: test email [8] => FROM: mydomain.co.uk<****> [9] => TO: ***** [10] => MIME-Version: 1.0 [11] => Organization: mydomain.co.uk [12] => X-Priority: 3 [13] => X-Mailer: PHP7.0.10 [14] => Message-ID: <6af3b38673bc078a1bf662e27843477b@mydomain.co.uk> [15] => Date: Wed, 04 Jan 2017 17:39:27 +0000 [16] => Return-Path: ****@mydomain.co.uk [17] => Content-Type: multipart/related; bound
  24. Thank you...first time I've seen that...also I've seen examples without the content-disposition in line header. I'll give it whirl when I'm home and post my results Thanks again
×
×
  • 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.