Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




CSV File-based Address Book Code Snippet?


Since I'm a PHP newbie and the only address book apps I found
through Google require MySQL or PostgreSQL, I figured I'd ask if
someone has come code handy.

I'd just like to keep a list of addresses in a CSV file (ie. columns
last name, first name, e-mail, office #, etc.) so as to ease backing
up, and read/update this list from a PHP script.

I guess it's pretty much just a loop to read + parse, and a form to
update, but if someone has the code handy, I'm interested :-)




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
A User-accessible Address Book Using Php?
I still can't figure it all out.

I am trying to create a web page (using php) where:

1) A visitor add his or her name to an address book that can also be
viewed online by other visitors to the website.

In creating this, I will also need to:

2) Allow that visitor to create a username and password to add his/her
information.

3) Allow that visitor to make changes and updates to his or her entry in
future visits to the website.

and...

4) Create an automated system for that user to retreive his/her username
and/or password if s/he has forgotten it.

Boy oh boy, would I be happy just to be able to make step #1 a reality.
Can anyone please help me with this? I am leasing space from Aitcom and my
server is a Linux system. I have MySQL and PHP available to work with.


I have an example in mind. The following website is another school very
similar to ours in Maine, and they have a system in place almost exactly
as I'd like to create:

Contact List Or Address Book Repost
Posted this incorrectly as a response in an unrelated thread. Sorry!

I've looked at many that are available, but would like to solicit other
ideas.

I am looking for a solution to manage and make available the 1000's of name
and numbers that a family accumulates. I want to make this information
available away from the home, and have a host with:

PHP Version 4.3.3
Mysql Version 4.0.15-standard

Php-projekt seems to have the features in Contacts that I would like,
especially import and export. I would like something with a simpler
interface, though.

Is there a PHP book that might cover something like this?

I don't have the programming experience to do this, of course, but maybe I
should attempt it.

I've rambled on a bit, but think this is a topic that many people are
interested in.

Serving A Website Based On Source Internet Address ?
Based on the source internet address a different version of the website
should be presented/served to the user/browser.

I would like to keep the script as simple as possible and it should
replace the index.php.

The script could look something like this in pseudo code:

if SourceAddress = â¸.3.5.1' then
begin
ShowBlueWebsite; // load/show BlueIndex.htm
end else
if SourceAddress = ït.5.15.7' then
begin
ShowRedWebsite; // load/show RedIndex.htm
end;

Is this possible with php ?

PHP Based Email Address Obfuscator For Website Mailto: Tags
I found a PHP based email obfuscator for use in websites, where the
source HTML (PHP, actually) file doesn't contain the actual email
address in the Mailto tag, but generates it and that generated page
(containing a full and conventional Mailto: tag) is what is ultimately
presented to the user.

The intent is to thwart Spam bots and spiders, by NOT having the email
address in the original HTML Source, but ultimately presenting it to
the person browsing the site.

But here's my question.... Even though the program works exactly as
advertised, isn't this a case of flawed logic on the part of this
scripts author? PHP runs server-side, so won't the PHP be
interpreted, whether it's requested by a bot, a spider, or a legit
website visitor? (and thereby, presenting the bot with the full
Mailto: tag and email address anyway)? Or is there something basic
I'm missing here?

Book Script ,should I Use Txt File Or Mysql Text Field ?
I am doing simply book script, where we will have hundred of books,user will be able to read chapter by chapter or search etc.. As u know that book contain will have html tages..etc.. and each book is around 200 kB....My php script read text file and display. It's a huge text file.

I am thinking to use database instead of text file. But text files are very huge. My question, should i use database instead of text file ? which one is faster and better.

I have noticed, when i copy 150 kB files and paste into phpmyadin, it gives me internel error..but it insert record. I used txt field for book contain.

Code Review: Does This Class Method Really Validate An Email Address?
I wrote a method that should check if an email address is valid. In
another method I've already checked to see if $_POST['email'] exists
and is well-formed, so those checks are not necessary in this scope.

