Jump to content

mark107

Members
  • Content Count

    74
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mark107

  • Rank
    Regular Member

Recent Profile Visitors

1,178 profile views
  1. I cant remove the "185.220.101.46" because it come with it when i'm getting access to the site which i am not allowed to post it. So what I have to do then? Create a foreach loop to fetch the values and store in the array?
  2. I have tried this: echo $data->data['185.220.101.46']->appears; it doesn't work. Any idea? It would be easier if you could post the code of what i should use.
  3. T Thanks for your advice, I have removed it but I cant get the value of `appears` from the array as I am getting the same error. Any idea?
  4. Hi all, I need some help with my code as I have a hard time with fetching the value from the stdclass. I am using json data to convert it to PHP so I would like to fetch the "appears" data from the stdclass object. When I try this: echo $data->appears; I'm getting this: Notice: Trying to get property of non-object in /home/username/public_html/foldername/script.php on line 22 I have also tried this: echo $data[0]->appears->value; And this: echo $data->appears[0]->value; I am still get the same error so I dont know what to do to resolve it. Full code: <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $json = '{"data":{"185.220.101.46":{"domains_count":0,"domains_list":null,"updated":"2019-12-02 22:04:25","spam_rate":1,"frequency":6827,"frequency_time_24h":106,"frequency_time_1h":2,"network_type":"hosting","in_antispam":1,"in_security":0,"appears":1,"country":"DE","submitted":"2018-01-11 20:34:37","frequency_time_10m":2,"sha256":"e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248"}}}'; // Converts it into a PHP object $data = json_decode($json, true); //print_r($data); echo $data["appears"]->value ."<br/>"; //var_dump($data[1]->{'updated'}); //echo $data->updated[1]->value; ?> STDClass object: Array ( [data] => Array ( [185.220.101.46] => Array ( [domains_count] => 0 [domains_list] => [updated] => 2019-12-02 22:04:25 [spam_rate] => 1 [frequency] => 6827 [frequency_time_24h] => 106 [frequency_time_1h] => 2 [network_type] => hosting [in_antispam] => 1 [in_security] => 0 [appears] => 1 [country] => DE [submitted] => 2018-01-11 20:34:37 [frequency_time_10m] => 2 [sha256] => e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248 ) ) ) Var_dump: array(1) { ["data"]=> array(1) { ["185.220.101.46"]=> array(15) { ["domains_count"]=> int(0) ["domains_list"]=> NULL ["updated"]=> string(19) "2019-12-02 22:04:25" ["spam_rate"]=> int(1) ["frequency"]=> int(6827) ["frequency_time_24h"]=> int(106) ["frequency_time_1h"]=> int(2) ["network_type"]=> string(7) "hosting" ["in_antispam"]=> int(1) ["in_security"]=> int(0) ["appears"]=> int(1) ["country"]=> string(2) "DE" ["submitted"]=> string(19) "2018-01-11 20:34:37" ["frequency_time_10m"]=> int(2) ["sha256"]=> string(64) "e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248" } } } Can you please show me an example how I can fetch the `appears` from the stdclass object? Any advice would be much appreciated.
  5. Thank you, I can see it is working great thanks.
  6. Thank you very much for this, but when I try this: if(strtotime($get_time) < strtotime("now")) { $autoresponder_date = strtotime($get_time. "+ 1 day"); } echo $autoresponder_date; I am getting this: 1575042480 Any idea how i can convert it to date with the time?
  7. Yes this is what I am trying to do. I want to see if the hour has gone past and increment the date. How I can do that? Do I have to use something like this? if (date('H') > $get_time) { //let do something }
  8. Hi all, I am working on my PHP script to set up the date with the time for the autoresponder so I can send out the emails at the specific time. I need some help with set up the correct day date with the time, because on my code when I have two different times `06:00` and `20:00`, as both of them will show the time with the current day date, e.g: 28-11-2019. I find that my code have set up the date as incorrect because the time I have `06:00` which it should have set up with the next day date, e.g 29-11-2019 instead of 28-11-2019 and the time `20:00` should set up with the current day date as my current time is `15:26pm` right now. Output for `$autoresponder_date`: 2019-11-25 06:00 2019-11-25 20:00 Output for `$get_time`: 06:00 20:00 Here is the code: $auto_responders = $link->prepare('SELECT * FROM autoresponder WHERE campaign = ? ORDER BY id ASC'); $auto_responders->execute([$campaign]); $auto_responders->setFetchMode(PDO::FETCH_ASSOC); $auto_responders = $auto_responders->fetch(PDO::FETCH_ASSOC); $get_time = $auto_responders['send_time']; if ($get_time >= strtotime('00:00')) { $autoresponder_date = date('Y-m-d', strtotime($get_time . ' +1 day')); } else { $autoresponder_date = date('Y-m-d', strtotime($get_time)); } $send_time = $autoresponder_date . ' '. date('H:i ', strtotime($get_time)); Can you please show me an example how I can set up the day date for the time `06:00` and `20:00` as if I have the time is `06:00` then check if the time have passed before I could do anything to send the email and it is the same for the time `20:00:00`? Thank you.
  9. Yes. Can you also answer my questions regards to db that if it is a good idea to encode the HTML to store the hash in a db?
  10. Ok, I have come across to this post https://stackoverflow.com/questions/37338770/php-how-to-save-html-string-into-database It say that I can encode the HTML to store the hash in a database and when I get the hash I can decode them to go it back to where it was. Do you think if it is a good idea to do this to encode the HTML so I can store the hash in a database?
  11. No one have told me to do it. I have got emails that come with images in the HTML so I'm storing them in a db. I have got no idea how to store the DATA in a db when I'm fetching my emails using imap.
  12. Thank you for your advice. I have been modified on the code to add the attid, message-id and the filename so am I good to go? Here is what it look like: 1562453336 attid: 0.1 msessage-id: 455a7a38554a364e577233426974544a4c49397359513d3d filename: noname.gif 1562453336 attid: 0.2 msessage-id: 455a7a38554a364e577233426974544a4c49397359513d3d filename: what-is-bootstrap.png --------------------------Image body 1562023807 attid:0 msessage-id: 655337787a6b7957356e316468667431736d415944673d3d filename: chromegmailnew-vertical-allowed-1366.png 1562023807 attid:1 msessage-id: 655337787a6b7957356e316468667431736d415944673d3d filename: example.png --------------------------test attachment 11 1562014561 attid:0 msessage-id: 706b337a314d6b30563352484d615461764a594461513d3d filename: example.png 1562014561 attid:1 msessage-id: 706b337a314d6b30563352484d615461764a594461513d3d filename: chromegmailnew-vertical-allowed-1366.png --------------------------Test attachments no 9 1562013859 attid:0 msessage-id: 77634b38635a39596a6b56465a314e4d574531776b773d3d filename: chromegmailnew-vertical-allowed-1366.png 1562013859 attid:1 msessage-id: 77634b38635a39596a6b56465a314e4d574531776b773d3d filename: chromegmailnew-vertical-allowed-1366.png 1562013859 attid:2 msessage-id: 77634b38635a39596a6b56465a314e4d574531776b773d3d filename: example.png 1562013859 attid:3 msessage-id: 77634b38635a39596a6b56465a314e4d574531776b773d3d filename: example.png --------------------------Test attachments no 6 I think it would be easier if I put them in the attachments column with attid, message-id and filename so I can find the filename I am looking for using attid following by id that I search through in a database. Please let me know if I am doing it correct so I will insert these data to be storing in a database. However, I have been told that it would not be a good idea to store the images and attachments in a database so I would need to use fwrite to store the data on my server. Here is the Email Table: id - I use INIT to store my name and email address uid - I use TEXT to store emails uid from_email - I use TEXT to store the name and sender email address to_email - I use TEXT to store my name and email address subject - I use TEXT to store the subject message - I use BLOB to store the messages in HTML attachments - I use BLOB to store the attachments in HTML header - I use BLOB to store the header as HTML readtype - I use TEXT to store the text as read/unread received_date - I use datetime to store the date and time when they sent the emails If you find anything wrong with my database or what changes I would need to make so please let me know. I have storing the email body as HTML in a database so am I good to go? As for the other file index.php, you can see in my code that I am using the variables to get the id, attid and messageid from the address bar. I guess that if I want to find the images to display, I would have to use `$_GET['id']` to get the id from the address bar to find it through in a database row for that email, then I would have to use `$_GET['attid']` to find the string for the attid in the attachments column to get the strings for the filename so I could link it to where the files are located on my server. Am I correct?
  13. Oh I see, I can see I have make a mistake so I will need to change the code again. I am just learning what I must do and what I must do as I am doing this for the first time never done this before. So when I store the message-id, attach-id and filename in a database, how I can get the images to display in index.php when I click to open my emails?
  14. Yep, I am storing the attachments as HTML in a database. Why I don't do that? Do I have to remove the HTML tags and store the filenames, message-id, attach-id in a database just like this? How I can make the html tags? Do I have to make the html tags when I click on my emails to fetch the message-id, attach-id and filename from the database to make the html tags to put them on my page?
  15. What you mean by which part contains the image tag? i am only using the image tag like <img where you can see in the attached pics. No I dont have a column for filenames but I have a column called attachments that I have stored the html tags in a database with the filename like this: <a id='download_attachment' role='link' class='aQy e' href='http://example.com/project433q325/u/?id=71664b6a654a6176434c346c773348337054733779413d3d&attid=0&msgid=1630808059112201633&view=attachment&display=download' data-tooltip-align='t,c' data-tooltip-class='a1V' tabindex='0' ><div aria-hidden='true'><div class='aSH'><div class='attachment_top'><div class='attachment_center' style='height: 115px;'><img id='0' class='attachment_image' src='http://example.com/project433q325/u/?id=71664b6a654a6176434c346c773348337054733779413d3d&attid=0&msgid=1630808059112201633&view=attachment&display=view' alt=noname.gif></div></div></div></div><div class='aSI'><div id='q5' class='aSJ' style='border-color: #fff'></div></div></a><a id='download_attachment' role='link' class='aQy e' href='http://example.com/project433q325/u/?id=71664b6a654a6176434c346c773348337054733779413d3d&attid=1&msgid=1630808059112201633&view=attachment&display=download' data-tooltip-align='t,c' data-tooltip-class='a1V' tabindex='0' ><div aria-hidden='true'><div class='aSH'><div class='attachment_top'><div class='attachment_center' style='height: 115px;'><img id='1' class='attachment_image' src='http://example.com/project433q325/u/?id=71664b6a654a6176434c346c773348337054733779413d3d&attid=1&msgid=1630808059112201633&view=attachment&display=view' alt=what-is-bootstrap.png></div></div></div></div><div class='aSI'><div id='q5' class='aSJ' style='border-color: #fff'></div></div></a> I guess i might have to use jquery to do this job??
×
×
  • 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.