PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 14th, 2002, 05:45 AM
chemaster chemaster is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 16 chemaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Authentication

I have a script that is working perfect. The script contains a form which loads information into the text area from a text file when you first goto it. Then you can make changes to the form and submit the changes to the text file.

It works perfect until I add any Authentication (login) script to it. It will load fine but when I hit submit, I get kicked out of the system without the changes taking affect and I must login again. I have tried three popular scripts today without any luck. Please see the code below and see what may be kicking me out and is there a way to correct it?

<?php
//require_once("adminOnly.php");

if(isset($_POST["company"]))
{
$file = "company.txt";
$fp0 = fopen("$file","w");
fputs($fp0, $_POST["company"]);
fclose($fp0);
}

$stuff1 = implode("",file("company.txt"));

?>

<body>

<form method=post>
<p><font face="Arial, Helvetica, sans-serif">Company Name:</font></p>
<p>
<textarea name="company" cols="30" rows="1">
<?php echo (htmlspecialchars(stripslashes($stuff1))); ?>
</textarea>
</p>
<input type=submit>
</form>
</body>

Reply With Quote
  #2  
Old November 14th, 2002, 03:07 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: Authentication

for one, i don't see that your form has any action

Reply With Quote
  #3  
Old November 14th, 2002, 04:11 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Authentication

U got to open it with w+, don't U? w will only delete the content of the file, the filesize will be set to zero!

and yes ur form needs an action like 'action="test.php"'

Reply With Quote
  #4  
Old November 14th, 2002, 04:33 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: Authentication

w or w+ are identical except that w+ will read as well as write.

Reply With Quote
  #5  
Old November 14th, 2002, 09:40 PM
sethadam1 sethadam1 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Orlando, FL
Posts: 223 sethadam1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Authentication

How bout letting us see adminOnly.php? More than likely something there is screwing with the process.

If you don't include an action in your forms, in HTML 4, at least, they submit to themselves via GET (actually, it might be post, I can't remember). That should not be the problem, although you should fix it for the sake of clean programming.

Reply With Quote
  #6  
Old November 15th, 2002, 12:08 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Authentication

maybe you should learn from that scripts, or read authentification tutorial, and code in yourself?

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Authentication


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway