Jump to content
Sign in to follow this  
gmz1023

Problem With Php

Recommended Posts

Okay--so i've been working on a PHP login script (and i know its probably not secure, doesnt need to be). however i'm just now getting an error from it.heres the login codeheres the error code

<?php require("i_nc/functions.php"); if ((!isset($_GET["user"])) && (!isset($_GET["pass"])) ) {  redirect("index.php","Security Check : Hacker Attempt"); exit; } $user=$_GET["user"]; $pass=$_GET["pass"]; $fp=fopen("i_nc/users.db","r"); $userdata=array(); $redirect=""; while (($userdata = fgetcsv($fp, 1000, ",")) !== FALSE) {   if (($userdata[0]==$user) && ($userdata[1]==$pass))   { $redirect=$userdata[2]; } } fclose($fp); if ($redirect=="") {   redirect("index.php","Security Check : Fail"); } else {   setcookie("user",$user,time()+3600,"/");   setcookie("pass",$pass,time()+3600,"/");   redirect($redirect,"Security Check : Success"); } exit;?><html><head><title>Security check</title></head><body><pre> User entered : <?php print ($user . "/" . $pass)  if ($redirect<>"") {print("OK -> ".$redirect); } else {print("KO -> index"); } for ($i=0;$i<count($userdata);$i++) {  print($userdata[0] . "|" . $userdata[1] . "|" . $userdata[2] . "\n" ); }?></pre></body></html>

 User entered : "") {print("OK -> ".$redirect); } else {print("KO -> index"); } for ($i=0;$i

i realize its probably something stupid i've done, but hey... i cant figure it out lol

Share this post


Link to post
Share on other sites

Actually, you have a few mistakes:<?phpprint ($user . "/" . $pass); // missing semi-colon on this lineif ($redirect!="") {print("OK -> ".$redirect); } else {print("KO -> index"); } // I believe "<>" is not a PHP operator, != is the PHP equivalentfor ($i=0;$i<count($userdata);$i++){ print($userdata[0] . "|" . $userdata[1] . "|" . $userdata[2] . "\n" ); // I'm not sure what the loop is for if you're printing the same thing on each iteration}?>EditDo you usually program in ASP or Visual Basic?The <> operator and print command are from that.While print() is valid in PHP, echo is much preferrable, it runs faster.

Edited by Ingolme

Share this post


Link to post
Share on other sites

Its probably something i just dragged over from scripting for the game Doom3 lol...thanks pointing out those errors, however i'm still getting the same problem... i'm just gonna rewrite the whole script.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...