Jump to content

Not responding when register_globals is turned off


Bickey

Recommended Posts

Why won't this code work when register_globals is turned off (works fine when register_globals is on though).

 

<?php
$link = mysql_connect("localhost","un","pw");
mysql_select_db("the_db");

$username = $_POST['usernamex'];
$surname = $_POST['surname'];
$email = $_POST['email'];

$result =sprintf("SELECT * FROM tbl WHERE username ='%s' || email = '%s'", mysql_real_escape_string($username), mysql_real_escape_string($email));
$resultfin = mysql_query($result);
if (mysql_num_rows ($resultfin) > 0){
$register = "Retry.";
echo($register);
} else {
$go =sprintf("INSERT INTO tbl (username, email, surname) VALUES ('%s', '%s', '%s'", mysql_real_escape_string($username), mysql_real_escape_string($email), mysql_real_escape_string($surname));
$resultg = mysql_query($go);
$register = "Successful.";
echo($register);
}
?>

 

Thanks,

Bickey.

Link to comment
Share on other sites

is there any other settings which I adjusted might be forcing to stop this code functioning? Truly appreciate your support.

 

Set as ON

engine On 

short_open_tag On

allow_call_time_pass_reference  On

display_errors  On

file_uploads  On

allow_url_fopen On

allow_url_include  On

 

Set as OFF

asp_tags Off

output_buffering Off

zlib.output_compression Off

implicit_flush  Off

safe_mode Off

safe_mode_gid Off

expose_php  Off

display_startup_errors Off

log_errors Off

ignore_repeated_errors Off

ignore_repeated_source Off

report_memleaks Off

track_errors Off

register_globals  Off

register_argc_argv  Off

magic_quotes_gpc Off

magic_quotes_runtime Off

magic_quotes_sybase  Off

sql.safe_mode Off

mysql.allow_persistent  Off

mysql.trace_mode  Off

Link to comment
Share on other sites

There's probably something in your form that is affected by register_globals.

 

As thorpe already asked, what debugging have you done to find out exactly at what point your code and data has the expected values and exactly at what point they don't. I can guarantee that the problem is somewhere between those two points.

Link to comment
Share on other sites

Thanks.

 

This is the exact script which is in my php file. The data is being to this file to pass them over to the mysql database.

 

<?php
$link = mysql_connect("localhost","un","pw");
mysql_select_db("the_db");

$result =sprintf("SELECT * FROM tbl WHERE username ='%s' || email = '%s'", mysql_real_escape_string($username), mysql_real_escape_string($email));
$resultfin = mysql_query($result);
if (mysql_num_rows ($resultfin) > 0){
$register = "Retry.";
echo($register);
} else {
$go =sprintf("INSERT INTO itc_applicants (username, password, surname, firstname, nickname, company, street, suburb, postal, phone, email, product, status, id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'", mysql_real_escape_string($username), mysql_real_escape_string($watchword), mysql_real_escape_string($surname), mysql_real_escape_string($firstname), mysql_real_escape_string($nickname), mysql_real_escape_string($company), mysql_real_escape_string($street), mysql_real_escape_string($suburb), mysql_real_escape_string($postal), mysql_real_escape_string($phone), mysql_real_escape_string($email), mysql_real_escape_string($product), mysql_real_escape_string($status), mysql_real_escape_string($id));
$resultg = mysql_query($go);
$register = "Successful.";
echo($register);
}
?>

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.