I am getting error in wamp server.
Posted by: shekargoud (117.195.233.---)
Date: January 15, 2010 07:24AM

when i loged in my admin area. I am getting error in my local host wampserver . But in my rented host didn't displaying any error. any one solve my problem.

this is my error showing:

"; $return = $return . $cfg['copyright']; return $return; } function do_auth($lvl) { global $session_username,$cfg; if ($lvl == "1"winking smiley { if ($session_username == ""winking smiley { die(login_code()); } if ($session_username != $cfg['admin_username']) { die(login_code()); } } }


thanking you in advance.

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: January 15, 2010 06:41PM

Looks like your php code is not being parsed?

By default wamp will only parses php code within files that end in .php
You need to be placing your website files in C:\wamp\www
To run your php scripts you MUST go to [localhost]

If you use tags such as <? ?> or <?= ?> then by default wamp has these disabled. To enable short tags left click the wamp tray icon and select PHP > PHP Settings > short open tag



Edited 1 time(s). Last edit at 01/15/2010 06:42PM by c2dan.

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: yfastud (Moderator)
Date: January 15, 2010 10:33PM


Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: shekargoud (117.195.231.---)
Date: January 18, 2010 09:09AM

Thank U c2dan .

working fine but another error displaying the error showing:


Notice: Undefined index: action in C:\wamp\www\mandal\admin\index.php on line 31

Notice: Undefined index: username in C:\wamp\www\mandal\admin\index.php on line 32


in my index.php lines

31. $action = addslashes($_GET['action']);
32. $session_username = addslashes($_SESSION['username']);


what I do.

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: sikas (---.233.65.182.tedata.net)
Date: January 18, 2010 04:30PM

hey shekargoud,

your errors:

$action = addslashes($_GET['action']);
and
$session_username = addslashes($_SESSION['username']);

indicates that both action and username values are not known ... and here in your code, the action and username are submitted to this page through a form in the page that calls this one, if this page is your index.php page which loads when you go to your website (examplesite.com/index.php) then you will need to add a couple of if cases surrounding these two line making your code look like this:

if(isset($_GET['action'])
$action = addslashes($_GET['action']);
//else enable this if you will set a value in the $action variable ...
//$action = some value;
if(isset($_GET['username'])
$session_username = addslashes($_SESSION['username']);
//else enable this if you will set a value in the $session_username variable ...
//$session_username = some value;

hope this solves your error ...

feel free to contact me ...

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: shekargoud (117.195.227.---)
Date: January 18, 2010 07:11PM

sikas thank u for respond here.

my code working in rented server fine. but in localhost showing that error.

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: sikas (---.62.114.254.2.nile-online.net)
Date: January 18, 2010 08:55PM

Well, to disable this error on WAMP just do the following:

left click on WAMP icon -> PHP -> PHP Settings -> display errors (disable)

but frankly, I don`t suggest disabling the error, but solving the errors using the solution I provided in the earlier reply ... and if you need help in modifying your codes, you can contact me at:

sikas_lancer[at]hotmail[dot]com

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: yfastud (Moderator)
Date: January 18, 2010 11:46PM

Open file php.ini through wamp tray icon and follow this instruction

Find
error_reporting = E_ALL

Replace w/
error_reporting = E_ALL & ~E_NOTICE

Then save file and restart wamp

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: stacson (---.dynamic.dsl.as9105.com)
Date: April 01, 2010 04:25PM

Hi there,

I'm getting a similar error. I'm trying to set up my login page so it knows who is a user (member) and who is a superuser (administrator) but I am having problems with my code, and keep getting the following error:

Notice: Undefined index: admin in C:\wamp\www\set08101cw2\scripts\login.php on line 16.

My code is as follows:

<?php
session_start();
include("dbconnect.php"winking smiley;
$numrows=0;
$pword=trim($_POST['pword']);
$email=trim($_POST['email']);
$query="select email,fname from members where (password=password($pword) && email='$email')";
$link = @ mysql_query($query);
if (!$link) {
$result="0";
die($result);
}
$numrows=mysql_num_rows($link);
if ($numrows>0){
$row = mysql_fetch_array($link, MYSQL_ASSOC);
if($row['admin']==1){
$_SESSION['superuser']=$row['fname'];
} else {
$_SESSION['user']=$row['fname'];
$_SESSION['email']=$row['email'];
}
echo '9';
} else {
echo "1";
}
?>

I'm currently getting the above error message and it is also showing the first echo number (9) under it. I am very new to PHP - are you able to point me in the right direction, as this is driving my crazy!!

Cheers

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: April 01, 2010 07:14PM

This is not a forum to help you with your code, but you're getting the error because in your sql query here
$query="select email,fname from members where (password=password($pword) && email='$email')";
You're only grabbing the email, and fname columns from your members table.

However on this line
if($row['admin']==1){
You're using the column named admin, which you're not selecting in your original query. You'll want to amend your query so it also returns the admin column too.

You may want to find some tutorials on using mysql with PHP.

Options: ReplyQuote
Re: I am getting error in wamp server.
Posted by: stacson (---.dynamic.dsl.as9105.com)
Date: April 01, 2010 07:41PM

Ah sorry didn't realise it wasn't a code forum. Thanks heaps for the tip though I will give that a try.

Options: ReplyQuote


Sorry, only registered users may post in this forum.