The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > PHP


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 07-03-2007, 11:39 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 428
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
PHP, DHTML, Ajax Tutorials?

I'd like to write another tutorial, but just can't think of what would help you all the most. I'm proficient in PHP, DHTML, and Ajax (don't complain about the term - I mean the asynchronous connection method with support for SE readability and the ability to work with reader programs for the disabled). What would you like to see an article or 2 written on? Please, feel free to push the envelope - I've done quite a bit of programming, so you don't have to confine yourself to requesting introductory articles that you can find anywhere.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 07-03-2007, 06:16 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
hmm, im stumped, i would be interested in something to do with reading a text file and finding some info then creating another text file and writing the text to it.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 07-03-2007, 06:20 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 428
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
Quote:
Originally Posted by Lee View Post
hmm, im stumped, i would be interested in something to do with reading a text file and finding some info then creating another text file and writing the text to it.
Like finding what kind of info? Can you give me an example?

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 07-03-2007, 07:00 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Well lets say for some reason you have you data in textfile1 as:

Quote:
USER INFORMATION (id = `1`, user = `Fred`, password = `5f4dcc3b5aa765d61d8327deb882cf99`, email = `fred@fred.com`)
USER INFORMATION (id = `2`, user = `Fred`, password = `5f4dcc3b5aa765d61d8327deb882cf99`, email = `fred@fred.com`)
USER INFORMATION (id = `3`, user = `Fred`, password = `5f4dcc3b5aa765d61d8327deb882cf99`, email = `fred@fred.com`)
have a box to put the 'before' things in e.g. USER INFORMATION (
then then you insert what you want, if you want just user and password
then you insert either user and password and it finds it, or you put where you want the script to go from e.g. the ` for password the number would be 5 as its the 5th ` along and the script would know when the password end is as it would be 5 ++1.

From that it should maybe save the information based on for each set of data you want, a set being id, user etc, in the style of:

id:user:password
id:user:password
id:user:password

colon separating them...i find this thing really good and it can be very useful sometimes, obviously it wouldn't contain user password etc just an example, i have a program in C++ that does this that i got from someone and its simple to edit to your needs and i think C++ is the harder language.

Its just an idea, i need to learn about things like this in php so would help a lot.

Thanks anyway

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #5 (permalink)  
Old 07-03-2007, 07:32 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 428
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
How about this?

Well, it's not a tutorial, but how's this?

PHP Code:
<?php
$target_file 
'source.txt';
$output_file 'target.txt';
//Open the target file for read-only mode.
$fh = @fopen($target_file,'r');
if (
$fh) {
  
//Open the output file for writing.
  
$ofh = @fopen($output_file,'w');
  
$nl_prefix ""//Will hold newline as a prefix for all lines after the first
  
while (!feof($fh)) {
    
$a_line fgets($fh); //Get a full line until a newline is received.
    
$a_line trim($a_line); //Remove any extraneous space that may be present on a blank line
    
if (strlen($a_line) > 0) { //This was an empty line, so skip processing.
      //Now, do what you want to the data.  In this case, it's parsing SQL, so let's use preg_match
      
preg_match_all('/([a-z0-9\_\-]+) = `([^`]+)`/i',$a_line,$matches);      
      
      if (
count($matches[1]) > 0) { //Then, there are matches
        //Now, generate a new output line (id:name:password)
        
$output_line $nl_prefix.$matches[2][0].':'.$matches[2][1].':'.$matches[2][2];        
        
        
//Then, write it to the new file.
        
fwrite($ofh,$output_line);
        
        
//Set newline prefix for non-first lines.
        
$nl_prefix "\n";
      }
    }
  }
  
  
//Cleanup by closing each of the open files
  
fclose($fh);
  
fclose($ofh);
} else {
  echo 
'Unable to open file';
}
?>
Oh, let me point out that to customize this for your own usage which may have a different file format, you "just" need to edit the preg_match_all line to the RegEx of your choice.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by TeraTask : 07-03-2007 at 07:35 PM. Reason: Forgot to tell how to customize!
Reply With Quote
  #6 (permalink)  
Old 07-03-2007, 07:34 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 428
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
BTW: 5f4dcc3b5aa765d61d8327deb882cf99 is the md5 hash for password. I highly recommend moving on to the sha series of hashes for added security. You may already know this, but I thought it prudent to mention for others who may be reading this thread.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #7 (permalink)  
Old 07-03-2007, 09:04 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Thanks i will study it soon as it looks good having a look over it, and yes i know about sha but i was using that as an example.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #8 (permalink)  
Old 07-03-2007, 09:29 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,111
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
Originally Posted by TeraTask View Post
I'd like to write another tutorial, but just can't think of what would help you all the most. I'm proficient in PHP, DHTML, and Ajax (don't complain about the term - I mean the asynchronous connection method with support for SE readability and the ability to work with reader programs for the disabled). What would you like to see an article or 2 written on? Please, feel free to push the envelope - I've done quite a bit of programming, so you don't have to confine yourself to requesting introductory articles that you can find anywhere.
Hmm... I think you should write about AJAX probably? Since there are many PHP tutorials already that PT has even though I'm not even going to plan to even get into AJAX soon, but I think it would be nice if there's tutorial about that ahead do you deal some ASP.NET? well, ccoonen I know wrote some tutorials about it... but he used a lot of VB

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #9 (permalink)  
Old 07-03-2007, 10:49 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 428
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
Well, I wrote an Ajax tutorial that's 2 parts and on my own site. Is there some specific usage that you'd like?

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #10 (permalink)  
Old 07-03-2007, 11:02 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,111
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
well, I personally haven't yet encountered on how AJAX can be much useful other than cosmetics for a site like yours.. haha.. so I'm not sure with that, or probably you can talk about whatever you think can be useful by using AJAX? what kind of application that can be efficient and useful if it's wrote in AJAX haha...

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 08:16 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50