Error : Deprecated: Function session_register() is deprecated

I know why I'm getting it  - I know what the error is. error on line 18


What do I need to change

Second one I had today http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_25970442.html


<?php
session_start();
$PHP_SELF = $_SERVER['PHP_SELF'];
$errore = 0;
if(isset($_POST['submit']) && isset($_SESSION['captcha'])) {
	if(isset($_POST['code'])){
		$_code = $_POST['code'];
		if($_SESSION['captcha'] == $_code){
			header("Location: go.html");
			exit;
		} else {
			$errore = 1;
		}
	} else {
		$errore = 1;
	}
}
if(!isset($_SESSION['captcha'])){session_register('captcha');}	
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
	$letteraOnumero = rand(1,2);
	if($letteraOnumero == 1){
		// lettera
		$lettere = 'ABEFHKMNRVWX';
		$x = rand(1,11);
		$lettera = substr($lettere,$x,1);
		$stringa .= $lettera;
	} else {
		$numero = rand(3,7);
		$stringa .= $numero;
	}
}
$_SESSION['captcha'] = $stringa;
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Verify You Are Human!</title>
<link href="../PNL-CSS-2-Column.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="http://petenetlive.com/images/favicon.ico" type="image/x-icon">
<style type="text/css">
#captcha{margin:0 auto;text-align:center}
.errore{color:#f00}
body,td,th {
	color: f0f0f0;
}
body {
	background-color: #993300;
}
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif}
</style>
</head>

<body>
<div id="captcha">
	<p><img src="captcha.php" /></p>
  <p class="style5"><span class="style5"><strong>To proceed to the web form please<br />
    insert the code you see above into the Code field below<br />
    and then click the enter button.
  </strong> <br />
    [ any letters you see should be inserted as CAPITALS and if you<br /> 
    have difficulty in reading the image above then refresh your browser <br />
    a few times until you see an image that is clear enough to copy
  ]  </span></p>
  <p class="style5">If you get the code wrong, you will be allerted and can try again </p>
<form id="captchaform" action="<?php echo $PHP_SELF ?>" method="post">
		<p><label for="code"><span class="style4">Code</span>: </label>
	<input type="text" name="code" id="code" /></p>
		<p><input type="submit" id="submit" name="submit" value="Enter" /></p>
  </form>
	<?php if($errore == 1){ ?>
  <p class="errore style5"><span class="style4">The code you inserted was not correct .</span><br />
	<a href="<?php echo $PHP_SELF ?>" class="style5">Click here to generate a new Captcha code and try again</a></p>
  <?php } ?>
</div>
</body></html>

Open in new window

LVL 58
Pete LongTechnical ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Om PrakashCommented:
Replace
if(!isset($_SESSION['captcha'])){session_register('captcha');}      
with
if(!isset($_SESSION['captcha'])){$_SESSION['captcha'];}      
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pete LongTechnical ConsultantAuthor Commented:
Spot on - Points well deserved
0
Avinash ZalaWeb ExpertCommented:
use this:

replace
session_register('captcha');

with

$_SESSION['captcha'];


Hope this helps,
Addy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.