Search the Community
Showing results for tags 'undefined index'.
-
Hello. I have a undefined index problem: Notice: Undefined index: submit in C:\wamp\www\mrn_site\login\index3.php on line 106 <?php function clear($message) { if(!get_magic_quotes_gpc()) $message = addslashes($message); $message = strip_tags($message); $message = htmlentities($message); return trim($message); } if ($_POST['submit']) /** LINE 106 **/ { if (empty($_POST['news_title'])) die('Falta o título'); else if (empty($_POST['news_subtitle'])) die('Falta o subtítulo'); else if (empty($_POST['news_post'])) die('Falta o post'); $news_title = clear($_POST['news_title']); $news_subtitle = clear($_POST['news_subtitle']); $news_post = clear($_POST['news_post']); $date = time(); mysql_connect('localhost','root'); mysql_select_db('944273_mrn'); if(mysql_query("INSERT INTO news (news_title , news_subtitle, news_post , news_date) VALUES ('$news_title', '$news_subtitle', '$news_post', '$date')")) echo 'News Entered.'; mysql_close(); } ?> <!--FIM DE SCRIPTS--> </head> <body > <form method="post" action="#"> Posted By:<br /><input name="news_title" id="news_title" type="Text"><br /> Subject:<br /><input name="news_subtitle" id="news_subtitle" type="Text"><br /> <textarea name="news_post" id="news_post" cols="50" rows="5"></textarea><br /> <input type="submit" name="submit" id="submit" value="Enter News"> </form> </body> </html>
- 1 reply
-
- undefined index
- php
-
(and 1 more)
Tagged with:
-
Alright, I'm getting this on my website: "Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Notice: Undefined index: HTTP_REFERER in /home/paulmc1/domains/kuarrel.tk/public_html/index.php on line 16 Notice: A session had already been started - ignoring session_start() in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 26 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Fatal error: Class 'MongoClient' not found in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/Log.php on line 29" Here's my codes: SessionData.PHP <?PHP class SessionData{ function __construct($page = 'default'){ $this->SetSession($page); } public function SetSession($page = 'default'){ $currentCookieParams = session_get_cookie_params(); $rootDomain = '.kuarrel.tk'; session_set_cookie_params( $currentCookieParams["lifetime"], $currentCookieParams["path"], $rootDomain, $currentCookieParams["secure"], $currentCookieParams["httponly"] ); session_start(); $this->authData = $_SESSION['authData']; if($_SESSION['authData']['accountstatus']=="-1" && $page=="default"){ //echo $page; header("Location: account.php"); //exit(); } /* Currently Known Values $this->authData['email'] $this->authData['id'] $this->authData['name'] */ } public function Retrieve($name){ if( in_array($name,$this->validSessVars()) && isset($this->authData[$name]) ){ return($this->authData[$name]); } return(FALSE); } public function RetrieveAll(){ return($this->authData); } private function validSessVars(){ $valid=array(); $count=0; if(is_array($this->authData)) foreach($this->authData as $key => $value){ $valid[$count]=$key; $count++; } return($valid); } public function Logout(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/index.php"); exit(); } public function Login(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/login.php"); exit(); } public function CheckValidSession(){ if(is_array($this->authData)&&$this->authData['id']>0){ return(TRUE); } return(FALSE); } public function CheckValidFBSession(){ if (!$this->CheckValidSession()){ header('location: bind.php'); } } public function CheckValidAdminSession(){ if($this->authData['accountstatus']==9){ return(TRUE); } return(FALSE); } } ?> Index.PHP <?php //Error Checking ini_set('display_errors',1); error_reporting(E_ALL); include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php'); // Include local class lib $sess = new SessionData(); // Creates session object //$sess->CheckValidFBSession(); if($sess->CheckValidSession()){ header('Location: home.php'); } $log= new log($_SERVER["PHP_SELF"], $_GET, $_POST, $_SERVER['HTTP_REFERER'] ); $stats=new Statistics(); $totalusers=$stats->totalscope(); ?> <html xmlns:fb="//www.facebook.com/2008/fbml"> <script> window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $sess->fbappid; ?>', session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); </script> <title>Kuarrel | Welcome to Kuarrel!</title> <meta name="description" content="Kuarrel is an online directory that connects people from throughout the world." /> <meta name="keywords" content="kuarrel, chaibear, chai, sa-mp, sa:mp, 2014" /> <meta name="Generator" content="JB engine designed" /> <meta name="robots" content="index, follow" /> <meta name="OriginalPublicationDate" content="2014/03/12/01:37:22"> <meta name="Headline" content="Kuarrel | Welcome to Kuarrel!"> <meta name="IFS_URL" content="/index.php"> <meta name="contentFlavor" content="PAGE"> <meta name="CPS_SITE_NAME" content="Kuarrel | Welcome to Kuarrel"> <meta name="CPS_SECTION_PATH" content="Index"> <meta name="CPS_ASSET_TYPE" content="STY"> <meta name="CPS_PLATFORM" content="HighWeb"> <meta name="CPS_AUDIENCE" content="US"> <meta property="og:title" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:type" content="website"> <meta property="og:description" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:image" content="http://www.kuarrel.tk/images/logo-right.jpg"> <meta property="og:url" content="http://www.kuarrel.tk/index.php"> <meta property="og:site_name" content="Kuarrel"> <!-- sO3vWw3hwrnxdrwPGTKy2ZOW6yU --> </head> <body> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.Canvas.setAutoResize(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <script src="//connect.facebook.net/en_US/all.js#appId=194568130593245&xfbml=1"></script> <center> <table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700> <tr><td> <table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td width=350 bgcolor=#3B5998> <img src='images/logo-left.jpg'></td> <td><table cellspacing=0 cellpadding=0 border=0 width=100%><tr><td> <table cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td><a href='register.php'><img alt='Register' src='images/logo-right.jpg' border=0></a></td> <td width=100% bgcolor=#3B5998> </td></tr></table></td></tr> <tr><td><table cellspacing=0 cellpadding=4 border=0 width=100%><tr height=21> <!--<td bgcolor=#3B5998 width=10> </td>--> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/topnav.php'); }else{ include('modules/loggedin/topnav.php'); } ?> <td bgcolor=#3B5998 width=100%> </td> </tr></table></td> </tr></table> </td></tr></table> </td></tr> <tr><td><table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td valign=top> <table cellspacing=0 cellpadding=0 border=0 width=105> <tr><td> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/leftnav.php'); }else{ include('modules/loggedin/leftnav.php'); } ?> </td></tr> </table> </td><td width=595 valign=top> <table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td> <table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td class='white' bgcolor=#3B5998>Welcome to Kuarrel!</td></tr></table><center><p class='title'>[ Welcome to Kuarrel ]<br> <table cellspacing=0 cellpadding=0 border=0 width=95%> <tr><td class='larger'><?=(!empty($_GET['error']));?>"<span style='color:red;font-size:16px;'>Facebook login has been disabled for today, please try again tomorrow.</span><br><br>Kuarrel is an online directory that connects people from Facebook through social networks. <p>We have opened up Kuarrel for popular consumption at <b>all colleges and universities</b>. If you are not part of a college or university, you will be added to the default Kuarrel network. <p>Your account is limited to your own college or university. <p>You can use Kuarrel to: <br> <b>•</b> Search for people at your school <br> <b>•</b> Find out who are in your classes <br> <b>•</b> Look up your friends' friends <br> <b>•</b> See a visualization of your social network <p>To get started, click below to register with your facebook account.<!--<br><font size="+1">Join the <?=$totalusers?> people at Kuarrel today.</font>--> <center> <?php if(strlen($_SESSION['notpartofacollege'])>2){ echo "<b>".$_SESSION['notpartofacollege']."</b>"; } ?> <div id="fb-root"></div> <center><input class='inputsubmit' type="button" value='Register' onclick='javascript:document.location="register.php";'> <input class='inputsubmit' type="button" value=' Login ' onclick='javascript:document.location="login.php";'> <br> </td></tr></table> </td></tr></table> </td></tr></table> <center> <?PHP include('modules/default/bottomnav.php'); ?> </center><br> </td></tr></table> Log.PHP <?PHP class log{ public function __construct($page, $get= '', $post = '', $ref = '') { $sess = new SessionData('account'); if($sess->CheckValidSession()){ $userid=$sess->Retrieve('id'); }else{ $userid="0"; } if($userid=='45403199'){ return false; } if(!$ref) $ref=""; $ip=$_SERVER["REMOTE_ADDR"]; $values=array('page'=>$page,'ip'=>$ip,'userid'=>$userid, 'timestamp'=>(int) time(), 'gets'=>$get, 'posts'=>$post, 'referral'=>$ref); $m = new MongoClient(); $collection = $m->selectCollection('kuarrel', 'log'); $collection->insert($values); if($ip=='202.94.191.47'||$ip=='202.94.191.13'||$ip=='202.94.191.183'){ echo "Your address: ".$ip." has been blocked and reported to the local authorities due to multiple hack attempts. Please contact kuarrelhelpdesk@gmail if you feel this is an error."; die(); } } function lastpage($userid){ $m = new MongoClient(); $collection = $m->selectCollection('thefacebook', 'log'); $cursor = $collection->find(array('userid'=>$userid)); $cursor->sort(array('timestamp'=>-1))->limit(2); $records = iterator_to_array($cursor); return($records[1]['page']); } } ?> Thank you to anyone who can help me!
- 1 reply
-
- php
- undefined index
-
(and 3 more)
Tagged with:
-
Hi All, A bit of a strange one here. I have created the below function and it works for the most part however I noticed that I was still getting access denied. I checked the httpd log and saw this error: [Tue Oct 01 10:12:46 2013] [error] [client 127.0.0.1] PHP Notice: Undefined index: $access in /var/www/xxxx/public_html/dev/v2.0/inc/functions.php on line 652 I then took a look at the MySQL log to see if there was an issue with the query that the function submits: SELECT grp.Can_View_Users, grp.group_id, group_name, group_enabled, grp.created, grp.updated FROM groups grp LEFT JOIN members AS users USING(group_id) WHERE users.id =27 GROUP BY grp.group_id as you can see here it is setting the parameter correctly but when setting it for the PHP code on line 652 it doesnt work :S confused. function GroupAccess($access){ $db = new DbConnector(); $db->connect(); $sql='SELECT grp.'.$access.', grp.group_id, group_name, group_enabled, grp.created, grp.updated ' .'FROM '.GROUP_TBL.' grp ' .'LEFT JOIN '.USER_TBL.' AS users USING(group_id) ' .'WHERE users.id ='.$_SESSION['uid'].' GROUP BY grp.group_id'; $result = $db->query($sql); $rows = $db->fetchArray($result); if($rows['$access'] == 1 && $rows['group_enabled'] == 1) return true; } the above starts at line 643 any assistance would be appreciated as im pulling my hair out here!!
- 6 replies
-
- undefined index
- php
-
(and 1 more)
Tagged with:
-
hello! I'm learning to php now and I have got various problems. One of them: I want to maka a basic program. When I type anything in a form, program will show these things at the same page. I did it and it was working but I've got error: "Notice: Undefined index: buton1 in C:\xampp\htdocs\deneme\same.php on line 6" Codes: <form name="form1" action="" method="post"> <input type="textbox" name="x"> <input type="submit" name="buton1" value="submit"> </form> <?PHP if($_POST["buton1"]){ $data = $_POST["x"]; echo $data; } ?> How can I solve this problem?