However, "Step 4" bothers me, and I wonder if others are as bothered as
I am.

[PHP]
/**
* Validate submitted email
*
* @access private
* @see checkdnsrr
* @link
http://www.devshed.com/c/a/PHP/Email-Address-Verification-with-PHP/4/
* @see link regarding use of getmxerr() as a double-check behind
checkdnsrr
* @link http://us2.php.net/manual/en/function.fsockopen.php
* @see link regarding usage of fsockopen() for domain reachability
verification
*/
function &validateEmail() {// STATIC VOID METHOD
global $webmasterEmail;

list($user, $domain) = @explode('@', $_POST['email']);

if ($this->isValid && (!$user || !$domain)) {
$this->isValid = false;
$this->setErrorArray(array('email' => 'No validly formed email
address was found'));
}

// STEP 1: USE checkdnsrr (either built-in UNIX version or
"homegrown" version in client functions.inc.php for Windows)
if ($this->isValid && !checkdnsrr($domain) && !$_ENV['windir'] &&
!$_SERVER['windir']) {
// ONLY PRODUCE AN ERROR IF NOT IN WINDOWS ELSE ALLOW getmxrr() TO
THROW ERROR
$this->isValid = false;
$this->setErrorArray(array('email' => "Domain: "$domain" not found
to exist for email address to be valid"));
}

// STEP 2: MAKE SURE $domain IS NOT OUR DOMAIN
if ($this->isValid && strcmp(trim($domain),
preg_replace('/^([w]{3}[a-zA-Z0-9]*).?([a-zA-Z0-9-_.]+)$/i', '$2',
$_SERVER['SERVER_NAME'])) == 0) {
$this->isValid = false;
$this->setErrorArray(array('email' => "You are not allowed to use
our domain of "$domain" for your email address"));
}

// STEP 3: USE getmxrr() BUILT-IN PHP FUNCTION TO DOUBLE-CHECK BEHIND
STEPS 1 AND 2
if ($this->isValid && @!getmxrr($domain, $hostArray)) {
$this->isValid = false;
$this->setErrorArray(array('email' => "Domain: "$domain" is not
found to exist for the email address to be valid"));
}

// STEP 4: VERIFY VIA fsockopen() IF YOU CAN EVEN REACH THAT DOMAIN,
MEANING IT'S ACTIVE (COULD ALSO BE DOWN OR UNREACHABLE OR BOGUS)
if ($this->isValid) {
$socketID = @fsockopen($domain, 25, $errno, $error, 15);// LAST
NUMBER IS TIMEOUT FEATURE - TIMEOUT AFTER 15 SECS
if (!$socketID) {
$msg = "There was a problem attempting to connect to "$domain": "
.. nl2br($error) .
", please try again or contact our administrator at <a
href="mailto:$webmasterEmail">" .
str_replace('@', ' at ', $webmasterEmail) . '</a>'
$this->isValid = false;
$this->setErrorArray(array('email' => $msg));
}
@fclose($socketID);
}
}
[/PHP}

Login Snippet
I would like to create a login feature for the Site Admin i.e Me and fellow DJ´s.

But i want it so, when we log it, a picture on the index.html page (DJ Playing Now) will change to the corresponding one. I.E when i log in it displays "djscousey.jpg"  when MC MiniMat logs in it displays mcminimat.jpg etc. etc.

I really am a learner at php, so i thought maybe you guys could put me in the right direction..

Small PHP Snippet
As you can see from the code below its reading from the database fine, it will show two of the first entries in the db. Theres a small peice of code i remember but cant find it, where you can add to the bottom of the script where if there are new entries it will add to the list automatically. Code:

Xpdf - PHP Script Or Snippet
Will appreciate any example of subject script calling xpdf, any platform...

Select Specific Snippet Of Text, Replace With A Database Result
I'm having some problems trying to do something; I just can't think of a way to do it. Basically, I want to search for a specific snippet of text in a body of text, then replace it with the requested database result with some thrown in HTML.

Users will be able to type the following (or something along these lines, depending on what works best): [image=12345]Insert caption here[/image]

Then I need it to search for the requested image in the appropriate table and return the image's url (for an example, let's say the table is called "images", and the columns required are "imageid" and "imageurl". Code:

Database Or Flat File Based?
I'm writing a news script, where I can write articles and have them outputted on my homepage. What I'm wondering before I start is; does anyone have any advice whether something like this would be better of stored in a database or flat files?

Some articles could be quite long and I just thought they may be better suited stored in a .txt file for instance, but then again it might not make any difference.

Access File Based On PayPal's IPN?
I have a website where I sell video clips. I want to know if it's possible to give a registered user access (or deny) to download a file (HTTP) based
on his payment to PayPal.

Copy($file, $address)
trying to use copy($file, $address) and it throws this back at me...

Warning: open_basedir restriction in effect. File is in wrong >directory >in /home/sites/site170/web/admin/experiments/uploader.php on line 57

is this a permissions problem?

PHP Based File/folder Backup Script
Does anyone know of any OSource scripts to read the file/dir structure and then compress it into one zip/tar/gzip file to then be deliverd to the end user via http/https download.

File Access Based On PayPal Info (IPN)?
I want to let a (registered) costumer download a file after paying through PayPal. Now PayPal have a system called IPN (Immediate Payment Notification), where your server gets notified whether the transaction was approved or not. Based on that notification I want the server to allow or deny access to the file.

[PHP5] File Base Vs. Directory Based Authentication?
I'm looking to implement login/registration system in PHP5 and
MySQL. Thus, I have come across alot of resources and source code to
perform this task. However, I'm wondering, what's the best method
(i.e. PHP/MySQL or PHP/MySQL using .htpasswd) from a security?
Essentially, I will need to be able to password protect an entire
directory. Also, a small set of directories will be for admin eyes
only. BTW, I will have both admin and guest members for this
membership site. Finally, if you can point me to both source and/or
white papers,

Can I Hide My Email Address In Require File
I am wanting to hide my email address so that a spammer cannot use one of their "crawlbots" to crawl the pages in my web site and steal my email address.

Can a spammer's crawlbot find my email address if I place my email address in an include file and place the include file somewhere like, for example, the configuration folder?

How To Extract An Email-address From A Text File
Can somebody show me a quick code snippet to reliably extract an
email-address form a text file ?

Trouble Extracting Email Address From Text File
I'm trying to put together a script that will read an email box set up for newsletter bounces and remove the bad addresses.

There's an old script I've worked with that looks for --- Permanant fatal errro ---, but not all the bounced emails have that line included (3 out of about 700 do).

I need to find the bad address, then delete that address out of the database. I've got the deleting out of database down, but am not sure how to find any email address & delete it.

Dont Want The File Names In The Browser Address Field
Is there a way in PHP where the file name do not appear in the browser address field.

eg. the url of a file is : http://www.somedomain.com/somepage.php.

but when a link to this page is clicked, only http://www.somedomain.com should show up in the browser address field.

Mail() Bounces To Server Address Instead Of From Address
All email sent from php mail() that bounces is being returned to my servers admin email address instead of the "From" or "reply-to" address.

What needs to be put in my header code to ensure that this does not happen?

EyeOS : Opensource Web Based Operating System Based On "php"
EyeOS is a Opensource web based operating system based on "php".

try demo here

http://eyeos.info/eyeOS/

E-book On Php
anyone who knows a good links on php e-books.

PHP Book
I am looking for a book that has a good explination of the power of OO programing in PHP. I already know the basic's of it but i want to learn the ins and outs of it. I am in the starting phase of a complete site redsign and I want to rewirte the whole site from the ground up with OO.

Book
What's book about PHP is the best?

PHP 5 OOP Book
I'm looking for a book that explains OO programming in PHP5. I'm not
new to PHP or programming so it should be pretty advanced. I've been
looking to different PHP books but none of them were quite like what
I'm looking for. Can anyone recommend one? PHP5+OOP!

PHP BOOK
I am new to php and know a few basics. What would a be a really good book for me that would take me deeper into php?

A Book On PHP And Security
Are there any books out there on PHP and Security issues?

Best PHP / SQL Book For Beginners
Can anyone give me some ideas on what book to buy to learn PHP/SQL.

I am brand new to PHP and programming all together.

Best Book PHP/MySQL
What's the Book Certification Study Guide to PHP and MySQL?

PHP Book Recommendations
I am going to be teaching an introductory, course on PHP.
As this course has not been offered before, there are no existing
materials or list of resources for me to choose from. This is a Good
Thing(TM) because I get to do Whatever I Want(TM) as far as choosing
course materials goes.

So here's the questions:

What PHP books do you like?
Why do you like them?
What expertise range is targeted by the particular book(s) you have
mentioned?
What books do you really *not* like and why? (just as useful info as
knowing which books are popular is knowing which are *un*popular)
What other PHP resources have you used and why?

Keep in mind that I am just feeling out the PHP community for opinions. If
in fact there *is* a PHP community.

Beginner PHP Book
I have looked all over for a php 5 noobie book for ever, one that is
easy but indepth...

If you could please reccomend a great book for us noobs in PHP world..

I only know html and some php..

Book Recommendation On PHP
I'm just getting into learning php and mysql. What books would you
recommend?

Oscommerce Book?
Is there any book available which helps to customize OSCOMMERCE?
I know that Hasin has written a book regarding this.I want to know
whether this book has launched here or any other book which is present
here?

Need Recommendations For Php Book
Just starting out with PHP for web sites I create. Not necessarily
database types of things - that will come later - but short scripts or
snippets to perform validation, or accepting a variable into form. That
sort of thing.

What is the best book to get?

What Is The Best Book On MySql?
What is the best book to read about MySql?

Php Online Book
where can i find a good online php book for beginner. or give me any website that offers a good php tutorial that can be easily understand and with clear explanations.
what can you suggest for starting learning php?

where should i start to study php?how long it will take for learning php?is OOP in php is hard to learn?

Which Book To Choose?
At the moment I own PHP and MySQL for Dynamic websites 2nd edition by Larry Ullman. I've read through it and done several examples. However, I personally find by creating mini websites, instead of just typing one page scripts that I learn it more. I have gone through the content management system and user management system in the book several times, using and adapting the code for different websites.

I now want to expand these examples so I can see how different people code and find the best medium for myself.

Which book of the following three would you suggest I buy?

Sams teach your self PHP, MySQL, Apache all in one
Sams teach your self PHP in 24 hours
Sams teach your self Ajax, Javascript and PHP in 24 hours
PHP and MySQL Web Development 3rd edition

Downloading Php Code Instead Of File
I have a website where I can upload a file via a form. The uploaded
file is stored in a MySQL database. When dloading te file I get a save
as... dialog box, letting me save the file. But when it is dloaded and
I open it, it contains te HTML code of the file displayed...
Wordt thin g is - it _used_ to work so the code is OK - only some
little thing changed. Maybe the header part?

global $HTTP_GET_VARS, $connection;
$nodelist = array();
// Pull file meta-data
$SQL = "select * from filemetadata where id = '" .
$HTTP_GET_VARS[ID]."'";
if (!$result = mysql_query($SQL, $connection))
die("Failure to retrieve file metadata:L ".$php_error);

if (mysql_num_rows($result ) != 1)
die("Not a valid file id!");

$FileObj = mysql_fetch_array($result);

// Pull the list of file inodes
$SQL = "SELECT id FROM filedata WHERE
Masterid='".$HTTP_GET_VARS[ID]."' ORDER BY id";

if (!$result = mysql_query($SQL, $connection))
die("Failure to retrieve list of file inodes");

while ($CUR = mysql_fetch_object($result))
$nodelist[] = $CUR->id;

ob_end_clean();
ob_start();

// Send down the header to the client
Header ( "Content-Type: ".$FileObj[Datatype]);
Header ( "Content-Length: ".$FileObj[Size]);
Header ( "Content-Disposition: attachment;
filename=".$FileObj[Name]);

// Loop thru and stream the nodes 1 by 1
for ($i = 0 ; $i < count($nodelist) ; $i++) {
$SQL = "select FileData from filedata where id =
'".$nodelist[$i]."'";

if (!$result= mysql_query($SQL, $connection))
die("Failure to retrieve file node data");

$DataObj = mysql_fetch_object($result);
echo $DataObj->Filedata;
}
}

Put HTML Code From A File
How can I put HTML code that is in a file PHP have any funtion or I have to do it?

Quoting PHP Code In A .php File?
I want to quote the followong content into a Web page

<html>
<head><title>Connect Server</title></head>
<body>
<?
$link = mysql_connect("localhost",$_POST['username'],$_POST['password'])or
die("Connect Error: ".mysql_error());
print "Successfully connected.
";
mysql_close($link);
?>
</body>
</html>

The Web page is generated by a xxx.php file and what I want to be q quote is
executed rather than displayed. I have tried to surround it with block
formatting HTML elements such as <blockquote> or <pre> but the PHP code
surrounded by "<?" and "?>" always get executed and throws errors.

Showing A .MHT File Using PHP Code
I have .MHT files saved on a server and I need PHP to open them and display in the browser as a regular page. For the security reasons, I cannot directly point to their location, so I want PHP to open these .MHT files, and only logged in users can have an access to them. Code:

Looking For Book Listing Script
I am in search of a simple book listing script (school textbooks for example) - (PHP/MySQL). The only thing I really need is a simple script that will allow me to add or modify custom fields to the submission form.

Php 5 Information, Tutorial, Book, Etc
I have worked on php for the past 6 years off-and-on and I was planning on making the conversion over to 5.x and I understand there has been a lot of changes from 4.x. Based on this, I was wonder if you could suggest a book that highlights the changes with examples as well as a site or two that would help with this.

On another note, I would like to know how you guys seperate and tier your applications in php (I have been working with .NET in which we used a 3-tier). Do you try and use 3-tier, 2? How do you pass around the connection in php when you seperate the code (use some type of global or always pass the connection)? Etc?

Looking For A Good Php Book To Use With Adobe CS3
Sometime back I bought a couple books on Dreamweaver and Flash for the
CS2 Suite and along with it bought a book for Php, Foundation Php for
Dreamweaver 8. I read the Dreamweaver and Flash books but never have
read the Php book. Now that I was ready to I just upgraded to the CS3
suite.

My question is, is it important to look for a newer Php book to use
with this CS3 suite or would the current book be ok and up to date?
Should I look into the Foundation Php 5 for Flash 8 as a complement to
the current book or is there a completely other book I should look
into? I'm completely new at Php so am definitely looking at something
that's entry level.

Best Book On Design Patterns?
This has nothing to do with PHP, but I ask it here since I do most of
my programming in PHP. What do you think the best book on design
patterns is? The book can be written for C or Java or in the abstract.
What was useful to you and why?

Lost Book Mark....
A while back I ran across a new site that had a ton of 'DEMO' sites
running. Just about every open source php cms/ commerce/ blog/ etc.
etc. one could imagaine. I have since lost the link. Anyone know what
the uri for this or similiar site is?

Best Object Oriented PHP Book?
Best Object Oriented PHP book?

How Do I Parse PHP Code Within An HTML File?
I'm trying to figure out a way to save message bodies of the various e-mails I send from my site into HTML pages and then import them when I send the e-mails. But I've never tried anything like this before so I'd appreciate some help. Here's an example of the code I'm using: Code: $email_body = file_get_contents("emails/application_approved.htm");
I can import the HTML files without problems, but I've also got PHP variables in the HTML code and I need to know how to parse those variables. Is it even possible?


Copyright © 2005-08 www.BigResource.com, All rights reserved