ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Hosting a MYSQL server at home but the site elsewhere?
ignace replied to jordz's topic in MySQL Help
Mark Zuckerberg thought so to when he started Facebook with some friends -
Please help --- PHP unsubscribe to a newsletter - no database
ignace replied to maros174's topic in PHP Coding Help
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> -
Please help --- PHP unsubscribe to a newsletter - no database
ignace replied to maros174's topic in PHP Coding Help
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>'; } -
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
-
Yep as your username no longer exists
-
http://dev.mysql.com/doc/refman/5.5/en/dynindex-is.html
-
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
-
$image->output(); should be: $image->save('path/to/file'); EDIT: jcbones beat me to it
-
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;
-
Try to update the field and set it's value explicit to NULL
-
I must be getting blind (or really tired) I didn't even see this line
-
How to change format from (800)555-1212 to 8005551212
ignace replied to ghurty's topic in PHP Coding Help
REGEX is IMO to much overhead for something this simple -
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
-
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
-
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
-
Add a field subscription_status VARCHAR(12) which can hold (subscribed, unsubscribed, pending, renewed, ..) probably don't need no explanation
-
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
-
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
-
A class in PHP is always global you can access it - once declared - everywhere.
-
You probably meant without refreshing the entire page as you can switch stylesheet without leaving the page using PHP
-
SELECT * FROM m$selected ORDER BY rand() LIMIT 1
-
Just pass it to the constructor Edit: why does a validation class need access to the database?
-
How to change format from (800)555-1212 to 8005551212
ignace replied to ghurty's topic in PHP Coding Help
$to = str_replace(array('(', ')', '-'), '', $to); -
A simple google search learned http://www.mkyong.com/mysql/how-to-modify-the-max_questions-resource-value-in-mysql/
-
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'); }