steff_dk Posted November 7, 2006 Share Posted November 7, 2006 I get this error:[quote]Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0[/quote]-when I run this script:[code]<?PHP//start the sessionsession_start();//check to make sure the session variable is registeredif(session_is_registered('bestyrelse')){//the session variable is registered, the user is allowed to see anything that follows$titel = $_POST['titel'];$fornavn = $_POST['fornavn'];$efternavn = $_POST['efternavn'];$adresse = $_POST['adresse'];$postnr = $_POST['postnr'];$postby = $_POST['postby'];$mailadresse = $_POST['mailadresse'];$enhed = $_POST['enhed'];$cpr = $_POST['cpr'];$bestyrelse = $_POST['bestyrelse'];$senior = $_POST['senior'];$noter = $_POST['noter'];//set the database connection variables$dbHost = "localhost";$dbUser = "mydomain_dk";$dbPass = "password";$dbDatabase = "mydomain_dk";//connect to the database$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");$newpass = rand(1001, 9999);mysql_query("INSERT INTO medlemmer(titel, fornavn, efternavn, adresse, postnr, postby, mailadresse, enhed, cpr, bestyrelse, senior, noter, md5pass) VALUES('$titel', '$fornavn', '$efternavn', '$adresse', '$postnr', '$postby', '$mailadresse', '$enhed', '$cpr', '$bestyrelse', '$senior', '$noter', md5('$newpass'))", $db);$ID=mysql_insert_id();mysql_query("UPDATE medlemmer set md5user=MD5('$ID') WHERE ID='$ID'") or die(mysql_error());print("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' ><head><meta http-equiv='content-type' content='text/html; charset=iso-8859-1' /><style type='text/css' title='currentStyle' media='screen'> @import 'css/frameinframesource.css'; </style></head><body style='background-color: #FFFFFF'><div>");if($bestyrelse == 'on'){$bestyrelse="Ja";} else{$bestyrelse="Nej";}if($senior == 'on'){$senior="Ja";} else{$senior="Nej";}print("<h3><span>Medlemsoplysninger for medlemsnr $ID</span></h3><br><br>");print("<p class='p2'><span><table border='0' style='border-collapse: collapse' bordercolor='#111111' width='350' cellpadding='2' id='viewuser'><tr><td colspan='2'>$titel $fornavn $efternavn</td></tr><tr><td colspan='2'>$adresse</td></tr><tr><td colspan='2'>$postnr $postby<br><br><br></td></tr><tr><td>mailadresse</td>");print("<td>$mailadresse</td></tr><tr><td>Enhed</td><td>$enhed</td></tr><tr><td>CPR</td><td>$cpr</td></tr><tr><td>Noter</td><td>$noter</td></tr><tr><td>Senior: $senior</td><td>Bestyrelse: $bestyrelse</td></tr><tr><td colspan='2'><br><br>Brugeren er oprettet<br>og kan logge på med brugernavn: $ID<br>og password: '$newpass'</td></tr><tr><td colspan='2'><br><br><a href='edituser.php?medlemID=$ID'>Redigér</a></td></tr></table></span></p>");print("</div></body></html>");}else{//the session variable isn't registered, send them back to the login pageheader( "Location: source.php?textID=1" );}?>[/code]I set my sessions like this:[code]//start the session and register a variable session_start(); session_register('username');[/code]What's that about? Quote Link to comment Share on other sites More sharing options...
sinisake Posted November 7, 2006 Share Posted November 7, 2006 You will nedd to call session variables like this:$_SESSION['var']=$some_var;[b]Please be advised that the session extension does not consider global variables as a source of data,unless register_globals is enabled. [/b]php5 i guess?so u don't have to use session_register(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.