Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Mark Zuckerberg thought so to when he started Facebook with some friends
  2. If you use my code it's as simple as: <form action="unsubscribe.php"> <input type="text" name="email"> <input type="submit" value="Unsubscribe"> </form>
  3. Be sure to create a back-up before using this script. if (!isset($_GET['email'])) { echo 'No e-mail specified.'; exit(0); } $email_address = $_GET['email']; if (!preg_match('/[a-z0-9-\._]+@[a-z0-9-]+(\.[a-z]+){1,2}/i', $email_address)) { echo 'Invalid e-mail specified.'; exit(0); } $found = false; $emails = file('NewsletterREG.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($emails as $key => $email) { if ($email === $email_address) { $found = true; unset($emails[$key]); break; } } if ($found) { echo 'You have been unsubscribed.', 'If you are not being redirected click to return to the <a href="index.php">homepage</a>'; file_put_contents('NewsletterREG.txt', implode(PHP_EOL, $emails)); header('Refresh: 3; url=index.php'); } else { echo 'Your e-mail was not found in our records, do you wish to', '<a href="subscribe.php">subscribe?</a>'; }
  4. For me it all started in a PC cafe around 2003 where me and my friends played Counter-Strike and I downloaded skins to play with from http://games.telenet.be (doesn't exist anymore refers you to 9lives.be) and I wondered what it would take to create something like that somehow I landed at HTML and CSS later on. I must have written tons of templates back then just to get the hang of HTML and CSS and to create "stunning" templates which I would admire for a few hours and then started creating another. In 2005, the union in the company for which my Dad worked - and for which he was a treasurer - needed a website but they didn't like the price-tag associated with it. My Dad knew I was messing around with that kind of stuff and volunteered me. So it was settled - without my knowledge - I would create their website. When I heard I was excited first but that turned into worries because there is a big difference between creating a template for yourself and a website for a client, to cut a long story short I can say their website was tutorial-ed together (PHP was hot everything (tutorial) pointed in it's direction) and the best part is they loved it even after 5 years they still don't want to change the front-end template because they still get and got real good comments about their website. They even liked the back-end (which was inspired by Mint). Although they were happy about the result I wasn't (because of the guilt and the endless tutorial code that made up their website) So bound to make it right I learned PHP thoroughly a few years later I wanted to take another shot and created a completly new website, new layout, neat code on which they replied: the website is fine like it is, it doesn't need changing. A couple years later I asked them again if they wanted a new website which was once rejected. Now 5 years later I develop PHP websites with a passion and I'm proud to say that I have a thorough knowledge of the PHP library and Project A&D
  5. http://dev.mysql.com/doc/refman/5.5/en/dynindex-is.html
  6. Load your image through PHP that way you can add additional headers to expire the image instead of not caching the entire page. EDIT: apparently that doesn't work in all browsers use their_username.jpg?<?php print time(); ?> EDIT 2: Google doesn't like this their_username-<timestamp>.jpg
  7. $image->output(); should be: $image->save('path/to/file'); EDIT: jcbones beat me to it
  8. name="products[$ID]" then when the user presses UPDATE you go over each item and check if the quantity has changed if it did then modify it in your database. $_SESSION['cart_namespace'][$productID] = $row;
  9. Try to update the field and set it's value explicit to NULL
  10. I must be getting blind (or really tired) I didn't even see this line
  11. REGEX is IMO to much overhead for something this simple
  12. Maybe you can take an alternative path as it feels somehow wrong to let a validation class pull records from a database. How about whitelisting? Like below: $subscribed = $usersTable->findBySubscriptionStatus('subscribed');//this line alone should give you the e-mails you need. if (sizeof($subscribed)) { $validEmail = new ValidateEmail(); if ($validEmail->massValidate($subscribed)) {//all e-mails
  13. SELECT * FROM room WHERE r_roomtypeID = $rtID ORDER BY rand() LIMIT 1 or SELECT * FROM room r, roomtype rt WHERE rt.roomtypeID = r.r_roomtypeID AND rt.roomtypeID = $rtID ORDER BY rand() LIMIT 1 I prefer the first
  14. A DBMS already has tables to manage users and to control access to it's resources (databases, tables, views, procedures, ..) Take a look at the information_schema database
  15. Add a field subscription_status VARCHAR(12) which can hold (subscribed, unsubscribed, pending, renewed, ..) probably don't need no explanation
  16. That is because your decimal field currently has NOT NULL change it to NULL that way it allows you to have NULL as a value
  17. Keep coming here and you soon will be My motto: learn from the mistakes of others as you can't make them all yourself Visiting these forums made me a wise man
  18. A class in PHP is always global you can access it - once declared - everywhere.
  19. You probably meant without refreshing the entire page as you can switch stylesheet without leaving the page using PHP
  20. SELECT * FROM m$selected ORDER BY rand() LIMIT 1
  21. Just pass it to the constructor Edit: why does a validation class need access to the database?
  22. $to = str_replace(array('(', ')', '-'), '', $to);
  23. A simple google search learned http://www.mkyong.com/mysql/how-to-modify-the-max_questions-resource-value-in-mysql/
  24. I assumed you already created a connection to the database and you only wanted to verify if a certain database exists, NOT apparently. Use: $connection = mysql_connect($cfg['host'], $cfg['username'], $cfg['password']); if (!$connection) { header('Location: install/index.php'); }
×
×
  • 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.