help modding a script

This is a discussion on help modding a script within the alt.comp.lang.php forums, part of the PHP Programming Forums category; a friend of mine wanted me to have a go at this for him i have a limited knowledge of ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-27-2005
Christo
 
Posts: n/a
Default help modding a script

a friend of mine wanted me to have a go at this for him

i have a limited knowledge of php, mainly because its similar to c/c++ which
i understand quite a bit more and also vb and vb.net so i figured i could
mode the script the way he wanted

i have this code.... in a file called secure.php

<?php

// Secure multiple user Log-In script by Dave Lauderdale - Originally
published at: www.digi-dl.com

$filename = "user.log";
$log = fopen($filename, "r");
$contents = fread($log, filesize($filename));
fclose($log);

if ($contents == "Phil" || $contents == "Chris" || $contents == "Rick") {

$filename = "user.log";
$log = fopen($filename, "w+");
fputs($log,"");
fclose($log);
include ("test.php");

} else {
echo "<center><Br><font color=red face=arial size=3 >Error</font>...<font
face=arial size=3 >You will have to log on via the log on form to view this
page.<br><br><a href='login.html' style='color:black'>Click here</a> to try
again.";
}
?>

forget about the logging in lets just say thats handled

now i include test.php

this checks which username is in $contents and then includes a txt file on
the page for them individually, this is the part i have written myself, it
just an idea and am not sure if it will work....


<?php
if($contents = "Phil") {
include ("philspage.txt");
} elseif($contents = "Chris") {
include ("chrispage.txt");
} elseif($contents = "Rick") {
include ("rickpage.txt");
} else {
echo "login request cannot be completed, please cntact phil";
?>

anyway back to the secure.php file

when i attempt to login with a username and password that is correct i get
the following error in secure.php...

Parse error: parse error, unexpected $ in /home/www/juttuffi/login/test.php
on line 10

im no php wizz but there are NO $ characters on line 10 that shouldnt be
there.... so could someone please tell me if they would how i can go about
correcting this and making the script work

i know its not great using sql and probably a bit rusty bit its only meant
for a small amount over users and as long as i can get this to work it would
be great

so the help will be much appreciated

Thanks

Christo


Reply With Quote
  #2 (permalink)  
Old 03-27-2005
Janwillem Borleffs
 
Posts: n/a
Default Re: help modding a script

Christo wrote:
> when i attempt to login with a username and password that is correct
> i get the following error in secure.php...
>
> Parse error: parse error, unexpected $ in
> /home/www/juttuffi/login/test.php on line 10
>
> im no php wizz but there are NO $ characters on line 10 that shouldnt
> be there.... so could someone please tell me if they would how i can
> go about correcting this and making the script work
>


You didn't close the if..else block properly:

<?php
if($contents = "Phil") {
include ("philspage.txt");
} elseif($contents = "Chris") {
include ("chrispage.txt");
} elseif($contents = "Rick") {
include ("rickpage.txt");
} else {
echo "login request cannot be completed, please cntact phil";
} <-- Missing in your code
?>


JW



Reply With Quote
  #3 (permalink)  
Old 03-27-2005
Geoff Berrow
 
Posts: n/a
Default Re: help modding a script

I noticed that Message-ID: <3anl88F69a4lvU1@individual.net> from Christo
contained the following:

>
>Parse error: parse error, unexpected $ in /home/www/juttuffi/login/test.php
>on line 10
>
>im no php wizz but there are NO $ characters on line 10 that shouldnt be
>there.... so could someone please tell me if they would how i can go about
>correcting this and making the script work


Dunno about the parse error, but the comparison operator is == not =

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Reply With Quote
  #4 (permalink)  
Old 03-27-2005
Christo
 
Posts: n/a
Default Re: help modding a script


"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:vd9d41pcehl65ljt3hoihk5lh6i41jgm15@4ax.com...
>I noticed that Message-ID: <3anl88F69a4lvU1@individual.net> from Christo
> contained the following:
>
>>
>>Parse error: parse error, unexpected $ in
>>/home/www/juttuffi/login/test.php
>>on line 10
>>
>>im no php wizz but there are NO $ characters on line 10 that shouldnt be
>>there.... so could someone please tell me if they would how i can go about
>>correcting this and making the script work

>
> Dunno about the parse error, but the comparison operator is == not =
>
> --
> Geoff Berrow (put thecat out to email)
> It's only Usenet, no one dies.
> My opinions, not the committee's, mine.
> Simple RFDs http://www.ckdog.co.uk/rfdmaker/


ahh yeah

lol i missed that one, thanks for pointing it out


Reply With Quote
  #5 (permalink)  
Old 03-27-2005
Christo
 
Posts: n/a
Default Re: help modding a script


"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:4246a4de$0$32377$dbd49001@news.euronet.nl...
> Christo wrote:
>> when i attempt to login with a username and password that is correct
>> i get the following error in secure.php...
>>
>> Parse error: parse error, unexpected $ in
>> /home/www/juttuffi/login/test.php on line 10
>>
>> im no php wizz but there are NO $ characters on line 10 that shouldnt
>> be there.... so could someone please tell me if they would how i can
>> go about correcting this and making the script work
>>

>
> You didn't close the if..else block properly:
>
> <?php
> if($contents = "Phil") {
> include ("philspage.txt");
> } elseif($contents = "Chris") {
> include ("chrispage.txt");
> } elseif($contents = "Rick") {
> include ("rickpage.txt");
> } else {
> echo "login request cannot be completed, please cntact phil";
> } <-- Missing in your code
> ?>
>
>
> JW
>
>
>


thanks :)


