Re: [PHP] umm i am confused...

2004-06-21 Thread Curt Zirzow
* Thus wrote water_foul:
 i get the following error
 
 Parse error: parse error, unexpected T_STRING in
 C:\Inetpub\localroot\aichlmayr.net\sites\aaron\module\personal\links.php on
 line 21

I get parse error on line 4.. but then again I'm smarter than php's
parser.

 --
 for the following code and i cant figure out why (you may need to maxamise
 to read it right)
 
 ?php
 //the function for adding new addresses
 function loop_new_address($loopnum,$url,$name){
 //the ${'link' . $loopnum} says put $link and add $loopnum to the end
 if(isset(${'link' . $loopnum . '})){

extra quote, but I think you already found it.

For readability you might want to consider using a variable
variable:

$linkloop = 'link' . $loopnum;
if (isset($$linkloop)) {
  ...


 loop_new_adderss($loopnum+1,$url,$name);
 };
 else{
 setcookie(link . $loopnum . ,$url,time()+3600*200);

If you're going to use double quotes might as put the variable
inside of them. but then again, with the readability fix above
you simpley have to do:

setcookie($linkloop, $url, time()+3600*200);

btw, it doesn't make much sense to have hard coded math, better off
just specifying the number and comment it:

time()+72; // +200 hours


 print(a href=$url$name/a was added);

This line, as well as others below, is absolutly illegal in php.
You must use quotes around strings! double quotes if variables
exist inside, single quotes if not.


 };
 if(isset($_GET[new])) {
 loop_new_address(1,$_GET[name],$_GET[url]);

Be sure to use $_GET['new']; // note the quotes

You're entering the another recursive loop, this is always
dangerous to have these thing dangling around everywhere :)

 ... the reset clipped

I see you are setting a lot of cookies, you might want to take a
look at (And be sure to read the part about limitations):

 http://wp.netscape.com/newsref/std/cookie_spec.html


HTH your future programming :)

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] umm i am confused...

2004-06-20 Thread Daniel Clark
Looks like several lines need quotes around the print statements and \ inside.

print(trtdform Method=\GET\ 
action=\module/personal/delete.php\delete/td/tr);

?php
//the function for adding new addresses
function loop_new_address($loopnum,$url,$name){
//the ${'link' . $loopnum} says put $link and add $loopnum to the end
if(isset(${'link' . $loopnum . '})){
loop_new_adderss($loopnum+1,$url,$name);
};
else{
setcookie(link . $loopnum . ,$url,time()+3600*200);
setcookie(name . $loopnum . ,$name,time()+3600*200);
print(a href=$url$name/a was added);
};
};
if(isset($_GET[new])) {
loop_new_address(1,$_GET[name],$_GET[url]);
};
print(table);
print(trtdform Method=GET
action=module/personal/delete.phpdelete/td/tr);
//write code
$writenum=1;
while(isset(${'link' . $writenum . ''}));
print(a href=${'link' . $writenum . ''}${'name' . $writenum . ''}/a);
};
include('links.htm')
?
trtdinput type=submit value=Delete Checked/form/td/tr
/table
table
trtdform METHOD=GET ACTION=module/personal/links.phpinput
type=hidden name=new value=1/tdtd/td/tr
trtdSite name/tdtdINPUT TYPE=text NAME=name VALUE=/td/tr
trtdsite url (if it is not on this site it MUST contain
http://;)/tdtdINPUT TYPE=text NAME=url VALUE=/td/tr
trtd/tdtdINPUT TYPE=SUBMIT VALUE=Continue/form/td/tr
/table

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] umm i am confused...

2004-06-19 Thread water_foul
i get the following error

Parse error: parse error, unexpected T_STRING in
C:\Inetpub\localroot\aichlmayr.net\sites\aaron\module\personal\links.php on
line 21
--
for the following code and i cant figure out why (you may need to maxamise
to read it right)

?php
//the function for adding new addresses
function loop_new_address($loopnum,$url,$name){
//the ${'link' . $loopnum} says put $link and add $loopnum to the end
if(isset(${'link' . $loopnum . '})){
loop_new_adderss($loopnum+1,$url,$name);
};
else{
setcookie(link . $loopnum . ,$url,time()+3600*200);
setcookie(name . $loopnum . ,$name,time()+3600*200);
print(a href=$url$name/a was added);
};
};
if(isset($_GET[new])) {
loop_new_address(1,$_GET[name],$_GET[url]);
};
print(table);
print(trtdform Method=GET
action=module/personal/delete.phpdelete/td/tr);
//write code
$writenum=1;
while(isset(${'link' . $writenum . ''}));
print(a href=${'link' . $writenum . ''}${'name' . $writenum . ''}/a);
};
include('links.htm')
?
trtdinput type=submit value=Delete Checked/form/td/tr
/table
table
trtdform METHOD=GET ACTION=module/personal/links.phpinput
type=hidden name=new value=1/tdtd/td/tr
trtdSite name/tdtdINPUT TYPE=text NAME=name VALUE=/td/tr
trtdsite url (if it is not on this site it MUST contain
http://;)/tdtdINPUT TYPE=text NAME=url VALUE=/td/tr
trtd/tdtdINPUT TYPE=SUBMIT VALUE=Continue/form/td/tr
/table
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] umm i am confused...

2004-06-19 Thread Adrian
action=module/personal/delete.phpdelete/td/tr);
replace this with
action=module/personal/delete.phpdelete/td/tr;

and remove the ; after } - it's ugly and useless ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php