Oilfan Posted April 4, 2011 Share Posted April 4, 2011 Hello! I have a strange error on my PHP script and i dont how to fix it. If someone can help me, please help me then! Here is my error: logout(); } else { $iq = mysql_query("SELECT * FROM users WHERE username='{$signin_username}' AND password='{$signin_password}' AND suspended='0' LIMIT 1;"); $ir = mysql_fetch_array($iq); $_SESSION['me'] = $ir; } } } } else { die("The configuration did not recieve appropriate variables to accept your request."); } if ($set['next_clearup'] < time ()) { $next_clearup = time () + 60 * 60 * 24; mysql_query ('' . 'UPDATE settings SET set_value=\'' . $next_clearup . '\' WHERE set_name=\'next_clearup\' LIMIT 1;'); mysql_query ('UPDATE users SET ads_clicked=\'\' WHERE ads_clicked!=\'\''); } } ?> Warning: include(THDIRindex.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\Upload\index.php on line 16 Warning: include() [function.include]: Failed opening 'THDIRindex.php' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\Upload\index.php on line 16 And here is the PHP file the error is in: <?php session_start(); include_once('lib/lib.php'); include_once('lib/configuration.php'); $ddir = THDIR.$do->get_file_url(); include($ddir); if(file_exists(HEADER)) { include_once(HEADER); } if($contents) { print $contents; } if(file_exists(FOOTER)) { include_once(FOOTER); } ?> Help ASAP if you can! Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/ Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 It seems like THDIR isn't a known constant, so PHP is interpreting it as a string... are you sure you've define()d it? ie: define("THDIR", "includedir/"); Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196694 Share on other sites More sharing options...
Oilfan Posted April 4, 2011 Author Share Posted April 4, 2011 It seems like THDIR isn't a known constant... are you sure you've define()d it? ie: define("THDIR", "includedir/"); I'm sorry but i dont really understand. How do i define that? I mean, where should i put this: define("THDIR", "includedir/"); and what i should put in that "includedir/" ? Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196697 Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 I was assuming you knew what constants were since you used one. Let's start over. What is THDIR supposed to be? Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196706 Share on other sites More sharing options...
Oilfan Posted April 4, 2011 Author Share Posted April 4, 2011 I was assuming you knew what constants were since you used one. Let's start over. What is THDIR supposed to be? Well, i think it is the index.php. And my friend gave me his website script because he dont use it anymore and i tried to use it but got this error. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196707 Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 Ok, when you call $do->get_file_url() it returns 'index.php'. I'm guessing you didn't write this code, so do you know where the 'index.php' file is that it's trying to include? Constants are like strings, but you can't change them and they don't use a $ before the name. You define them with the define function like this: define("CONSTANT_NAME", "CONSTANT_VALUE"); Constants can be used to specify where all the files you include are, so you could define THDIR to the folder where index.php is (like "./includes/"). Then you just concatenate THDIR to any of the filenames you're including. If you move all your includes to somewhere else you just change the definition of THDIR and everything works like before. Sorry if this is confusing... Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196716 Share on other sites More sharing options...
Oilfan Posted April 4, 2011 Author Share Posted April 4, 2011 The error is in the index.php file itself. Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196725 Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 Oh, right. Well.. you might want to get your friend to help you, because that doesn't make any sense. We'd probably need a lot more code to understand what this file's trying to do. You could try deleting those two lines, but I'm sure it's there for a reason... THDIR is supposed to be something, but it's not. Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196731 Share on other sites More sharing options...
Oilfan Posted April 4, 2011 Author Share Posted April 4, 2011 This might be useless but is the index.php file trying to include itself by itself? Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196735 Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 Well, I'm guessing THDIR is supposed to be some directory where there's another index.php. But for some reason THDIR isn't defined, so it's trying to include "THDIRindex.php". Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196738 Share on other sites More sharing options...
Oilfan Posted April 4, 2011 Author Share Posted April 4, 2011 I use the php script at my own PC with xampp and i connect to that site with this address http://localhost/upload./index.php. Could that cause the problem? I did a search with the windows search thing and i found other index.php files in other folders, like admin, forum and themes. Quote Link to comment https://forums.phpfreaks.com/topic/232664-unknown-error-im-new-to-php/#findComment-1196751 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.