hello, this the code of an advertising blog i have : // Session Face $sid = md5(time()).md5("LeQuangDung"); // Redirect Function function redirect($location) { // Redirect for IIS exit("<html><head><meta http-equiv=\"refresh\" content=\"0; url=". $location . "\"></head><body></body></html>"); } function CheckEmail($Email = "") { if (ereg("[[:alnum:]]+@[[:alnum:]]+\.[[:alnum:]]+", $Email)) { return true; } else { return false; } } function Duration($timeposted, $timenow) { $timeleft = $timenow - $timeposted; $days = floor($timeleft / 86400); $hours = floor(($timeleft - $days * 86400) / 3600); $mins = floor(($timeleft - $days * 86400 - $hours * 3600) / 60); $secs = floor($timeleft - $days * 86400 - $hours * 3600 - $mins * 60); return $days; } function CurrencyFormat1($number) { return number_format($number,2); /* if ($number<0) { $number = -$number; $num1 = "-"; } $num1 .= (int)(($number*100)/100); $num2 = ($number*100)%100; if ($num2<10) $num2 = "0".$num2; return (string)$num1.".".(string)$num2;*/ } function CurrencyFormat($part1 = "", $part2 = "") { $num1 = ($part1 == "")?0:(int)$part1; $num2 = ($part2 == "")?0:(int)$part2; if ($num2<10) $num2 = "0".$num2; return (string)$num1.".".(string)$num2; } function DatetimeFormat($timeStamp) { $date = getdate($timeStamp);$tmpd = getdate(mktime(0,0,0,$m,1,$year)); return ($date["mon"]."/".$date["mday"]."/".$date["year"]); // return date("F j, Y, g:i a",$timeStamp); } function DatetimeFullFormat($timeStamp) { $date = getdate($timeStamp); $str = $date["weekday"].", ".$date["month"]." ".$date["mday"].", ".$date["year"]; return $str;//strtoupper($str); } function Gettime($hour, $mi, $se, $mon, $day, $year, $AMPM) { if (strtolower($AMPM) == "pm" && $hour<13) $hour = 12+$hour; if (strtolower($AMPM) == "am" && $hour>12) $hour = $hour - 12; return mktime($hour, $mi, $se, $mon, $day, $year); } function generatePassword ($length = 8) { // start with a blank password $password = ""; // define possible characters $possible = "0123456789bcdfghjkmnpqrstvwxyz"; // set up a counter $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } } // done! return $password; } ?> PHP: the problem is, when i want to add a banner ad and everything works good until this error appeared : Warning: getdate() expects parameter 1 to be long, string given in /home/blogadve/public_html/adblog/common.php on line 70 so, can anyone tell me whats wrong with my code?
Try: $date = getdate((int) $timeStamp); PHP: If that doesn't work, it would be helpful to see what's inside the variable.. Do echo $timeStamp; PHP:
where do i add that?? In the same place as i put : $date = getdate((int) $timeStamp); and do i replace it??
ok i added it then now on the page it says : Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/blogadve/public_html/adblog/common.php on line 71
You ofcouse need a ; at the end mate.. Did you not copy my original line? If you want to edit PHP yourself, you should at least learn the basics.
Show me the value ofcourse. And if it's not outputting anything, it means you are not passing along the correct input..
I didn't ask for that, I asked for the output of the echo statement. Anyway, I think it would be best if you just hired someone..
Apparently so, since if someone doesn't understand the most basic function of PHP being 'echo' , then they don't really know any PHP and could simply be a "cut-n-paste" coder. Besides this wouldn't work anyways : function DatetimeFormat($timeStamp) { echo $timestamp; $date = getdate((int) $timeStamp); return ($date["mon"]."/".$date["mday"]."/".$date["year"]); // return date("F j, Y, g:i a",$timeStamp); } Code (markup): Because variables and function names are case sensitive, and as such $timestamp is not the same as $timeStamp being passed. Short of Class Constructors, its best pratice to keep all variables and function names in lowercase.
QBasic Javascript Visual Basic .bat ch files. Hell even Pascal Or almost any barely human readable procedural language for that matter I've seen "Script Kiddies" (as we used to call em) do so in those languages years ago.
Take a look at the function strtotime(), it does a great job of turning random strings into the PHP time format!
It doesn't convert to PHP time format, converts it to Unix time format. Also strtotime() has a bad memory leak if you're using PHP 5.2.8
Hmm, not using functions because there's a memory leak in a minor version of PHP? That's the user's problem, not the developer's. I guess you could code around it, but why bother? Anyway, how do you know this? Is there some kind of list for these types of things?