kohoved Posted April 1, 2010 Share Posted April 1, 2010 hello phpfreaks i have this script that i cant get working, im a really noob at php, but i tried. now i have come to ask for you help. i get these errors Notice: Undefined index: usNick in /www/zxq.net/p/a/i/xxxxxxx/htdocs/config.php on line 16 Notice: Undefined index: usNick in /www/zxq.net/p/a/i/xxxxxxx/htdocs/config.php on line 39 Notice: A session had already been started - ignoring session_start() in /www/zxq.net/p/a/i/xxxxxxx/htdocs/data.php on line 2 Notice: Undefined index: usNick in /www/zxq.net/p/a/i/xxxxxxx/htdocs/config.php on line 16 Notice: Undefined index: usNick in /www/zxq.net/p/a/i/xxxxxxx/htdocs/config.php on line 39 Notice: Undefined index: r in /www/zxq.net/p/a/i/xxxxxxx/htdocs/data.php on line 11 Notice: Undefined index: ucNick in /www/zxq.net/p/a/i/xxxxxxx/htdocs/data.php on line 15 of what i can see its something about usNick but i cant find out what? config.php <?php /********************************************************************************************************************************************** SecureBux Version 2.00 This Script has been created and coded by Gabrola and sold by Hamza. If you find any bugs in the script report at ygabrola@gmail.com or contact Hamza. Copywrite Gabrola 2008; ************************************************************************************************************************************************/ $dhost = "localhost"; //usually localhost, or ip $dusername = "xxxxxxxxxx"; // database user $dpassword = "xxxxxxxxx"; // database pass $ddatabase = "xxxxxxxxx"; // database name $con = mysql_connect($dhost, $dusername, $dpassword) or die("Cannot Connect"); mysql_select_db($ddatabase, $con); if($_COOKIE["usNick"] and $_COOKIE["usPass"]) { $q = mysql_query("SELECT * FROM tb_users WHERE username='{$_COOKIE['usNick']}' AND password='{$_COOKIE['usPass']}'") or die(mysql_error()); if(mysql_num_rows($q) == 0) { $_COOKIE['usNick'] = false; $_COOKIE['usPass'] = false; } else { $loggedin = 1; $r = mysql_fetch_array($q); } } $da = date("j"); $queryxx = "DELETE FROM ad_clicks WHERE day!='$da'"; mysql_query($queryxx); $q2 = mysql_query("SELECT * FROM settings"); while($r2=mysql_fetch_array($q2)) { $set[$r2["setname"]]=$r2["setvalue"]; } mysql_query("UPDATE settings SET setvalue='0', set_day='{$da}' WHERE set_day!='{$da}' AND set_day>'0'") or die(mysql_error()); $user=$_COOKIE['usNick']; ?> data.php <?php session_start(); /********************************************************************************************************************************************** SecureBux Version 2.00 This Script has been created and coded by Gabrola and sold by Hamza. If you find any bugs in the script report at ygabrola@gmail.com or contact Hamza. Copywrite Gabrola 2008; ************************************************************************************************************************************************/ include "config.php"; global $loggedin; if($_GET['r']) { $_SESSION['r'] = $_GET['r']; } $user = $_COOKIE['ucNick']; anyone can see what to change? thank you for your time Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/ Share on other sites More sharing options...
Porl123 Posted April 1, 2010 Share Posted April 1, 2010 if(isset($_GET['r'])) { $_SESSION['r'] = $_GET['r']; } When you're asking whether a GET, POST or SESSION variable is set, use the isset() function. Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/#findComment-1035309 Share on other sites More sharing options...
kohoved Posted April 1, 2010 Author Share Posted April 1, 2010 if(isset($_GET['r'])) { $_SESSION['r'] = $_GET['r']; } When you're asking whether a GET, POST or SESSION variable is set, use the isset() function. okay thank you but anyone got something else? this didn't solve my problem. Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/#findComment-1035317 Share on other sites More sharing options...
premiso Posted April 1, 2010 Share Posted April 1, 2010 Use ISSET on the if ($_COOKIE) like shown for the GET variables. isset tests if the variables isset, doing this will not throw the undefined index notice. So yea, take the logic that was given to you and apply it to the rest of the script on COOKIES / GET / POST variables that are coming in which may or may not exist. Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/#findComment-1035342 Share on other sites More sharing options...
kohoved Posted April 1, 2010 Author Share Posted April 1, 2010 Use ISSET on the if ($_COOKIE) like shown for the GET variables. isset tests if the variables isset, doing this will not throw the undefined index notice. So yea, take the logic that was given to you and apply it to the rest of the script on COOKIES / GET / POST variables that are coming in which may or may not exist. okay fixed some of it, but i still got this error. Notice: A session had already been started - ignoring session_start() in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 2 Notice: Undefined index: r in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 11 Notice: Undefined index: ucNick in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 15 1 <?php 2 session_start(); /********************************************************************************************************************************************** ************************************************************************************************************************************************/ 11 include "config.php"; 12 global $loggedin; 13 if($_GET['r']) { $_SESSION['r'] = $_GET['r']; } $user = $_COOKIE['ucNick']; hope you can help me again Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/#findComment-1035524 Share on other sites More sharing options...
jcbones Posted April 1, 2010 Share Posted April 1, 2010 okay fixed some of it, but i still got this error. Notice: A session had already been started - ignoring session_start() in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 2 Notice: Undefined index: r in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 11 Notice: Undefined index: ucNick in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 15 Notice: A session had already been started - ignoring session_start() in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 2 = There is already a call to session_start(), this can be another script, or the server automatically starts the session. Notice: Undefined index: r in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 11 = The key 'r' doesn't exist in the $_GET array. Notice: Undefined index: ucNick in /www/zxq.net/p/a/i/paidtoclick/htdocs/data.php on line 15 = The key 'ucNick' doesn't exist in the $_COOKIE array. Quote Link to comment https://forums.phpfreaks.com/topic/197238-undifined-index/#findComment-1035560 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.