NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Register Globals

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-26-2006, 02:03 AM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 66
nigelwong is an unknown quantity at this point
 



Register Globals


Hi,

I have register globals turned on, but i have a script that when a form is posted, the variables are not passed on.

In the script at the top if i just go echo $dbhost; it works.

However, if i have something like

if (!isset($var1))
{
$dblink=@mysql_connect($dbhost, $dbuser, $dbpass);
}

The variables are not passed on. Any ideas?
__________________
Free AJAX Proxy: http://www.ctrlaltproxy.com
Useful DHTML/AJAX tutorials: http://www.dhtmlsite.com
nigelwong is offline  
Old 08-26-2006, 02:29 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
take the @ sign away and try again and see if any error message is displayed. If it is post it here.
Peter is offline  
Old 08-26-2006, 06:27 AM THREAD STARTER               #3 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 66
nigelwong is an unknown quantity at this point
 



The mysql function works, but it executes it has having no values in it. so it has an error like cannot connect with nobody@localhost (USINGPASSWORD: NO) etc.
__________________
Free AJAX Proxy: http://www.ctrlaltproxy.com
Useful DHTML/AJAX tutorials: http://www.dhtmlsite.com
nigelwong is offline  
Old 08-26-2006, 07:27 AM   #4 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
Hey nigel,
Try this:

PHP Code:
if (!isset($var1))
{
$dblink=@mysql_connect($_POST[dbhost], $_POST[dbuser], $_POST[dbpass]);
????: NamePros.com http://www.namepros.com/programming/231637-register-globals.html

Is that what you were looking for, or am I off? lol
BillyConnite is offline  
Old 08-26-2006, 08:10 AM   #5 (permalink)
Senior Member
 
Constantin's Avatar
Join Date: Jan 2006
Posts: 1,130
Constantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud of
 



Try this one:

$dblink=@mysql_connect("$dbhost", "$dbuser", "$dbpass");
Constantin is offline  
Old 08-26-2006, 08:25 AM   #6 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by BillyConnite
Hey nigel,
Try this:

PHP Code:
if (!isset($var1))
{
$dblink=@mysql_connect($_POST[dbhost], $_POST[dbuser], $_POST[dbpass]);
????: NamePros.com http://www.namepros.com/showthread.php?t=231637

Is that what you were looking for, or am I off? lol
^ Do not use register_globals..at all
Eric is offline  
Old 08-26-2006, 05:03 PM THREAD STARTER               #7 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 66
nigelwong is an unknown quantity at this point
 



I've tried substituting them with the $_POST things too, but they didn't work either =/ it's really weird.

Heres the code:
PHP Code:
<?PHP
$xinput_style
="style=\"BORDER-STYLE: solid;BORDER-COLOR: #999999; BACKGROUND-COLOR: #ffffff; BORDER-WIDTH: 1px; FONT-FAMILY: Verdana; FONT-SIZE: 8pt\"";

if(
phpversion() <= "4.0.6") { $_POST=$HTTP_POST_VARS; }
if (
$_POST['submit'])
    {
    if (
trim($_POST['db'])=="") { $e0=true; }
    if (
trim($_POST['dbhost'])=="") { $e1=true; }
????: NamePros.com http://www.namepros.com/showthread.php?t=231637
    if (
trim($_POST['dbuser'])=="") { $e2=true; }
    if (
trim($_POST['dbpass'])=="") { $e3=true; }
    if (!
is_writable(str_replace("/install1.php"""$HTTP_SERVER_VARS['PATH_TRANSLATED']))) { $e4=true; }
    
    if (!isset(
$e0)&&!isset($e1)&&!isset($e2)&&!isset($e3)&&!isset($e4))
        {
        
# --------------------------------------------------------
        
$dblink=@mysql_connect($dbhost$dbuser$dbpass);
        
$dbsel=@mysql_select_db($db);

        
$read_dump=@fopen("Master_DB.sql""r");
        
$result_dump=@fread($read_dumpfilesize("Master_DB.sql"));
        @
fclose($read_dump);

        
$result_dump=str_replace("`"""$result_dump);

        
$count=substr_count($result_dump"\n");
        
$explode=explode("\n"$result_dump);
????: NamePros.com http://www.namepros.com/showthread.php?t=231637
        
$buffer="";
        for (
$i=0$i<=($count-1); $i++)
            {
            
# Create db structure
            
if (substr($explode[$i], 01)!="#")
                {
                if (
substr(trim($explode[$i]), -1)==";"
                    { 
                    
$temp=str_replace(";"""$explode[$i]);
                    
$buffer.=str_replace("\n"" "$temp);
                    
mysql_query($buffer);
                    
$buffer=""
                    }
                else { 
$buffer.=str_replace("\n"" "$explode[$i]); }
                }
            }
__________________
Free AJAX Proxy: http://www.ctrlaltproxy.com
Useful DHTML/AJAX tutorials: http://www.dhtmlsite.com
nigelwong is offline  
Old 08-26-2006, 07:41 PM   #8 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
just a note are you sure you are meant to be using post variables for the database connection. this poses a huge security risk if that is what you are actually doing
Peter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:33 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger