modernmafia Posted March 10, 2012 Share Posted March 10, 2012 (edited) Error on my lotto page : Deprecated: Function ereg() is deprecated in /home/public_html/s2/s2/Lotto.php on line 70 Line 70 = if ($amount == 0 || !$amount || ereg('[^0-9]',$amount)){ multi dice error : Deprecated: Function ereg_replace() is deprecated in /home/public_html/s2/s2/_m_dice2.php on line 16 Deprecated: Function ereg_replace() is deprecated in /home/public_html/s2/s2/_m_dice2.php on line 18 line 16 :$_POST['fee'] = ereg_replace("[^0-9]",'',$_POST['fee']); line 18 :$_POST['autoroll'] = ereg_replace("[^0-9]",'',$_POST['autoroll']); Edited March 10, 2012 by modernmafia Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 11, 2012 Author Share Posted March 11, 2012 Parse error: syntax error, unexpected '(' in /home/modernma/public_html/s2/_m_dice2.php on line 16 line 16 : $_POST['fee'] = preg_match()("[^0-9]",'',$_POST['fee']); think i put a bracket in the wrong place Quote Link to comment Share on other sites More sharing options...
sniko Posted March 11, 2012 Share Posted March 11, 2012 $_POST['fee'] = preg_match()("[^0-9]",'',$_POST['fee']); $_POST['fee'] = preg_match("[^0-9]",'',$_POST['fee']); Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 11, 2012 Author Share Posted March 11, 2012 thank you SomeRandomBastard for the information that is now bookedmarked and thanks sniko for the corrections Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 13, 2012 Author Share Posted March 13, 2012 (edited) I have this error now in my inbox only get it when i login first time it go straight to inbox then after going off inbox then going back on to the error is gone 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 <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> <html> <head> <title>Game.com</title></head> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"> <?php include("leftmenu.php");?> </TD> <td width="100%" valign="top"> <br> <? $delete = strip_tags($_GET['id']); if($delete) { $sql = "UPDATE messages Set inbox='1' WHERE id=$delete"; $result = mysql_query($sql); } if ($_GET['page']){ $page = $_GET['page']; if ($page == "1"){ $start="0"; $end="10";} elseif ($page == "2"){ $start="11"; $end="10";} elseif ($page == "3"){ $start="22"; $end="10";} elseif ($page == "4"){ $start="33"; $end="10";} elseif ($page == "5"){ $start="44"; $end="10";} elseif ($page == "6"){ $start="55"; $end="10";} elseif ($page == "7"){ $start="66"; $end="10";} $nextpage = $page + 1; $backpage = $page - 1; $sql2="SELECT * FROM messages WHERE t='$username' AND r='1' AND saved='0' AND inbox='0' ORDER BY id DESC LIMIT $start,$end"; }else{ $sql2="SELECT * FROM messages WHERE t='$username' AND r='1' AND saved='0' AND inbox='0' ORDER BY id DESC LIMIT 0,10"; $page =="1"; $nextpage = 2; } $result2=mysql_query($sql2); ?> <form action="clearinbox.php"> <center><input type=submit value="Clear Inbox" class=header style="border:2px solid black;"> </center></form> <? if ($page >1){ ?> <form action="Inbox.php?page=<? echo $backpage ; ?>" method="post"><center><b> <input type=submit name="back" value="Back" class=header style="border:2px solid black;"></b></center> </form> <? } if ($page <7){ ?> <form action="Inbox.php?page=<? echo $nextpage ; ?>" method="post"><center> <input type=submit name="next" value="Next" class=header style="border:2px solid black;"></center> </form> <? } ?> <?php include "bb.php"; include "includes/game_connect.php"; $username=$_SESSION["real_name"]; mysql_query("UPDATE users SET mail='0' WHERE username='$username'"); mysql_query("UPDATE users SET agreedtos='1' WHERE username='$username'"); $sql="SELECT * FROM messages WHERE t='$username' AND r='0' AND saved='0' ORDER BY id DESC"; $result=mysql_query($sql); ?> <? while($rows=mysql_fetch_array($result)){ // Start looping table row $id=$rows['id']; $name = $rows['f']; $message = $rows['message']; $sql = "select * from advert;"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { $site= $row['site']; $message = str_replace("$site","Modern-Mafia.com",$message); } ?> <table border="1" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=89%> <tr> <td class="header" colspan="2" background="#525252" align="center"><font color=<? echo $layout ; ?>><b>From: </b></font><font color="white"><a href="viewprofile.php?viewuser=<? echo $rows['f']; ?>"><? echo dobbcodes($rows['f']); ?></a></font></td> </tr> <tr> <td class=newmessage bgcolor="#525252" align="center"><? echo inboxbb($message); ?><br /> <br> <br> <font color=white><b><a href="Inbox.php?id=<? echo $id ;?>">Delete</a> - <a href="savemail.php?id=<? echo $id ;?>">Save</a> - <a href='replymessage.php?id=<? echo $id ;?>' style=\"\">Reply</a></b></font> </td> </tr> </table><br> <?php } include "includes/game_connect.php"; $username=$_SESSION["real_name"]; mysql_query("UPDATE messages SET r='1' WHERE t='$username'"); while($rows2=mysql_fetch_array($result2)){ // Start looping table row $id2=$rows2['id']; $name = $rows2['f']; ?> <br> <table border="1" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=89%> <tr> <td class="header" colspan="2" align="center"><font color=<? echo $layout ; ?>><b>From: </b></font><font color="white"><a href="viewprofile.php?viewuser=<? echo $rows2['f']; ?>"><? echo dobbcodes($rows2['f']); ?></a></font></td> </tr> <tr> <td class=oldmessage bgcolor="#515151" align="center"><? echo inboxbb($rows2['message']); ?><br /> <br> <br> <font color=white><b><a href="Inbox.php?id=<? echo $id2 ?>">Delete</a> - <a href="savemail.php?id=<? echo $id2 ?>">Save</a> - <a href='replymessage.php?id=<? echo $id2;?>' style=\"\">Reply</a></b></font> </td> </tr> </table> <? } mysql_close(); ?> <br> </td> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> </center> </body> </html> Edited March 13, 2012 by modernmafia Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 13, 2012 Author Share Posted March 13, 2012 line 1 to 15 <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 15, 2012 Author Share Posted March 15, 2012 suggestions ? Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted March 15, 2012 Share Posted March 15, 2012 (edited) You have the same $var maybe you are using such as: real_name . look for $real_name= in your script, if you have it change it. change $username=$_SESSION["real_name"]; maybe? Or change <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> To: <? session_start(); if (!(isset($username))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> Edited March 15, 2012 by lucky3809 Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 16, 2012 Author Share Posted March 16, 2012 im still getting it Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 16, 2012 Share Posted March 16, 2012 Could be that one of your vars is used elsewhere and is already set. Change $username to something else Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 16, 2012 Author Share Posted March 16, 2012 i aint been doing this long so can you tell me what i should use Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 16, 2012 Share Posted March 16, 2012 Well the error points to you using the same variable which has been set as a session. So if there is for example a session such as $_SESSION['username'] then using $username would throw the error. So you need to look at your code maybe not just that page if you have perhaps a header thats loading too and make sure you not using the same names. Changing it to $usernames would resolve it doesnt have to be anything special. Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 16, 2012 Author Share Posted March 16, 2012 i think i might have found out why This is what i found in my functions file : if (empty($_SESSION['real_name'])){ echo " <SCRIPT LANGUAGE='JavaScript'> window.location='index.php'; then is is in my login check : session_register('username'); $_SESSION['real_name'] = $inf->username; $_SESSION["userlevel"] = $inf->userlevel; $_SESSION["crewlevel"] = $inf->crewlevel; but it might be caused by left menu too : <?php include "includes/game_connect.php"; $date = gmdate('Y-m-d h:i:s'); $username=$_SESSION["real_name"]; looks like im using too many of the same variable Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 16, 2012 Share Posted March 16, 2012 So change $username to $user or anything else. Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 16, 2012 Author Share Posted March 16, 2012 well after reading the topic on : http://php.net/manual/en/migration53.deprecated.php it says to change session_register() (use the $_SESSION superglobal instead) Does that apply to my login check k : session_register('username'); <<<<<<<<<<<<this line $_SESSION['real_name'] = $inf->username; $_SESSION["userlevel"] = $inf->userlevel; $_SESSION["crewlevel"] = $inf->crewlevel; Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 16, 2012 Share Posted March 16, 2012 Yes it will apply to every instance of session_register Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 16, 2012 Author Share Posted March 16, 2012 well i changed it to this : $_SESSION('username'); $_SESSION['real_name'] = $inf->username; $_SESSION["userlevel"] = $inf->userlevel; $_SESSION["crewlevel"] = $inf->crewlevel; but then it gives this error : Fatal error: Function name must be a string in /home/modernma/public_html/s2/logincheck.php on line 75 But if i remove line 75 so its like the following : $_SESSION['real_name'] = $inf->username; $_SESSION["userlevel"] = $inf->userlevel; $_SESSION["crewlevel"] = $inf->crewlevel; i dont get the error on the page ( inbox ) Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted March 17, 2012 Share Posted March 17, 2012 (edited) Your intentional error is $_SESSION["real_name"] The reasoning for your error, you are using: real_name already somewhere in your script, as a $var, and you can not have the same name as you are already using for a SESSION $var too. such as ['real_name'] and $real_name you need to change your $var to something else like what was mention by rulerofzu. Edited March 18, 2012 by lucky3809 Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted March 17, 2012 Share Posted March 17, 2012 (edited) nvm my post if you know the problem then help, instead of bashing someone for trying to help. Edited March 17, 2012 by lucky3809 Quote Link to comment Share on other sites More sharing options...
modernmafia Posted March 17, 2012 Author Share Posted March 17, 2012 Thank you lucky3809 and rulerofz have now figured out what it was Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 17, 2012 Share Posted March 17, 2012 You should give your back passage a break. I think it's hurting from talking to much... you know. Simple test: $this_name = 'this_name'; echo $this_name . '<br/ >'; $var['this_name'] = 'different_name'; echo $var['this_name'] . '<br /> Now, does the initial var still work?<br /> ' . $this_name . '<br />'; Output: this_name different_name Now, does the initial var still work? this_name Oh damn, did $this_name really hold value AND allow itself to run alongside $var['this_name']? Guess my system is broken :( Isnt the issue though with a set session var and then using the same name to set another var causing the conflict. As in your example $this_name = ['this_name']; $var['this_name'] is different Never experienced the issue myself but seems logical once you set something you cannot use the same to try and set something else. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted March 18, 2012 Share Posted March 18, 2012 (edited) Yes it is different with a SESSION you can not have use the same name... However he just wanted to bash before even reading what was going on because obviously he didn't care to help... @modernmafia- your welcome. What was your problem, and how did you fix it? Please shed some light on the fix, so others who has the same problem can use your input to help them also fix this error. Edited March 18, 2012 by lucky3809 Quote Link to comment Share on other sites More sharing options...
Crazy-T Posted April 2, 2012 Share Posted April 2, 2012 Why preg_replace? Just tell the user to only type numbers, if they input anything other than an number right? Then make sure it's set and is a string and do a check -> $var = preg_match("`^\d+$`", $var); 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.