Jump to content

Destramic

Members
  • Posts

    954
  • Joined

  • Last visited

Everything posted by Destramic

  1. well the tablet would't have a verfication pin...but i planned on having 1 table ie. network_contracts to hoild users contratcs such as sim only, mobile and tablet. the verification pin is for when a user adds sim only / mobile, a pin is then sent to users phone number which needs to be verified.
  2. 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, verification_pin) VALUES (1, 123456, 'Sim Only', 7676) any help/advise would be greatly appreciated. thank you guys
  3. 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
  4. 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
  5. Oh also Cross Site Scripting Attacks...hackers will have a field day on your server
  6. 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.
  7. 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?
  8. 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.
  9. 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
  10. mysqli_query($con, $query); as seen here http://php.net/manual/en/mysqli.query.php
  11. 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
  12. 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); } else { ?> <form method="post"> what is your favourite ice cream flavor? <input name = "flavor" type = "text"> <br> <br> what is your name? <input type = "text" name = "name" > <br> <br> <input type = submit value = submit > </form> <?php } ?> </body> </html>
  13. what errors have you got?...also if your storing in the database you want to be using DATE field type
  14. sorry i after a second glance i saw this...sorry! (no0b) embarrassing
  15. 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
  16. 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?
  17. 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) { //check result and remove for list }, error: function(jqXHR, satus, error){ console.log(status, error); } }); }); }); html news article - php is the best - <span data-delete-news-id="5">delete</span> no need for a form or to reload page...hope this helps...also you going to want to look at stopping cross site forgery attacks hence the csfr: 'token here' parameter
  18. 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
  19. 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); break; case 6: $image = imagerotate($image, -90, 0); break; case 8: $image = imagerotate($image, 90, 0); break; } } }
  20. Check $_GET['xmax'] value as i would say it's empty
  21. 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)
  22. 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
  23. 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 Content-Type: text/html; charset="utf-8" Sever: <span>here is our logo</span> <img src="cid:logo.png@domain.co.uk" width=" 192" height="50" title="Logo" alt="Logo"> --aaf2651d4917027cd4c6a335082910a5 Content-Type: image/png; name="logo8.png" Content-Transfer-Encoding: base64 Content-ID: <logo.png@domain.co.uk> Content-Disposition: inline; name="logo8.png" iVBORw0KGgoAAAANSUhEU.........b0vX7fAAAAAElFTkSuQmCC --aaf2651d4917027cd4c6a335082910a5-- --fae15ab6820aee7cab838cf3b8f5ef37-- i hope this can help other people out...thank you
  24. 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; boundary="f81c1c99aa6cb085a26b84813c0a2fd6" [18] => This is a multi-part message in MIME format. [19] => --f81c1c99aa6cb085a26b84813c0a2fd6 [20] => Content-Type: multipart/alternative; boundary="1f04e7b81c18373984b26f1e64f9b83e" [21] => --1f04e7b81c18373984b26f1e64f9b83e [22] => Content-Type: text/plain; charset="utf-8" [23] => Content-Transfer-Encoding: quoted-printable [24] => Content-Transfer-Encoding: 7bit [25] => plain email here [26] => --1f04e7b81c18373984b26f1e64f9b83e [27] => Content-Type: text/html; charset="utf-8" [28] => Content-Transfer-Encoding: quoted-printable [29] => Content-Transfer-Encoding: 7bit [30] => <!DOCTYPE html> <head> <title>Account</title> </head> <body> <span>here is our logo</span> <img src="cid:logo.png@mydomain.co.uk" width="192" heigh t="50" title="Logo" alt="Logo"> </body> </html> [31] => --1f04e7b81c18373984b26f1e64f9b83e-- [32] => --f81c1c99aa6cb085a26b84813c0a2fd6 [33] => Content-Type: image/png; name="logo8.png" [34] => Content-Transfer-Encoding: base64 [35] => Content-ID: <logo.png@mydomain.co.uk> [36] => X-Attachment-Id: logo.png@mydoamin.co.uk [37] => Content-Disposition: inline; filename="logo8.png" [38] => iVBORw0KGgoA....gABI1QMAACD1AZpW [39] => --f81c1c99aa6cb085a26b84813c0a2fd6-- any other suggestion would be great...i've looked a so much regarding embedded inline images and i can't see nothing else that i may be missing...i'm feeling there's something else that needs to be added to my headers though. i even sent myself an email from my gmail account with an embedded image and tried to cross reference but all formats i saved we're barely readable. thank you
×
×
  • 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.