Welcome, Guest. Please login or register.

Author Topic: Strange Behavior  (Read 1463 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Strange Behavior
« on: November 21, 2014, 08:04:50 PM »
I am in the process of creating a simple text based browser game. However when i attempt to log in in via IWeb, it keeps refreshing the page. It's supposed to check the log in info when the form is "posted". It leads me to believe that IWeb isn't sending "post" data. Any assistance in this matter would be greatly appreciated.

Sincerely,

Omega Space Protons
 

Offline cgutjahr

  • Hero Member
  • *****
  • Join Date: Feb 2003
  • Posts: 692
  • Country: 00
    • Show only replies by cgutjahr
Re: Strange Behavior
« Reply #1 on: November 21, 2014, 08:44:05 PM »
Quote from: Omega Space Protons;777961
IWeb

IBrowse or AWeb, which one is it?

Quote

It's supposed to check the log in info when the form is "posted"

Who should check what log in info?

Quote

It leads me to believe that IWeb isn't sending "post" data

Both IBrowse and AWeb are perfectly capable of posting data.

Quote

Any assistance in this matter would be greatly appreciated.

You need to provide way more information if you want some sensible input.

- which browser?
- what server (what software? is it local or remote?)?
- what does the login form look like?
- what is the script doing *exactly*?
- are cookies involved?
 

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Re: Strange Behavior
« Reply #2 on: November 26, 2014, 05:07:31 AM »
Sorry, forgot to include the required info. :(

Quote from: cgutjahr;777963
IBrowse or AWeb, which one is it?
AWeb

Who should check what log in info?
PHP Server Side Script

Both IBrowse and AWeb are perfectly capable of posting data.


You need to provide way more information if you want some sensible input.

- which browser?
AWeb

- what server (what software? is it local or remote?)?
Remote Aphache running PHP 5 and MySQL Server

- what does the login form look like?
Link

- what is the script doing *exactly*?
Checking if the form was posted and if it was then check the login info against the mysql database and return if it matches. Otherwise show the log in page. Source Code
Snip
Code: [Select]
// if the form wasn't submited                                else if(!isset($_POST["submit"]))                                {                                 // display it                                 $chops->display('index.tpl');                                
                                   // and terminate                                    exit;                                }                                // otherwise the form was submitted                                else                                {                                 // if the username is empty                                 if(empty($_POST["username"]))                                 {                                 // set the dialog title                                 $chops->title = 'Error';                                
                                // set the dialog message stating the username is empty                                 $chops->message = 'username is empty';                                
                                // set the back link                                 $chops->backurl = 'index.php';                                
                                // and display it                                 $chops->display('messagedialog.tpl');                                
                                // and terminate                                 exit;                                 }                                 // if the username is too short or too big                                 elseif(strlen($_POST[&quot;username&quot;]) < 4 || strlen($_POST[&quot;username&quot;]) > 16)                                 {                                 // set the dialog title                                 $chops->title = 'Error';                                
                                // set the dialog message stating the username is too short or too big                                 $chops->message = 'username must be 4-16 characters long';                                
                                // set the back link                                 $chops->backurl = 'index.php';                                
                                // and display it                                 $chops->display('messagedialog.tpl');                                
                                // and terminate                                 exit;                                 }                                 elseif(!preg_match(&quot;#^[a-z0-9]*$#&quot;, $_POST[&quot;username&quot;]))                                 {                                 // set the dialog title                                 $chops->title = 'Error';                                
                                // set the dialog message stating the username contains invalid characters                                 $chops->message = 'username contains invalid characters';                                
                                // set the back url                                 $chops->backurl = 'index.php';                                
                                // and display it                                 $chops->display('messagedialog.tpl');                                
                                // and terminate                                 exit;                                 }                                 // otherwise the username is filled in                                 else                                 {                                 // so sanitize it                                 $_POST[&quot;username&quot;] = trim(strip_tags($_POST[&quot;username&quot;]));                                 }                                
                                // if the password is empty                                 if(empty($_POST[&quot;password&quot;]))                                 {                                 // set the dialog title                                 $chops->title = 'Error';                                
                                // set the dialog message stating the password is empty                                 $chops->message = 'password is empty';                                
                                // set the back url                                 $chops->backurl = 'index.php';                                
                                // and display it                                 $chops->display('messagedialog.tpl');                                
                                // and terminate                                 exit;                                 }                                 // if the password is too short or too big                                 elseif(strlen($_POST[&quot;password&quot;]) < 6 || strlen($_POST[&quot;password&quot;]) > 32)                                 {                                 // set the dialog title                                 $chops->title = 'Error';                                
                                // set the dialog message stating the password is too short or too big                                 $chops->message = 'password must be 6-32 characters long';                                
                                // set the back url                                 $chops->backurl = 'index.php';                                
                                // and display it                                 $chops->display('messagedialog.tpl');                                
                                // and terminate                                 exit;                                 }                                 // otherwise the password is ok                                 else                                 {                                 // so sanitize it                                 $_POST[&quot;password&quot;] = trim(strip_tags($_POST[&quot;password&quot;]));                                 }                                
                                   // create instance of database class                                    $database = new Database();                                
                                // create instance of user class                                 $user = new User($database);                                
                                // check the users login info                                 if($user->checkLogin($_POST[&quot;username&quot;], $_POST[&quot;password&quot;]))                                 {                                 // store info in session data                                 $_SESSION['username'] = $user->getUsername();                                 $_SESSION['password'] = $user->getPassword();                                
                                // sanatize user info                                 $user->sanitize();                                
                                // redirect to the game                                 header(&quot;Location: main.php&quot;);                                 }
- are cookies involved?
No PHP Sessions
Thanks,

Sincerely,

Omega Space Protons
 

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Re: Strange Behavior
« Reply #3 on: January 10, 2015, 06:14:02 AM »
Hey it's been a month since i last posted and no one has answered seemed to figure out why this is happening. I also tried figuring it out to no avail. If anyone could please take a look and see if they can spot anything obvious it would be greatly appreciated.

Sincerely,

Omega Space Protons
 

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Re: Strange Behavior
« Reply #4 on: February 06, 2015, 06:33:07 AM »
Sorry to bump this topic but it seems not many Amiga programmers here, or no one can figure out what's wrong. Still working on this.

Sincerely,

Omega Space Protons