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
https://forums.phpfreaks.com/topic/219435-php-endless-problems-please-help/
Share on other sites

Maybe try

 

<?php

session_start();

if(!$_SESSION['myusername'])

{echo 'Please Login or Register';}

?>

 

But if that is broken, your pages that set the session are also broken.  Did your host upgrade there PHP version?

@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...

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' ";

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.