Trouble in include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaily
Forum Newbie
Posts: 12
Joined: Fri Jul 05, 2002 12:17 pm

Trouble in include

Post by kaily »

here is code:

Code: Select all

if ($addemail!=$email) $check=check_email($addemail,$username); 
if (empty($check)){ 
include("datafile/useremail.txt"); //----here 
$o=count($userid);$i=0; 
while ($i < $o)&#123; 
if($wandererboardid==$userid&#1111;$i]) $newdata&#1111;]="\$email&#1111;]='$addemail';\$userid&#1111;]='$userid&#1111;$i]';"."\n"; 
else $newdata&#1111;]="\$email&#1111;]='$email&#1111;$i]';\$userid&#1111;]='$userid&#1111;$i]';"."\n"; 
$i++; 
&#125; 
$newdata=implode("",$newdata); 
writetofile('datafile/useremail.txt',"<?php\n".$newdata,"w"); 
&#125; 

function check_email($addemail,$username)&#123; 
include("datafile/useremail.txt"); //--- here 
$check_email = array_keys($email,$addemail); 
if ($check_email)&#123;$id=$check_email&#1111;0]; 
$err_msg="Your E_mail address&#65306;$addemail has been<a href=wdbprofile.php?job=show&target=$userid&#1111;$id]>$userid&#1111;$id]</a> used&#65281;Please go back and rewrite another one&#12290;<br>"; 
&#125; 
return $err_msg; 
&#125;
It doesn't work!
How I can do?Plz help me!
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

try changing include to include_once
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It would really help if you said what was wrong, ie. what didn't happen that should have (or vice versa), what error messages did you get.

Mac
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

oh, now that i read it.. it sticks out so blandly..

Code: Select all

function check_email($addemail,$username)&#123; 
include_once("datafile/useremail.txt");
$check_email = array_keys($email,$addemail); 
if ($check_email)&#123;$id=$check_email&#1111;0]; 
$err_msg="Your E_mail address&#65306;$addemail has been<a href=wdbprofile.php?job=show&target=$userid&#1111;$id]>$userid&#1111;$id]</a> used&#65281;Please go back and rewrite another one&#12290;<br>"; 
&#125; 
return $err_msg; 
&#125; 

if ($addemail!=$email) $check=check_email($addemail,$username); 
if (empty($check))&#123; 
include_once("datafile/useremail.txt");
$o=count($userid);$i=0; 
while ($i < $o)&#123; 
if($wandererboardid==$userid&#1111;$i]) $newdata&#1111;]="\$email&#1111;]='$addemail';\$userid&#1111;]='$userid&#1111;$i]';"."\n"; 
else $newdata&#1111;]="\$email&#1111;]='$email&#1111;$i]';\$userid&#1111;]='$userid&#1111;$i]';"."\n"; 
$i++; 
&#125; 
$newdata=implode("",$newdata); 
writetofile('datafile/useremail.txt',"<?php\n".$newdata,"w"); 
&#125;
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Sorry I was just having a moan at the vague statement of the problem - there's lots of things that can go wrong with an include statement...

Mac
Post Reply