Jump to content

PHP endless problems PLEASE HELP!!


Mr_J

Recommended Posts

Hi all,

I have a site where the user must register to buy some products. After registration, you login and with the help of SESSIONS, you can view the page buynow.php.

After the weekend, I opened the page and I got some yummy errors...

Fatal error: Call to undefined function stop() in /home/pharmacz/public_html/ads/main_login.php on line 6

And line 6 reads:

 

YES, BLANK...

This is the php code:

<?php
session_start();
if(!session_is_registered(myusername)){
echo 'Please Login or Register';
}

?>

I know I can use !isset...

 

The register.php work fine

Any Idea??

Link to comment
Share on other sites

@Goldeneye

I simply check the session and redirect to the login page. [myusername] is 100% valid session.

Process.php:

<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect to LOCALHOST");
mysql_select_db("$db_name")or die("cannot select DATABASE");


// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=md5($_POST['mypassword']);
$myemail=$_POST['myemail'];

// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myemail = stripslashes($myemail);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$myemail = mysql_real_escape_string($myemail);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword' and email='$myemail'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file...
session_register("myusername");
session_register("mypassword");
session_register("myemail");

header("location:buynow.php");
}
else {
echo 'Wrong Username or Password<br/><a href="javascript:history.go(-1)"><input type="button" value="Back">';
}
?>

 

@revrazI will try the { } to echo.

You know these fucking host peoples do just what they want and for the price I pay per month, I will work my way around the problem...

Thanks...

Link to comment
Share on other sites

BTW, this is the only php in BUYNOW.php exept for the form rows etc.:

<?php          //hierdie kom in elke page wat net deur members gesien mag word
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
require_once( dirname(__FILE__).'/buy/form.lib.php' );
phpfmg_display_form();
function phpfmg_form( $sErr = false ){
        $style=" class='form_text' ";

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.