I'm creating a site in PHP and MySQL that when an image is emailed to us at adress#example.com from someone's phone, I want the image to be automatically posted to their account page that is tied to the email address that they registered with us.
Also, I would like the subject of the email to determine what category the email falls under. So lets say the email had the subject of 3. Then it would give it the category ID of 3.
So lets say we have a users table with
user_id
email_address
name
and an image table with the following fields
image_id
category_id
user_id
image_name
The category table will be
category_id
category_name
Is there something I need to be doing with our mail server? Also should I be storing the image in the database or as a file?
This site will not get a lot of traffic and will only be used for one weekend. I'm guessing no more than 5000 images but I could be wrong.
Look at procmail for passing emails into scripts. Images should definitely be stored as files. You'll have to parse the email you receive and base64_decode the appropriate chunk to get the image data.
Related
I'm trying to make an Address book with different users in which they can log in with their username and password. And they can store the information like contact id, first name, last name, phone etc. I want each user to have his own address book.
Can someone please explain how I create different address book for different users.
Thanks a lot.
Create a database. take a primary id to each user or provide unique id.Then create another table fill the fields that you want(address book).Match the user who logged in and and with that another table(foreign key relationship).
When you login ..it checks with db then allows.After that you have to use insert ,update keywords for further process to put data in db.That particular unique id/primary key is used to fetch the related data(address book fields) of that user.
It is actually not a good question for StackOverflow but I will still roughly explain it to you.
You will need two different tables for this. The first one will be used for login details and the second one will record user's address book.
For example:
Table auth will have 3 columns id, username, password
Table addressBook will have contact id, first name, last name, phone etc and also have one more which will be called userID
Whenever any user eneter the data in addressBook their userID from auth table coloum id will be stored along with it. Now you can display their own data to the users.
If you have anymore question ask in comment here.
I've got a database called Members, people would register online entering their fullname, email address, phone number, etc. I made a hidden form where it would set random 4 digit unique number and register it with their data, then I send it via email. People would use these unique IDs to enter an event, only 80% came. I collected the IDs, now I have a list of IDs that belongs to the people that came to the event, I want to export all the rows of people who came using their IDs. Example: For every row that include number: 4293, 1932, 9382 = export. Is there's a way to do this in MySQL?
Following query should do the trick
select fullname from members where ID in (4293, 1932, 9382)
I am creating a real-estate website that displays properties. On each property listing I would like a button that says 'Express Interest', when clicked, this button should send an email to me containing the user details who expressed interest (the user will be logged in and so all their details will be taken from their account).
I have the email function working fine, HOWEVER, I also want to display the number of people who have 'Expressed Interest'. Is there a way to track how many times an email has been sent using this button and display "xx people have expressed interest in this property"
Store in the database before sending the mail and just before sending the mail include the number of people or the people who are interested, a simple query would suffice, or if you have a content management system you can include it there, in both cases you would need an intermediate table (connection between user id and real-estate id)
I would add another table to your database that stores a property_id and a user_id. If a user clicks expresses interest, you add another row to that table with the current property_id and the current user_id. To get the amount of links you simply count the rows
SELECT count(user_id) FROM interest_relation WHERE property_id = 'your property id'
This way you can also find out which user is interested in which property.
I am using imap_search to get a list of Emails FROM INBOX and SENT ITEMS.
I have a grid that showing the Mail headers first ,when user clicks on one row i want to show entire content,like body,attachment etc ..
to achieve this there should be a UNIQUE ID for each messages.
how can i get UNIQUE ID for messages , i know about the SE_UID option will return the UNIQUE ID'S but UNIQUE ID are only in one Mail box ,
I can see same ID'S on INBOX and SENT ITEMS.
Please help me.
Note : I am using Codeigniter with Peeker Library.
Thanks.
The completely unique ID is made up of the mailbox name (eg INBOX), the UIDVALIDITY returned when a mailbox is selected, and the message UID.
You need to select the relevant mailbox and provide the correct UID to fetch the right message. UIDs are not unique between different mailboxes.
You can use the UID of an email to do operations on any email in any mailbox such as INBOX and SENT.
You can find more information http://phpmaster.com/exploring-phps-imap-library-1/ in this article
Firstly this site is based on guests who are interested in selling their items to the site owner, so this isn't auction based like Ebay.
Visitors basically would enter in details of an item ( tech gadget ) they'd like to sell, including condition, are given a quote on how much the item is worth, then fill in address info so the owner ships them a box/label so they can ship their item to the owner. If the owner is content with the condition, the visitor gets paid either by check or Paypal.
So going by this, I would need to have some sort of orders ( or is it more semantically correct to call it a transaction, or something else? ) table in which I track every single 'order' that the customer makes.
The items accepted are preselected, so there are only a few specific models/manufacturers so I was going to make an items table along with manufacturers and populate that like so:
items table:
item_id item_name manufacturer item_category_type
1 iPhone 32gb 3GS 1 1
2 Sidekick 3 2 1
manufacturers table:
id manufacturer_name
1 Apple
2 T-Mobile
There are also multiple types of items, item categories:
item_categories:
id item_category
1 phone
2 ipod
3 computer (pc,laptop)
orders:
id user_id item_id estimated_price ac_adapter battery manuals cables
1 5 2 250 1 1 1 1
users:
id user_email user_address user_city user_state user_zip user_country
1 foo#bar.com 302 Kingston Ave Manhattan New York 11111 United States
The price will be generated based on conditions, so for example whether or not a phone has an ac adapter, battery, manuals, cables, I indicated those in the orders table but I'm not quite sure if I should even store that in a table.
Question 1: Is the way I'm storing the ac_adapter, battery, manuals column in the orders table the correct way of doing this? I'd appreciate any tips.
The site will also have an admin area where the admin can look at all the orders, and there will be a user area where the user can look at his orders, in addition theres a request to have emails stored there too.
So after a user makes an 'order' then I'll have to add an entry to the users table if the user isn't already registered, and add an entry to the orders table, along with emailing the user a copy of this and emailing the site owner a copy of the order information. And next comes the part I'm confused about, storing emails - is it as simple as just creating an emails table, and possibly a second table relating the order transactions with the emails? And just mail the email_body to both the site owner and the user? Here's the schema I'm thinking of:
emails table:
id order_number email_title email_body ( TEXT column? )
1 1 sitename.com - Order #1 ( stuff )
Question #2: And for the email body, the way I'd generate that is join all the columns dictated by the order number, and just make an HTML table out of all that, include the date.. is this usually how email storing in databases is done?
I apologize in advance as this is a very loaded question, hoping someone with enough experience in these types of sites can assist. Thanks.
Is the way I'm storing the ac_adapter, battery, manuals column in the orders table the correct way of doing this?
No, because ac_adapter/battery/manuals are attributes of the item - not the order. If an order is returned, and a subsequent person orders the item - you've duplicated the data vs a single entry in the items table.
And for the email body, the way I'd generate that is join all the columns dictated by the order number, and just make an HTML table out of all that, include the date.. is this usually how email storing in databases is done?
Some webclients don't handle HTML formatted email well, this is generally left to user choice between text and HTML.
I wouldn't store the email at all - there's no value from an auto-generated email your system created. I can understand storing the template in the db, but email isn't a reliable contact method either so the most I'd do would be to have a column to indicate msg status (be it boolean/bit or foreign key). Besides, why store what'll alsob be stored in your email sent items folder?