Problem with session_register

Asked

Viewed 1,752 times

-4

I have a script here but when I open the file ptc.php in the browser goes blank, I think it is the php version of my hosting that is making this error.

I use PHP 5.4.26

and how do I update the code?

ptc.php

<?php
session_start();
session_register("asess_name");
session_register("asess_passwd");
session_register("asess_data");
include("../vars.php");
include("adminauth.incl.php");
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
adminAuth();
$todaysdate = date("Y-m-d");
if ($_POST['action'] == 'add') {
$errorz = "";
if ($_POST['user_id'] == "" || !is_numeric($_POST['user_id'])) {
$errorz = $errorz . "ID de usuario em branco ou nao e um numero!<br>";
}
if (($_POST['image_url'] == "" || !ereg('http://', $_POST['image_url'])) && $_POST['type'] == 'banner') {
$errorz = $errorz . "Voce deve entrar a URL do banner!<br>";
}
if ($_POST['text_link'] == "" && $_POST['type'] == 'text') {
$errorz = $errorz . "Voce deve entrar o Link Texto!<br>";
}
if ($_POST['link_url'] == "" || !ereg('http://', $_POST['link_url'])) {
$errorz = $errorz . "A URL do Link esta em branco ou e invalida!<br>";
}
if ($_POST['timer'] == "" || !is_numeric($_POST['timer'])) {
$errorz = $errorz . "O tempo esta em branco ou nao e um numero (entre 0 para sem tempo)!<br>";
}
if ($_POST['crdtype'] == 'credit' && ($_POST['click_crd_amount'] == "" || !is_numeric($_POST['click_crd_amount']))) {
$errorz = $errorz . "A quantidade de credito e invalida!<br>";
}
if ($_POST['crdtype'] == 'cash' && ($_POST['click_csh_amount'] == "" || !is_numeric($_POST['click_csh_amount']))) {
$errorz = $errorz . "A quantidade de credito e invalida!<br>";
}
if ($_POST['clicks_remaining'] <= 0 || !is_numeric($_POST['clicks_remaining'])) {
$errorz = $errorz . "O total de cliques e invalido!<br>";
}
if ($_POST['once_per'] == 'mye' && ($_POST['once_perds'] == "" || !is_numeric($_POST['once_perds']) || $_POST['once_perds'] <= 7)) {
$errorz = $errorz . "Creditos por X quantidade de dias e invalido!<br>";
}
if ($_POST['once_per'] == 'mye') {
$oncer = $_POST['once_perds'];
} else {
$oncer = $_POST['once_per'];
}
if ($errorz == "") {
$linkids = ranid(25);
if ($_POST['type'] == 'text') {
if ($_POST['crdtype'] == 'credit') {
$upd = mysql_query("INSERT INTO ptc_orders (type, type2, userid, linkid, linkurl, linktxt, clicks_remain, amt_sent, date_sent, credit_click, adtimer, day_lock) VALUES ('text', 'credit', $_POST[user_id], '$linkids', '$_POST[link_url]', '$_POST[text_link]', $_POST[clicks_remaining], $_POST[clicks_remaining], '$todaysdate', $_POST[click_crd_amount], $_POST[timer], $oncer)") or die (mysql_error());
$ddone = 'yes';
} else {
$upd = mysql_query("INSERT INTO ptc_orders (type, type2, userid, linkid, linkurl, linktxt, clicks_remain, amt_sent, date_sent, cash_click, adtimer, day_lock) VALUES ('text', 'cash', $_POST[user_id], '$linkids', '$_POST[link_url]', '$_POST[text_link]', $_POST[clicks_remaining], $_POST[clicks_remaining], '$todaysdate', $_POST[click_csh_amount], $_POST[timer], $oncer)") or die (mysql_error());

$ddone = 'yes';}
} else {
if ($_POST['crdtype'] == 'credit') {
$upd = mysql_query("INSERT INTO ptc_orders (type, type2, userid, linkid, linkurl, banurl, clicks_remain, amt_sent, date_sent, credit_click, adtimer, day_lock) VALUES ('banner', 'credit', $_POST[user_id], '$linkids', '$_POST[link_url]', '$_POST[image_url]', $_POST[clicks_remaining], $_POST[clicks_remaining], '$todaysdate', $_POST[click_crd_amount], $_POST[timer], $oncer)") or die (mysql_error());
$ddone = 'yes';
} else {
$upd = mysql_query("INSERT INTO ptc_orders (type, type2, userid, linkid, linkurl, banurl, clicks_remain, amt_sent, date_sent, cash_click, adtimer, day_lock) VALUES ('banner', 'cash', $_POST[user_id], '$linkids', '$_POST[link_url]', '$_POST[image_url]', $_POST[clicks_remaining], $_POST[clicks_remaining], '$todaysdate', $_POST[click_csh_amount], $_POST[timer], $oncer)") or die (mysql_error());
$ddone = 'yes';
}
}
}
} elseif ($_POST['action'] == 'delete' && $_POST['ptcid'] >= 1) {
$del = mysql_query("SELECT linkid FROM ptc_orders WHERE ptcid=$_POST[ptcid]");
if (mysql_num_rows($del) != 0) {
$delinkid = mysql_result($del, 0, "linkid");
$upd = mysql_query("DELETE FROM ptc_orders WHERE ptcid=$_POST[ptcid]");
$upd = mysql_query("DELETE FROM ptc_tracking WHERE banlinkid='$delinkid'");
}
header("Location: ptc.php?page=edit");
mysql_close;
exit;
}
?>
<html>
<head>
<title><? echo($title); ?> Administracao PTC</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
defaultStatus = 'PTC Admin Area';
//-->
</script>
</head>
<body>
<?
if ($errorz != "") {
?>
<p><font color="#FF0000" size="2" face="Tahoma"><strong>ERRO:<br>
<?
echo($errorz);
?>
<br>
</strong></font><font size="2" face="Tahoma"><a href="javascript:history.go(-1)">Voltar</a></font></p>
<?
} elseif ($ddone == 'yes') {
?>
<p><font color="#336600" size="2" face="Tahoma"><strong>SUCCESSO: PTC Advert Adicionado
      com sucesso</strong></font></p>
<?
}
if ($_GET['page'] == 'addnew') {
?>
<form name="add_form" method="post" action="ptc.php">
<table align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="642">
  <p align="center"><strong><font size="4" face="Tahoma">Adicionar Novo PTC Advert</font></strong></p>
  <p align="center"><font face='Tahoma' size='2'>Se voce esta adicionando um texto link,
      deixe a <strong>URL do Banner</strong> em branco. Se voce esta adicionando um link de Banner, deixe
      o <strong>Texto Link</strong> em branco. Se o <strong>Tipo de Credito</strong> e dinheiro a <strong>Quantidade
      de Cliques (creditos)</strong> nao e aplicavel, inverso se o <strong>Tipo de Credito</strong> e creditos, a
      <strong>Quantidade de Cliques (dinheiro)</strong> nao e aplicavel.</font></p>
  <table width="640" border="0" align="center" cellpadding="2" cellspacing="0">
<input type='hidden' name='action' value='add'>
<tr>
<td width="235"><font face='Tahoma' size='2'>Usuario ID:</font></td>
<td width="397"><input type='text' name='user_id' size='15'></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Tipo:</font></td>
  <td><select name='type'>
      <option value='banner'>Banner</option>
      <option value='text'>Texto</option>
    </select>

<tr>
  <td><font face='Tahoma' size='2'>Tipo de credito:</font></td>
<td><select name='crdtype'><option value='credit'>Creditos</option><option value='cash'>Dinheiro</option></select>
<tr>
  <td><font face='Tahoma' size='2'>URL do Banner:</font></td>
<td><input type='text' name='image_url' size='50'></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>URL do Link:<br>
      <font size="1">Onde
as pessoas vao quando o link e clicado.</font> </font></td>
<td><input type='text' name='link_url' size='50'></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Link Texto:</font></td>
<td><textarea name='text_link' wrap='virtual' rows='4' cols='35'></textarea></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Tempo (em segundos):</font></td>
<td><input type='text' name='timer' size='5'></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Quantidade de cliques (creditos):</font></td>
  <td><input type='text' name='click_crd_amount' size='15'>
  </td>
</tr>
<tr>
  <td><font face='Tahoma' size='2'>Quantidade de cliques (dinheiro):</font></td>
<td><font size="2" face="Tahoma">$</font>  <input type='text' name='click_csh_amount' size='15'></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Total de Cliques:</font></td>
<td><input name='clicks_remaining' type='text' size="15"></td></tr>
<tr>
  <td><font face='Tahoma' size='2'>Travar dia:<br>
      <font size="1">Quantidade de dias do credito.
0 = uma vez por membro.</font> </font></td>
<td><select name='once_per'><option value='0'>Um clique por membro</option><option value='1'>Uma vez por dia</option><option value='2'>Uma vez a cada 2 dias</option><option value='3'>Uma vez a cada 3 dias</option><option value='4'>Uma vez a cada 4 dias</option><option value='5'>Uma vez a cada 5 dias</option><option value='6'>Uma vez a cada 6 dias</option><option value='7'>Uma vez por semana</option><option value='mye'>Irei entrar isto</option></select>
  <font size="2" face="Tahoma">  ou Um Clique a Cada
  <input name="once_perds" type="text" size="2" maxlength="3"> 
    Dia.</font></td>
</tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2' align='center'><input type='submit' value='Adicionar Novo PTC Advert'></td></tr>
</table></td>
</tr></table>
</form>
<?
} elseif ($_GET['page'] == 'edit') {
$getptcads = mysql_query("SELECT * FROM ptc_orders");
?>
<table width="666" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="613"><div align="center">
  <p><font size="4" face="Tahoma"><strong>Editar PTC Adverts</strong></font></p>
  <table width="625" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">
    <tr>
      <td width="294"><strong><font size="2" face="Tahoma">Link ID</font></strong></td>
      <td width="42"><strong><font size="2" face="Tahoma">Tipo</font></strong></td>
      <td width="87"><strong><font size="2" face="Tahoma">Total de Cliques</font></strong></td>
      <td width="97"><strong><font size="2" face="Tahoma">Cliques Faltantes</font></strong></td>
      <td width="25"><div align="center"><strong><font size="2" face="Tahoma">Editar</font></strong></div></td>
      <td width="42"><div align="center"><strong><font size="2" face="Tahoma">Deletar</font></strong></div></td>
    </tr>
<?
for ($i = 0; $i < mysql_num_rows($getptcads); $i++) {
$ptcid = mysql_result($getptcads, $i, "ptcid");
$linkid = mysql_result($getptcads, $i, "linkid");
$adtype = mysql_result($getptcads, $i, "type");
$tclicks = mysql_result($getptcads, $i, "amt_sent");
$cremain = mysql_result($getptcads, $i, "clicks_remain");
$ban_url = mysql_result($getptcads, $i, "banurl");
$linkurl = mysql_result($getptcads, $i, "linkurl");
$linktxt = mysql_result($getptcads, $i, "linktxt");
echo("<tr><td><font size=\"2\" face=\"Tahoma\">$linkid</font></td><td><font size=\"2\" face=\"Tahoma\">$adtype</font></td><td><font size=\"2\" face=\"Tahoma\">$tclicks</font></td><td><font size=\"2\" face=\"Tahoma\">$cremain</font></td><form name=\"edit\" method=\"post\" action=\"editptc.php\"><input type=\"hidden\" name=\"ptcid\" value=\"$ptcid\"><input type=\"hidden\" name=\"action\" value=\"edit\"><td><div align=\"center\"><input type=\"Submit\" value=\"Editar\"></div></td></form><form name=\"remove\" method=\"post\" action=\"ptc.php\"><input type=\"hidden\" name=\"ptcid\" value=\"$ptcid\"><input type=\"hidden\" name=\"action\" value=\"delete\"><td><div align=\"center\"><input type=\"Submit\" value=\"Deletar\"></div></td></form></tr>");
if ($adtype == 'banner') {
echo("<tr><td colspan=6 align=center><font size=\"2\" face=\"Tahoma\"><b>EXEMPLO:</b><br></b></font><a href=\"$linkurl\" target=_blank><img src=\"$ban_url\" border=0></a></td></tr>");
} else {
echo("<tr><td colspan=6 align=center><font size=\"2\" face=\"Tahoma\"><b>EXEMPLO:</b><br><a href=\"$linkurl\" target=_blank>$linktxt</a></font></td></tr>");
}
}
?>
  </table>
</div></td>
</tr></table>
<?
}
mysql_close;
?>
<p align="center"><a href="<? echo("/control/?y=19"); ?>"><font size="2" face="Tahoma">Voltar para Administracao</font></a> - <a href="<? echo("ptc.php?page=edit"); ?>"><font size="2" face="Tahoma">Editar PTC Adverts</font></a> - <a href="<? echo("ptc.php?page=addnew"); ?>"><font size="2" face="Tahoma">Adicionar Novo PTC Advert</font></a></p>
</body>
</html>
<?
exit;
?>
  • Add these 2 lines at the beginning to display the error. ini_set('display_errors', true); error_reporting(E_ALL);

  • Fatal error: Call to Undefined Function reporting_error() in /home/vol8_6/cuccfree.com/cucch_14968503/htdocs/control/ptc.php on line 4

  • What is the php version?

  • 5.4.26 PHP Version

  • To update the code, copy the file to your hosting.