Reply With Quote
  #6 (permalink)  
Old 03-27-2005
Christo
 
Posts: n/a
Default Re: help modding a script


"Christo" <chris@juststuffnospam.co.uk> wrote in message
news:3anl88F69a4lvU1@individual.net...
>a friend of mine wanted me to have a go at this for him
>
> i have a limited knowledge of php, mainly because its similar to c/c++
> which i understand quite a bit more and also vb and vb.net so i figured i
> could mode the script the way he wanted
>
> i have this code.... in a file called secure.php
>
> <?php
>
> // Secure multiple user Log-In script by Dave Lauderdale - Originally
> published at: www.digi-dl.com
>
> $filename = "user.log";
> $log = fopen($filename, "r");
> $contents = fread($log, filesize($filename));
> fclose($log);
>
> if ($contents == "Phil" || $contents == "Chris" || $contents == "Rick") {
>
> $filename = "user.log";
> $log = fopen($filename, "w+");
> fputs($log,"");
> fclose($log);
> include ("test.php");
>
> } else {
> echo "<center><Br><font color=red face=arial size=3 >Error</font>...<font
> face=arial size=3 >You will have to log on via the log on form to view
> this page.<br><br><a href='login.html' style='color:black'>Click here</a>
> to try again.";
> }
> ?>
>
> forget about the logging in lets just say thats handled
>
> now i include test.php
>
> this checks which username is in $contents and then includes a txt file on
> the page for them individually, this is the part i have written myself, it
> just an idea and am not sure if it will work....
>
>
> <?php
> if($contents = "Phil") {
> include ("philspage.txt");
> } elseif($contents = "Chris") {
> include ("chrispage.txt");
> } elseif($contents = "Rick") {
> include ("rickpage.txt");
> } else {
> echo "login request cannot be completed, please cntact phil";
> ?>
>
> anyway back to the secure.php file
>
> when i attempt to login with a username and password that is correct i get
> the following error in secure.php...
>
> Parse error: parse error, unexpected $ in
> /home/www/juttuffi/login/test.php on line 10
>
> im no php wizz but there are NO $ characters on line 10 that shouldnt be
> there.... so could someone please tell me if they would how i can go about
> correcting this and making the script work
>
> i know its not great using sql and probably a bit rusty bit its only meant
> for a small amount over users and as long as i can get this to work it
> would be great
>
> so the help will be much appreciated
>
> Thanks
>
> Christo
>


after including the missing end of statement block "}" i am now seeing the
code on the screen and it is not being implimented as php? using the

include ("test.php")

will actually include the php code an execute it wont it?


Reply With Quote
  #7 (permalink)  
Old 03-27-2005
Christo
 
Posts: n/a
Default Re: help modding a script


"Christo" <chris@juststuffnospam.co.uk> wrote in message
news:3anl88F69a4lvU1@individual.net...
>a friend of mine wanted me to have a go at this for him
>
> i have a limited knowledge of php, mainly because its similar to c/c++
> which i understand quite a bit more and also vb and vb.net so i figured i
> could mode the script the way he wanted
>
> i have this code.... in a file called secure.php
>
> <?php
>
> // Secure multiple user Log-In script by Dave Lauderdale - Originally
> published at: www.digi-dl.com
>
> $filename = "user.log";
> $log = fopen($filename, "r");
> $contents = fread($log, filesize($filename));
> fclose($log);
>
> if ($contents == "Phil" || $contents == "Chris" || $contents == "Rick") {
>
> $filename = "user.log";
> $log = fopen($filename, "w+");
> fputs($log,"");
> fclose($log);
> include ("test.php");
>
> } else {
> echo "<center><Br><font color=red face=arial size=3 >Error</font>...<font
> face=arial size=3 >You will have to log on via the log on form to view
> this page.<br><br><a href='login.html' style='color:black'>Click here</a>
> to try again.";
> }
> ?>
>
> forget about the logging in lets just say thats handled
>
> now i include test.php
>
> this checks which username is in $contents and then includes a txt file on
> the page for them individually, this is the part i have written myself, it
> just an idea and am not sure if it will work....
>
>
> <?php
> if($contents = "Phil") {
> include ("philspage.txt");
> } elseif($contents = "Chris") {
> include ("chrispage.txt");
> } elseif($contents = "Rick") {
> include ("rickpage.txt");
> } else {
> echo "login request cannot be completed, please cntact phil";
> ?>
>
> anyway back to the secure.php file
>
> when i attempt to login with a username and password that is correct i get
> the following error in secure.php...
>
> Parse error: parse error, unexpected $ in
> /home/www/juttuffi/login/test.php on line 10
>
> im no php wizz but there are NO $ characters on line 10 that shouldnt be
> there.... so could someone please tell me if they would how i can go about
> correcting this and making the script work
>
> i know its not great using sql and probably a bit rusty bit its only meant
> for a small amount over users and as long as i can get this to work it
> would be great
>
> so the help will be much appreciated
>
> Thanks
>
> Christo
>


cheers got it working i forgot to do something i had echo" before


Reply With Quote
  #8 (permalink)  
Old 03-27-2005
Kimmo Laine
 
Posts: n/a
Default Re: help modding a script

"Christo" <chris@juststuffnospam.co.uk> kirjoitti
viestissä:3annanF6bd1j9U1@individual.net...
>
> "Christo" <chris@juststuffnospam.co.uk> wrote in message
> news:3anl88F69a4lvU1@individual.net...
>>a friend of mine wanted me to have a go at this for him
>>
>> i have a limited knowledge of php, mainly because its similar to c/c++
>> which i understand quite a bit more and also vb and vb.net so i figured i
>> could mode the script the way he wanted
>>
>> i have this code.... in a file called secure.php
>>
>> <?php
>>
>> // Secure multiple user Log-In script by Dave Lauderdale - Originally
>> published at: www.digi-dl.com
>>
>> $filename = "user.log";
>> $log = fopen($filename, "r");
>> $contents = fread($log, filesize($filename));
>> fclose($log);
>>
>> if ($contents == "Phil" || $contents == "Chris" || $contents == "Rick")
>> {
>>
>> $filename = "user.log";
>> $log = fopen($filename, "w+");
>> fputs($log,"");
>> fclose($log);
>> include ("test.php");
>>
>> } else {
>> echo "<center><Br><font color=red face=arial size=3 >Error</font>...<font
>> face=arial size=3 >You will have to log on via the log on form to view
>> this page.<br><br><a href='login.html' style='color:black'>Click here</a>
>> to try again.";
>> }
>> ?>
>>
>> forget about the logging in lets just say thats handled
>>
>> now i include test.php
>>
>> this checks which username is in $contents and then includes a txt file
>> on the page for them individually, this is the part i have written
>> myself, it just an idea and am not sure if it will work....
>>
>>
>> <?php
>> if($contents = "Phil") {
>> include ("philspage.txt");
>> } elseif($contents = "Chris") {
>> include ("chrispage.txt");
>> } elseif($contents = "Rick") {
>> include ("rickpage.txt");
>> } else {
>> echo "login request cannot be completed, please cntact phil";
>> ?>
>>
>> anyway back to the secure.php file
>>
>> when i attempt to login with a username and password that is correct i
>> get the following error in secure.php...
>>
>> Parse error: parse error, unexpected $ in
>> /home/www/juttuffi/login/test.php on line 10
>>
>> im no php wizz but there are NO $ characters on line 10 that shouldnt be
>> there.... so could someone please tell me if they would how i can go
>> about correcting this and making the script work
>>
>> i know its not great using sql and probably a bit rusty bit its only
>> meant for a small amount over users and as long as i can get this to work
>> it would be great
>>
>> so the help will be much appreciated
>>
>> Thanks
>>
>> Christo
>>

>
> after including the missing end of statement block "}" i am now seeing the
> code on the screen and it is not being implimented as php? using the
>
> include ("test.php")
>
> will actually include the php code an execute it wont it?


Unless 'test.php' begins with '<?php' and ends with '?>', no, it doesn't.
What you described indicates that it doesn't. It's treated as plain txt if
there are not php code tags in it.


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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:11 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0