phpSensei
Members-
Posts
2,838 -
Joined
-
Last visited
Never
About phpSensei
- Birthday 06/12/1992
Contact Methods
-
MSN
phpsensei@hotmail.com
-
Website URL
http://www.indesigner.ca
Profile Information
-
Gender
Not Telling
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
phpSensei's Achievements
Advanced Member (4/5)
0
Reputation
-
lol the PHPfreaks staff are really going at it!
-
Search for values within an associative array
phpSensei replied to alvin567's topic in PHP Coding Help
use the in_array function I dont know what you mean push 1 column to the right. -
this good or bad coder stuff has become pretty damn annoying. You either CODE something that works properly and can handle itself under most circumstances or it doesn't. I see alot of overkill in most object oriented programing nowadays because all the big guys do it so I have to do it too... most people don't even know why they use OOP, they believe its a whole different language. Wether its echo "Hello World" or $systemlewkrlssomecrazyasssunnecessarylineofcodeWEfkefewr=ewr->println($systehm->output(new string("Hello World")));
-
I dont get it, your taking a value grabbed from an Array ($qarray2) and then for looping it or does it contain another array?
-
php freaks sopa/pipa acknowledgement
phpSensei replied to AyKay47's topic in PHPFreaks.com Website Feedback
Speaking of people we need to ban.... lol he/she ? took my joke so seriously, Premiso, chill. And if it was your home longer, you would have a "i can haz cool title?" under your username -
php freaks sopa/pipa acknowledgement
phpSensei replied to AyKay47's topic in PHPFreaks.com Website Feedback
If anyone posts stupid crap, I will personally beat the crap out of you. This place has been my home for a while, you better not ruin it.. *erm* KingPhillip. -
You have to properly escape the string, use mysql_real_escape_string
-
Write to specific area of an INI file? HELP!
phpSensei replied to xZenjix's topic in PHP Coding Help
$sample= array( 'first' => array( 'first1' => 1, 'first2' => 2, 'first3' => 3, 'first4' => 4 ), 'second' => array( 'second1' => 1, 'second2' => 2, 'second3' => 3, 'second4' => 4 )); write_ini_file($sample, 'config.ini', true); -
Does some have any ideas? well, since you have named array keys, you must access them by their name, using integers will not work, if your array keys were the default integers, then your code would work. If i used a name i.e. echo $val['ID'] by getting the results of the array it wont echo any results... Im just curios where did it went wrong.. because $val isn't defined in your code. You Mean $keyws in your case
-
Write to specific area of an INI file? HELP!
phpSensei replied to xZenjix's topic in PHP Coding Help
From the Documentation: function write_ini_file($assoc_arr, $path, $has_sections=FALSE) { $content = ""; if ($has_sections) { foreach ($assoc_arr as $key=>$elem) { $content .= "[".$key."]\n"; foreach ($elem as $key2=>$elem2) { if(is_array($elem2)) { for($i=0;$i<count($elem2);$i++) { $content .= $key2."[] = \"".$elem2[$i]."\"\n"; } } else if($elem2=="") $content .= $key2." = \n"; else $content .= $key2." = \"".$elem2."\"\n"; } } } else { foreach ($assoc_arr as $key=>$elem) { if(is_array($elem)) { for($i=0;$i<count($elem);$i++) { $content .= $key2."[] = \"".$elem[$i]."\"\n"; } } else if($elem=="") $content .= $key2." = \n"; else $content .= $key2." = \"".$elem."\"\n"; } } if (!$handle = fopen($path, 'w')) { return false; } if (!fwrite($handle, $content)) { return false; } fclose($handle); return true; } -
copy($_FILES['Filedata']['tmp_name'], $uploadFile); I ment that line of Code. Move_uploaded_file is a safer option as it requires the file to be a valid HTTP POST upload.
-
How do I implement this countdown timer code?
phpSensei replied to Thauwa's topic in PHP Coding Help
no problem -
Is it possible to make a function that can generate a function?
phpSensei replied to hockey97's topic in Application Design
yes, a WYSIWYG editor -
if your uploading files, and im assuming you mean through HTTP POST then use move_uploaded_file()
-
How do I implement this countdown timer code?
phpSensei replied to Thauwa's topic in PHP Coding Help
http://arsenalgraphics.com/clock.php See how i implemented. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script> function countdown_clock(year, month, day, hour, minute, format) { //I chose a div as the container for the timer, but //it can be an input tag inside a form, or anything //who's displayed content can be changed through //client-side scripting. html_code = '<div id="countdown"></div>'; document.write(html_code); Today = new Date(); Todays_Year = Today.getFullYear() - 2000; Todays_Month = Today.getMonth(); <?php $date = getdate(); $second = $date["seconds"]; $minute = $date["minutes"]; $hour = $date["hours"]; $day = $date["mday"]; $month = $date["mon"]; $month_name = $date["month"]; $year = $date["year"]; ?> //Computes the time difference between the client computer and the server. Server_Date = (new Date(<?= $year - 2000 ?>, <?= $month ?>, <?= $day ?>, <?= $hour ?>, <?= $minute ?>, <?= $second ?>)).getTime(); Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime(); countdown(year, month, day, hour, minute, (Todays_Date - Server_Date), format); } function countdown(year, month, day, hour, minute, time_difference, format) { Today = new Date(); Todays_Year = Today.getFullYear() - 2000; Todays_Month = Today.getMonth(); //Convert today's date and the target date into miliseconds. Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime(); Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime(); //Find their difference, and convert that into seconds. //Taking into account the time differential between the client computer and the server. Time_Left = Math.round((Target_Date - Todays_Date + time_difference) / 1000); if(Time_Left < 0) Time_Left = 0; switch(format) { case 0: //The simplest way to display the time left. document.all.countdown.innerHTML = Time_Left + ' seconds'; break; case 1: //More datailed. days = Math.floor(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.floor(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.floor(Time_Left / 60); Time_Left %= 60; seconds = Time_Left; dps = 's'; hps = 's'; mps = 's'; sps = 's'; //ps is short for plural suffix. if(days == 1) dps =''; if(hours == 1) hps =''; if(minutes == 1) mps =''; if(seconds == 1) sps =''; document.all.countdown.innerHTML = days + ' day' + dps + ' '; document.all.countdown.innerHTML += hours + ' hour' + hps + ' '; document.all.countdown.innerHTML += minutes + ' minute' + mps + ' and '; document.all.countdown.innerHTML += seconds + ' second' + sps; break; default: document.all.countdown.innerHTML = Time_Left + ' seconds'; } //Recursive call, keeps the clock ticking. setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + time_difference + ', ' + format + ');', 1000); } </script> </head> <body> <script> countdown_clock(12, 12, 25, 00, 00, 1); </script> </body> </html> <body> <script> countdown_clock(12, 12, 25, 00, 00, 1); </script> </body>