2 answers

3

Session_register was discontinued in php5.3 and removed in php5.4 the error messages respectively are:

Deprecated: Function session_register() is deprecated

and

Fatal error: Call to Undefined Function session_register()

to fix this error the solution is the same just atruibir the values directly to $_SESSION.

change:

session_register("asess_name");

To:

if(!isset($_SESSION['asess_name'])){
   $_SESSION['asess_name'] = 'algum valor';
}

To fix the function error ereg_* which is also obsolete, see that question

if (($_POST['image_url'] == "" || !ereg('http://' ...
  • tried and didn’t work

  • I switched out all the free

  • @rray +1 I want to see if you win the http://answall.com/help/badges/57/reversal medal will be the first at Sopt.

  • @Guilhermenascimento, thank you, I find it hard to happen.

  • But it’s +20 points or +20 upvotes? Why if it’s +20 points you’ve already won, right? Or did I read the wrong text rs.

  • @Guilhermenascimento, is twenty ups same hehe medalhes of others are difficult even.

  • Campaign for it then, "Help @rray win the first Reversion medal in the community"

Show 2 more comments

0

Mine was like this:

if ( !isset( $_SESSION['session_setup'] ) )
{
    session_register( "session_setup" ) ;
    $session_setup = ARRAY() ;
    $_SESSION['session_setup'] = ARRAY() ;
}

I just deleted that line:

session_register( "session_setup" ) ;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.