-
Posts
187 -
Joined
-
Last visited
Everything posted by Lukeidiot
-
I have completely redone everything! Please re test!
-
Still havent figured her out.
-
$timeFirst = strtotime('2011-05-12 18:20:20'); $timeSecond = strtotime('2011-05-13 18:20:20'); $differenceInSeconds = $timeSecond - $timeFirst; You arent calculating the time between 1970 and now, you are calculating the seconds that have passed between those two dates. So if you get 60 seconds, then you can convert that to 1 minute or $seconds / 60; strtotime() just converts it to time();
-
$now = time(); This is the number of seconds since 1970. $past_date = strtotime(date('m-y-d')); $past_date - $now = $sec_inbetween; (Something like that)
-
The supporting sentence is behind it. I said: "This page is logging in to Tumblr via cURL. The "custom_theme" JSON is the themes current HTML." What I meant was I needed to decode the JSON, as that is what holds the value of what needs to be submitted via (POST?). That way you could store a backup of their current HTML template. Also because you may need to submit in the form of JSON.
-
You must of misread. Instead of spamming 10+ forums for post count, you could of taken the time to read my post more clearly. I am trying to basically submit post via cURL to edit peoples blog html.
-
Hello fine peoples of phpfreaks. I have a site called Themelr.com. It is basically a Tumblr Theme Generator for Tumblr.com My goal is to automatically update a persons Tumblr blog with the HTML they generate from our site. However it seems to be a little tricky. Here is an example: http://themelr.com/edit/ This page is logging in to Tumblr via cURL. The "custom_theme" JSON is the themes current HTML. How do I decode/extract that and submit to Tumblr a newly provided HTML? tl;dr I am trying to $_POST to tumblr new HTML for their blog. Any ideas?
-
Hello fine peoples of phpfreaks. I have a site called Themelr.com. It is basically a Tumblr Theme Generator for Tumblr.com My goal is to automatically update a persons Tumblr blog with the HTML they generate from our site. However it seems to be a little tricky. Here is an example: http://themelr.com/edit/ This page is logging in to Tumblr via cURL. The "custom_theme" JSON is the themes current HTML. How do I decode/extract that and submit to Tumblr a newly provided HTML? tl;dr I am trying to $_POST to tumblr new HTML for their blog. Any ideas?
-
Nevermind. I got it now.
-
Hey guys, I have a competitor and I believe he's using something from my site. However he has "encrypted" some of his code. Here it is: <script language="JavaScript" type="text/javascript"> // shhh var i,y,x="20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d226373732f6e6f726d616c697a652e637373223e20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d226373732f6d61696e2e637373223e20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d22687474703a2f2f636f64652e6a71756572792e636f6d2f75692f312e31302e312f7468656d65732f626173652f6a71756572792d75692e637373223e20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d226373732f6a71756572792e6d696e69636f6c6f72732e637373223e20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d226373732f6a71756572792e73656c656374426f7849742e637373223e20202020202020203c6c696e6b2072656c3d227374796c6573686565742220687265663d226373732f6170702e637373223e20202020202020203c736372697074207372633d226a732f76656e646f722f6d6f6465726e697a722d322e362e322e6d696e2e6a73223e3c2f7363726970743e";y='';for(i=0;i<x.length;i+=2){y+=unescape('%'+x.substr(i,2));}document.write(y); </script> Can anyone unscramble this secret of a message? Thanks for the help guys.
-
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
Yeah none the examples are working. Does anyone know how? -
You don't use for each to execute the query. while($row = mysql_fetch_assoc($result)){ $row[table_column]; }
-
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
No idea, is that some sort of kitchen appliance? -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
<?php include("colors.php"); function randomColor($colors) { $color = array_rand($colors,1); return (strpos($color,'*') === false) ? substr($colors[$color],1) : randomColor($colors); } $sql = mysql_query("SELECT * FROM ph_referers WHERE owner = '$_SESSION[username]' ORDER BY id DESC"); while($row = mysql_fetch_assoc($sql)){ $ipaddress = $row['ipaddress']; $usedColors = array(); foreach($ipaddress as $address) { if(array_key_exists($address,$usedColors)) { $color = $usedColors[$address]; } else { $color = randomColor($colors); $usedColors[$address] = $color; } $new = '<font color="#' . $color . '">' . $address . '</font><br />'; } echo "$new - $row[username]:$color<br>"; } $color is showing as blank. Any ideas? -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
$user_ip = $row_rs['ipaddress']; $user = $row_rs['username']; function randomColor($colors) { $color = array_rand($colors,1); return (strpos($color,'*') === false) ? substr($colors[$color],1) : randomColor($colors); } $usedColors = array(); foreach($user_ip as $address) { if(array_key_exists($address,$usedColors)) { $color = $usedColors[$address]; } else { $color = randomColor($colors); $usedColors[$address] = $color; } $new = '<span style="background-color:#' . $color . '">' . $address . '</span><br />'; } <td><div align="center"><strong><?php echo $new; ?></strong></div></td> I have included colors.php outside the while loop. However this code is not working -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
I thought this was a help forum as well. I thank you for your help, but just saying something is wrong doesn't do much justice. -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
I will paypal someone a donation for some workig code. -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
This is what I tried, but doesnt work. $user_ip = $row_rs['ipaddress']; $user = $row_rs['username']; $ipaddrcolors = array(); foreach ($user as $user2) { if(in_array($ipaddrcolors[$user_ip])){ $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#'.$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)]; $color = $ipaddrcolors[$user_ip]; } else { $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#'.$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)].$rand[rand(0,9)]; $ipaddrcolors[$user_ip] = $color; } $user_colored = "<font color='$color'>$user2</font>"; } <td><div align="center"><strong><?php echo substr($user_colored, 0, 30); ?></strong></div></td> -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
I understand that completely, but my problem lies in finding which IP has already been added to the array. -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
You can't use for each with a single $variable. How would I go about doing this? Also, how do I tell if the $ip has been set a color? -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]; $ipaddrcolors = array(); foreach($row_rs['ipaddress']){ if ($row_rs['ipaddress']){ $colored_username = "<font color='$color'>$row_rs[username]</font>"; } else { $colored_username = "<font color='$color'>$row_rs[username]</font>"; } $colored_username = "<font color='$color'>$row_rs[username]</font>"; } -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
Could you give me an example code for this? Because the trouble is finding when the IP is different in the while loop. -
Coloring usernames in table based off IP Address?
Lukeidiot replied to Lukeidiot's topic in PHP Coding Help
Random color based off IP, if the IP addresses are the same, give them the same random color. -
How would I go about coloring usernames (random color) based off an IP address? For example, I want all user's with IP "127.0.0.1" to be red in the table: $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]; Example: User1(red) - 127.0.0.1 User2(red) - 127.0.0.1 User3(blue) - 44.43.44.44 User4(green) - 54.45.45.45