<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Emanuele Feronato &#187; Html</title>
	<atom:link href="http://www.emanueleferonato.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emanueleferonato.com</link>
	<description>italian geek and PROgrammer</description>
	<lastBuildDate>Thu, 02 Sep 2010 09:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>JQuery powered lights off effect</title>
		<link>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/</link>
		<comments>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 14:58:07 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=1735</guid>
		<description><![CDATA[A couple of days ago a fan of my Facebook page asked me for a script to make the effect you see on this page. Obviously simply reverse-engineering the script wouldn&#8217;t be enough for me, so I decided to create a lights off effect that make any content in a given div remain highlighted while [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago a fan of <a target = "_blank" href="http://www.facebook.com/pages/Emanuele-Feronato/50374255154">my Facebook page</a> asked me for a script to make the effect you see on <a href="http://test.jackread.co.uk/LightsOff/lightsoff.htm" target = "_blank">this page</a>.</p>
<p>Obviously simply reverse-engineering the script wouldn&#8217;t be enough for me, so I decided to create a lights off effect that make <strong>any</strong> content in a given <code>div</code> remain highlighted while the rest of the page fades to black (or to any color).</p>
<p>I used <a target = "_blank" href="http://jquery.com/">JQuery</a> to manage the fade effect because it&#8217;s the best Javascript library available at the moment.</p>
<p>As a developer, I also tried MooTools and scriptaculous but believe me <a target = "_blank" href="http://jquery.com/">JQuery</a> is some steps ahead.</p>
<p>Now let&#8217;s see this script:<span id="more-1735"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
     &lt;head&gt;
          &lt;title&gt;Emanuele Feronato's lights off effect&lt;/title&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
          &lt;script&gt;
               $(document).ready(function(){
                    $(&quot;#the_lights&quot;).fadeTo(1,0);
                    $(&quot;#turnoff&quot;).click(function () {
                         $(&quot;#the_lights&quot;).css({'display' : 'block'});
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,1);
                    });
                    $(&quot;#soft&quot;).click(function () {
                         document.getElementById(&quot;the_lights&quot;).style.display=&quot;block&quot;;
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,0.8);
                    });
                    $(&quot;#turnon&quot;).click(function () {
                         document.getElementById(&quot;the_lights&quot;).style.display=&quot;block&quot;;
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,0);
                    });
               });
          &lt;/script&gt;
          &lt;style&gt;
               html{
                    width:100%;
                    height:100%;
                    margin:0px;
               }
               #the_lights{
	              background-color:#000;
	              height:100%;
	              width:100%;
	              position:absolute;
	              top:0;
	              left:0;
	              display:none;
               }
               #standout{
                    padding:5px;
                    background-color:white;
                    position:relative;
                    z-index:1000;
               }
          &lt;/style&gt;
     &lt;/head&gt;
