
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
I wouldn't could have said it better myself...
-
imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement [code=php:0] $mapid = "map".$numb.".png"; if (imagepng($im, $mapid)) { // should have been written to file. } else { // not working } [/code] if this is not working, then please post the full code, so we can have an in-depth view.
-
I am a very poor programmer, that even $50 bucks is way beyond my salary, anything cheap like free?
-
A few days ago, I was on this website that showed me my ISP, ofcourse as curious as I am, I went directly to php.net where I found gethostbyaddr(); providing me something but not what I wanted, so if someone knows how I can accomplish this, then please feel free to enlight me!
-
How to delay an email response if no user action?
ignace replied to uberdragon's topic in PHP Coding Help
php has a function that executes certain commands whenever the clients disconnect, don't know if this is it, but maybe worth checking: http://php.belnet.be/manual/nl/function.connection-aborted.php -
hostfreak the problem surely doesn't rely in the fact he used single quotes in his query
-
sure, [code=php:0] $query = "SELECT * FROM ...."; //COmplete this $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ if (!@$row['pd_thumbnail']) { // display noimage.jpg } else { echo "<img src='".$row["pd_thumbnail"]."' />"; } } [/code]
-
xec now your obsetly making it difficult, you need the where clausule otherwise you can not check where something is equal/duplicate [code] $query = "SELECT `username`, COUNT(`username`) AS `DuplicateEntries` FROM `users` WHERE `username`='$username'";// will possibly not work... therefore rather use: $Query = mysql_query("SELECT `username` FROM `users` WHERE `username`='$username'"); $Rows = count(mysql_fetch_array($Query)); [/code]
-
very well noticed... [code] $string = include_once('test.php');// gives you zero, nada, .. //but $string = file_get_contents('test.php');// gives you it all.... [/code] go forth and code my padawan... :d
-
how to get the current URL of the current page?
ignace replied to bilis_money's topic in PHP Coding Help
This depends if you wish to use it into an include I'd rather use [code] echo $_SERVER['SCRIPT_FILENAME'];// returns absolute path c:\path\to\script\filename.php [/code] -
I normally set this into the database that the username has to be an unique value Also silentwf I do not recomment using: [code] <?php if !isset($checkUsername[... // Instead use if (!in_array($username, $checkUsername)) { ... ?> [/code]
-
ftp what do you mean? when it is already uploaded or still has to be uploaded? When it is already uploaded you will need unlink(); to delete the file.
-
If you wanna start creating your own cms system I suggest you first find the best information you can get on cms system's and use: http://www.mamboserver.com as a startingpoint, dig into the code, try to translate what you see and try to understand it! I did it a few times, it helped me at a few points also http://www.getvanilla.com is another nice startingpoint this is a forum however...
-
I see your using $error_message, to make sure you can display these error's above your form, and still be able to process your script above the html-head information I use one extra variable, ofcourse I am giving you the very basic here.. [code] <?php $PreCheckComplete=0; if (@$_POST) { $errorMessage = ''; $userName = $_POST['txtUserName']; $password = $_POST['txtPassword']; // first, make sure the username & password are not empty if ($userName == '') { $errorMessage .= "• You must enter your username<br />"; } // you can also check for string length if (strlen($userName) < 6 ) { ... if (strip_tags($userName) != $userName) { $errorMessage .= "• You are not allowed to use html in your username.<br />"; } if ($password == '') { $errorMessage .= "• You must enter the password.<br />"; } if (strip_tags($password) != $password) { $errorMessage .= "• You are not allowed to use html in your password.<br />"; } if (!$errorMessage) {// no errors found.. $PreCheckComplete = 1;// Set flag $password = sha1($password); // don't know if sha1 is already implemented.. // check the database and see if the username and password combo do match $sql = "SELECT user_id" . "\n FROM tbl_user" . "\n WHERE user_name = '$userName'" . "\n AND user_password = '$password'" ; $result = dbQuery($sql); } } ?> <!-- below the headers --> <!-- above the form --> <?php if ($PreCheckComplete==0) {//Display the form if (@$errorMessage) { echo $errorMessage; } ?> <form action="" method="post" .... <?php } else { // Display success echo 'jipii'; } ?> [/code]
-
Well because my previous post was way to long and had way to much options, I filtered it a bit and came up with this, It still need some altering though.. but it should work [code] <?php function Upload($File, $UploadFolder='', $NewFilename='', $UploadExtFilter='', $UploadMaxSize='') { if (substr($UploadFolder, -1) != '/') { $UploadFolder .= '/'; } if (!is_dir($UploadFolder)) { // Error message comes here..., or try to create the folder } if (!is_writable($UploadFolder)) { // Error message comes here..., or make it writable } if (is_uploaded_file($File['tmp_name'])) { $Filesize = $File['size']; $Filename = $File['name']; if (!preg_match('/\\.('.$UploadExtFilter.')$/i', $Filename)) { if ($Filesize > $UploadMaxSize) { // file to big.. } if ($NewFilename) { $Filename = $NewFilename; } if (file_exists($UploadFolder . $Filename)) { // Oeps already exists... } if (move_uploaded_file($File['tmp_name'], $UploadFolder . $Filename)) { // Success return true; } else { // No success return false; } } else { // Extensions not allowed } } } if ($_POST['submit']=='Upload') { if (Upload($_FILES['uploadIt'], '/upload/', 'my_file.txt', 'bat|com|php', 8000)) { echo 'jipii'; } } ?> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="uploadIt"> <input type="submit" name="submit" value="Upload"> </form> [/code]
-
ron, don't you mean INSERT? How can you update if the page does not already exists? Thus something like: [code] $Userid = $_SESSION['userid']; // or something.. $Url = eval("http://" . $_SERVER['HTTP_POST'] . $_SERVER['PHP_SELF']);// Does php_self also includes queries? if not add . $_SERVER['QUERY_STRING']; $Sql = "INSERT INTO `favorites` (`Url`, `User_id`) VALUES ('$Url', '$Userid');"; [/code]
-
First of all, your not gonna start comparing me with Bill Gates ok? are you talking about one single mp3 in three parts being uploaded or a dynamic mixing panel on server-side that can be controlled by users?
-
What you are looking for is an IDE (Integrated Development Environment) an Java IDE can be found at: http://www.eclipse.org/ , ofcourse you don't wanna start programming Java, so you will need the php module, which can be found here: http://phpeclipse.sourceforge.net/ regards, Ignace
-
the database is your friend, just create a datbase named favorites or something and then when a user clicks the 'Add to favorites' it inserts the current page(path), his userid(need this to load it on his profile/homepage page) to the database, and on his profile page you just start rollin' it out!
-
why the hell would you do that? saving bandwith? php can process up to 16MB of upload (is not always the occasion, so check your upload settings first), if the size matters (mostly it does) :p I suggest you use winrar or any other zipping archive, I mostly use ACE or UHARC, the last one will probably resize your 3264kb big mp3 file to 42kb..
-
I should use the user id instead of the username, username is not really a unique value, unless you make sure that when a user registers, it can not register a duplicate username, however look out for phishing then...
-
[code] include_once('DB.php');// This will not be in your directory, but it will be in php's [/code] for the manual I would refer you to: http://pear.php.net/
-
Easy Problem but cant work it out - please help :/
ignace replied to idweb's topic in PHP Coding Help
I am confused.., why do you twice check if the variable is not empty? [code] if (!empty(.. if (!empty(.. // Just put it together, // Also I don't think that your arrays are gonna be parsed this way, well it didn't work for me... // So therefore its better you make sure they aren't included in the quotes // Also using your $query as an array is not a really good idea, therefore you might wanna use $select = "SELECT ..."; $from = "FROM ...";// Something in this order and later on just glue it! $sql = $select . $from . $where . $query .. $query = "cpt_listings.state = '" . $_GET[search_area] . "' AND cpt_listings.city = '" . $_GET[search_area] . "' "; // If no results turn up by this one, try OR instead of AND // Hope this helps.. [/code] But hey that are just my thoughts.. whatever floats your boat :d -
Well it is a notice... Not that this is the best way to resolve this problem but it works.. :d $cd1 = isset(@$_REQUEST['cd1']) ? $_REQUEST['cd1'] : ''; ... however i always just use: $cd1 = @$_REQUEST['cd1'] ? $_REQUEST['cd1'] : ''; but we are using a dynamic language, and $cd1, $cd2, .. is a real waste of time so I would suggest you use: if (@$_REQUEST) { while (false !== (list($Key, $Value) = each($_REQUEST))) { ${$Key} = $Value; } } and you would still have all your desired variables ($cd1, $cd2, ..)
-
effort? I created that word!! And I already readed that topic, check my post!! However your answer is not really on-topic, unless you mean all functions are case insensitive is the best answer you can come up with! I wanna know how I can make it case sensitive! And then why I want to redeclare them? because I use them in OO. And when I want a certain count I don't gonna declare my function as: giveMeTheTotalNumber();