IT Community - Software Programming, Web Development and Technical Support

PHP Help

This is a discussion on PHP Help within the PHP Programming forums, part of the Web Development category; Well, I was wondering if anyone could give me a script I can use to get a entered value from ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 02-04-2009, 11:08 AM
lldcrb328 lldcrb328 is offline
D-Web Trainee
 
Join Date: Feb 2009
Posts: 3
lldcrb328 is on a distinguished road
Default PHP Help

Well, I was wondering if anyone could give me a script I can use to get a entered value from a post form (e.g Username) and check to see if the username exists in a plain txt file I have with usernames separated by a line break, thanks in advanced.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-30-2009, 07:41 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: PHP Help

Hi,
The below example can help u to find solution
PHP Code:
$user $_POST['user'];
if(
userexists($user))
    echo 
"user exists";
else
       echo 
"User does not exist";
function 
userexists($user)
{
    
$userexists 0;
    
$handle = @fopen("test.txt""r");
    if (
$handle) {
        while (!
feof($handle)) {
            
$buffer fgets($handle4096);
            if(
trim($buffer) == $user)
            {
                
$userexists 1;
                break;
            }
            
//echo $buffer."<br>";
        
}
        
fclose($handle);
    }
    return 
$userexists;

test.txt contains like
HTML Code:
user1
user2
user3
user4
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 06-28-2009, 06:47 PM
Pieter Stefanus Pieter Stefanus is offline
D-Web Trainee
 
Join Date: Apr 2009
Posts: 21
Pieter Stefanus is on a distinguished road
Default Re: PHP Help

I have a php script that will send an email to the user with a new generated password. The only problem is that it requires me to have a mail server set up which I can't seem to figure out how to set up, so how can I use a Gmail account to do the sending of the emails? Is this even possible?

Last edited by arjkhanna : 06-28-2009 at 07:15 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 06-28-2009, 08:26 PM
dogfence dogfence is offline
D-Web Trainee
 
Join Date: Jun 2009
Posts: 17
dogfence is on a distinguished road
Default Dog fence reviews

I tryed to compile minimalistic design with maxim site speed.

Please tell me what you think about.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 07-29-2009, 04:48 AM
Kusuma Tolga Kusuma Tolga is offline
D-Web Trainee
 
Join Date: Jul 2009
Posts: 2
Kusuma Tolga is on a distinguished road
Default Re: PHP Help

In post.php, add each post to array and then echo the array contents to output the posts. Then include post.php in homepage.php.

post.php
-------------
$post = array();
$post[0] = "<h1>Post #1</h1>This is post #1";
$post[1] = "<h1>Post #2</h1>This is post #2";
$post[2] = "<h1>Post #3</h1>This is post #3";
foreach ($post as $x) {
echo $x;
}
echo "<h1>More posts</h1>More posts here!";

myhome.php
-------------------
require_once('post.php'); // Gives you access to all the stuff in post.php

echo "Let's see the first three posts:
";
foreach ($post as $x) {
echo $x;
}

echo "Stuff on homepage other than top posts.";
Add Post to del.icio.usBookmark Post in TechnoratiFurl 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 Off
Pingbacks are Off
Refbacks are Off


All times are GMT -7. The time now is 04:04 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0