&lt;body&gt;
     &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas scelerisque libero euismod nulla porttitor egestas. Nulla fermentum facilisis sagittis. Vestibulum commodo pretium diam, vitae scelerisque lectus bibendum nec. Curabitur a metus est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed nunc dolor, pretium eget venenatis ut, condimentum at sem. Vivamus rhoncus ullamcorper turpis. Aliquam sit amet risus diam, vel mattis est. Quisque sodales eros id nulla rhoncus posuere. Nullam accumsan lorem quis dolor tempor congue. Vivamus ligula augue, commodo malesuada tempor non, tristique id enim. Sed dapibus sagittis porttitor. Suspendisse faucibus scelerisque eros, ac hendrerit orci scelerisque sit amet.&lt;/p&gt;
     &lt;div id = &quot;standout&quot;&gt;&lt;p&gt;Everything inside this div will remain highlighted&lt;/p&gt;&lt;div id = &quot;turnoff&quot;&gt;Lights off&lt;/div&gt;&lt;div id = &quot;soft&quot;&gt;Soft lights&lt;/div&gt;&lt;div id = &quot;turnon&quot;&gt;Lights on&lt;/div&gt;&lt;/div&gt;
     &lt;p&gt;Vestibulum interdum, odio ut congue imperdiet, justo ligula bibendum nisl, ac placerat orci eros nec tortor. Maecenas rhoncus felis vitae elit consectetur vitae mattis metus tincidunt. Donec nec ipsum quis tellus posuere ultricies. Ut tempus tortor nec sem blandit ut facilisis nisl scelerisque. Nulla venenatis ante sit amet nisi dictum varius. Etiam congue dui eu diam fermentum et tincidunt magna egestas. Sed tincidunt magna et metus molestie malesuada. Nam tempus dignissim porta. Vivamus iaculis, orci hendrerit condimentum viverra, eros nisl euismod arcu, nec pulvinar tellus elit eu nulla. Vestibulum mattis, ligula sit amet euismod commodo, augue lorem fermentum magna, et rhoncus nisl urna nec purus. Suspendisse potenti. Fusce fermentum orci at orci posuere ornare a imperdiet justo. In hac habitasse platea dictumst. Duis adipiscing leo nec risus varius auctor. Cras sed erat massa, quis egestas leo. Vivamus dignissim lacinia leo, ac interdum nisi facilisis eget.&lt;/p&gt;
     &lt;div id=&quot;the_lights&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>The <code>div</code> is the one called <code>standout</code> at <strong>line 48</strong> and it has nothing special but a background color (it can&#8217;t be transparent) and a z-index along with a relative position (<strong>lines 40-42</strong>).</p>
<p>Obviously the z-index should be higher than the rest of the elements.</p>
<p>The other interesting <code>div</code> is <code>the_lights</code> (<strong>line 50</strong>), a black div covering all the page, initially invisible (<strong>lines 30-36</strong>). Playing with its transparency will simulate the lights effect</p>
<p>Now it&#8217;s all a matter of JQuery:</p>
<p><strong>Line 7</strong>: Listening for the document to be ready</p>
<p><strong>Line 8</strong>: Once it&#8217;s ready, the first thing is setting <code>the_lights</code> alpha to zero. I don&#8217;t set it from CSS but use <code>fadeTo</code> because I need to initialize the fading process. The entire lights out effect is just playing with <code>the_lights</code> and some tweening.</p>
<p><strong>Line 9</strong>: Here I am listening for the <code>turnoff</code> div to be clicked</p>
<p><strong>Line 10</strong>: Showing <code>the_lights</code> div&#8230; this is the same thing as<br />
<code>document.getElementById('the_lights').style.display='block'</code></p>
<p><strong>Line 11</strong>: Fading the black div to full opacity.</p>
<p>This will give the &#8220;lights out effect&#8221;</p>
<p>Try the <a href="/stuff/lightsoff/" target = "_blank">example at this page</a> will show you the effect&#8230; click on &#8220;lights on&#8221;, &#8220;lights off&#8221; or &#8220;soft lights&#8221; and see what happens.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>MagOrMin &#8211; an old php based game</title>
		<link>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/</link>
		<comments>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 12:17:40 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=1081</guid>
		<description><![CDATA[This is an ooooooold (let&#8217;s call it) game I explained for a web programming class in 2003 or 2004. It was made to explain some basics about Php, sessions, MySql and styles. All in one. That&#8217;s how students learn&#8230; all in one and with a real world example. It&#8217;s just a &#8220;guess if next number [...]]]></description>
			<content:encoded><![CDATA[<p>This is an ooooooold (let&#8217;s call it) game I explained for a web programming class in 2003 or 2004.</p>
<p>It was made to explain some basics about Php, sessions, MySql and styles. All in one.</p>
<p>That&#8217;s how students learn&#8230; all in one and with a real world example.</p>
<p>It&#8217;s just a &#8220;guess if next number will be higher or slower than the current one&#8221; concept, the same that I applied to <a href="http://www.emanueleferonato.com/2007/12/30/guessnext-complete-flash-game-with-highscores/">GuessNext</a> last year.</p>
<p>It&#8217;s called <strong><a target = "_blank" href="http://www.gamemummy.com/magormin/">MagOrMin</a></strong> and the name comes from the italian translation of &#8220;higher&#8221; (maggiore) and &#8220;lower&#8221; (minore).</p>
<p><a target = "_blank" href="http://www.gamemummy.com/magormin/"><img src="/images/magormin.jpg" alt="MagOrMin" /></a></p>
<p>Simply click to say if next number will be higher or lower, gain extra lives and compete for the high scores.</p>
<p>I plan to port the game in Ajax, adding a so-called &#8220;Web 2.0&#8243; style and convert it into a Facebook application with all features&#8230; you know&#8230; I must monetize everything&#8230;</p>
<p>Meanwhile here it is the source code:<span id="more-1081"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;game_status&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;actual_number&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;score&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lives&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;next_extra&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$connection</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span>localhost<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;****&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;****&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db</span><span style="color: #339933;">=</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*****,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$old_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$actual_number</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$page_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$PHP_SELF</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;new&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;insert into ****(***,***) values(<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,<span style="color: #006699; font-weight: bold;">$score</span>)&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$lives</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$score</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$next_extra</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;bigger&quot;</span><span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;smaller&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;update *** set *** = ***+ 1&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//	echo $sql;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$old_number</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;bigger&quot;</span><span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span><span style="color: #000088;">$actual_number</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> or <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;smaller&quot;</span><span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span><span style="color: #000088;">$actual_number</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$score</span> <span style="color: #339933;">++;</span>
		<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$score</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$next_extra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$lives</span> <span style="color: #339933;">+=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$next_extra</span> <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$next_extra</span><span style="color: #339933;">*</span><span style="color:#800080;">1.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$lives</span> <span style="color: #339933;">-=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number_wrong&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lives</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$perso_ora</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number_wrong&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$perso_ora</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$old_number</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//echo $game_status;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
&nbsp;
h1{
	color:#c4c41f;
	font-size: 20;
}
&nbsp;
.container{
	background-color: #000000;
	padding: 30px;
	border: 2px solid #c43d1f;
	width: 600px;
	height: 450px;
	font-family: verdana;
	font-size: 12px;
	color:c43d1f;
	font-weight: bold;
	text-align:center;
}
&nbsp;
.number{
	color:579331;
	font-family: verdana;
	font-size: 128px;
	border: 1px solid #c43d1f;
	margin-left: 140px;
	margin-right: 140px;
	margin-top: 15px;
	margin-bottom: 15px;
	background-color:#ffffff;
}
&nbsp;
.number_wrong{
	color:#c43d1f;
	font-family: verdana;
	font-size: 128px;
	border: 1px solid #c43d1f;
	margin-left: 140px;
	margin-right: 140px;
	margin-top: 15px;
	margin-bottom: 15px;
	background-color:#ffffff;
}
&nbsp;
a:link,a:visited{
	padding: 10px;
	margin: 15px;
	border: 1px dotted #c43d1f;
	width = 130px;
	text-align:center;
	text-decoration:none;
	font-size: 18;
	color:#579331;
}
&nbsp;
.score{
	padding: 5px;
	margin: 10px;
	border: 1px solid #c43d1f;
	text-align:center;
	font-size: 15;
	color:#c4c41f;
}
&nbsp;
a:hover{
	padding: 10px;
	margin: 15px;
	border: 1px dotted #c43d1f;
	width = 130px;
	text-align:center;
	text-decoration:none;
	background-color:#ffffff;
	font-size: 18;
	color:579331;
}
&nbsp;
ul
{
	padding-left: 0;
	margin-left: 0;
	float: left;
	width: 100%;
}
&nbsp;
&nbsp;
li{
	display: inline;
}
&nbsp;
body{
	font-family: sans-serif;
	text-align:center;
	background-color:#cccccc;
}
&nbsp;
&lt;/style&gt;
&lt;/head&gt;
&lt;body onload = &quot;self.focus()&quot;&gt;
&lt;div class = &quot;container&quot;&gt;
&lt;h1&gt;WELCOME TO PHP-MAGORMIN v1.0&lt;/h1&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;&lt;li class =<span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Score: <span style="color: #006699; font-weight: bold;">$score</span>&lt;li class = <span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Lives: <span style="color: #006699; font-weight: bold;">$lives</span>&lt;li class = <span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Extra life at <span style="color: #006699; font-weight: bold;">$next_extra</span>&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;br&gt;&lt;br&gt;CURRENT NUMBER
&lt;div class = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$class_to_show</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$actual_number</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
I guess next number will be
&lt;ul&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=smaller&quot;&gt;SMALLER&lt;/a&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=bigger&quot;&gt;BIGGER&lt;/a&gt;&lt;/ul&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
GAME OVER&lt;br&gt;
&lt;form action = &quot;&quot; method = &quot;post&quot;&gt;Enter your name: &lt;input name = &quot;name&quot; type = &quot;text&quot;&gt;&lt;input type = &quot;hidden&quot; name =&quot;guess&quot; value = &quot;new&quot;&gt; &lt;input type = &quot;submit&quot; value = &quot;go&quot;&gt;&lt;/form&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
I guess next number will be
&lt;ul&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=smaller&quot;&gt;SMALLER&lt;/a&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=bigger&quot;&gt;BIGGER&lt;/a&gt;&lt;/ul&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>I&#8217;ll explain the entire process to convert it into a Facebook app.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Embedding a wmv file in your web page</title>
		<link>http://www.emanueleferonato.com/2006/08/03/embedding-a-wmv-file-in-your-web-page/</link>
		<comments>http://www.emanueleferonato.com/2006/08/03/embedding-a-wmv-file-in-your-web-page/#comments</comments>
		<pubDate>Thu, 03 Aug 2006 11:16:55 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Html]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/2006/08/03/embedding-a-wmv-file-in-your-web-page/</guid>
		<description><![CDATA[Just in case you have to embed a wmv file in your webpage, and there is no need to do it since it&#8217;s possibile to play better videos with flash but&#8230; just in case you really have to do it&#8230; like I have to do it today&#8230; here it is the html code 1 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Just in case you have to embed a wmv file in your webpage, and there is no need to do it since it&#8217;s possibile to play better videos with flash but&#8230; just in case you <strong>really</strong> have to do it&#8230; like I have to do it today&#8230; here it is the html code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;OBJECT ID=&quot;MediaPlayer&quot; WIDTH=&quot;192&quot; HEIGHT=&quot;190&quot; CLASSID=&quot;CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95&quot; STANDBY=&quot;Loading Windows Media Player components...&quot; TYPE=&quot;application/x-oleobject&quot;&gt;
&lt;PARAM NAME=&quot;FileName&quot; VALUE=&quot;videofilename.wmv&quot;&gt;
&lt;PARAM name=&quot;ShowControls&quot; VALUE=&quot;true&quot;&gt;
&lt;param name=&quot;ShowStatusBar&quot; value=&quot;false&quot;&gt;
&lt;PARAM name=&quot;ShowDisplay&quot; VALUE=&quot;false&quot;&gt;
&lt;PARAM name=&quot;autostart&quot; VALUE=&quot;false&quot;&gt;
&lt;EMBED TYPE=&quot;application/x-mplayer2&quot; SRC=&quot;videofilename.wmv&quot; NAME=&quot;MediaPlayer&quot; WIDTH=&quot;192&quot; HEIGHT=&quot;190&quot; ShowControls=&quot;1&quot; ShowStatusBar=&quot;0&quot; ShowDisplay=&quot;0&quot; autostart=&quot;0&quot;&gt; &lt;/EMBED&gt;
&lt;/OBJECT&gt;</pre></td></tr></table></div>

<p>Adjust height, width, ect to match your video settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2006/08/03/embedding-a-wmv-file-in-your-web-page/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
