
Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
So you want to be able to call $numTimes later in your PHP script and it would display 10, is that correct?
-
Or just print it out in a format like "$123"? <?php $var = 'variableName'; $$var = 'test'; echo $var; //prints variableName echo $variableName; // prints test ?> Are you trying to do like variable variables?
-
Try: <?php include_once('/home/xxxxxxxx/public_html/footer.php'); // using path, instead of domain ?>
-
It depends on what you mean. Setting the contents of the file to $variable - yes. Creating a variable in the text file - no (unless you parsed the text file as php code.. which wouldn't be safe nor practical)
-
What does this output: <?php $tempVar = 'showtop.php?t_id='.$_POST['t_id'].'&rt='.$_GET['rt']; echo $tempVar; //header("location: $tempVar"); ?>
-
Try this: <?php $ip = $_SERVER['REMOTE_ADDR']; $useripdata = "/ip/$ip.txt"; if (file_exists($useripdata)) { foreach (file($useripdata) as $line) { echo '$' . $line; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } echo "<meta http-equiv='refresh' content='$reloadtime'>"; } else { if (isset($_POST['action'])) { $numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $shorturl = $_POST['url']; $autoplay = "&autoplay=1"; $reloadtime = $_POST['reloadtime']; $setwidth = $_POST['setwidth']; $setheight = $_POST['setheight']; $shorturl = $_POST['url']; $fullurl = "http://www.youtube.com/watch?v=$shorturl"; $myFile = "./ip/$ip.txt"; $fh = fopen($myFile, 'w'); $stringData = "numTimes = 10 \n"; fwrite($fh, $stringData); $stringData = "shorturl = $shorturl \n"; fwrite($fh, $stringData); $stringData = "autoplay = $autoplay \n"; fwrite($fh, $stringData); $stringData = "reloadtime = $reloadtime \n"; fwrite($fh, $stringData); $stringData = "setwidth = $setwidth \n"; fwrite($fh, $stringData); $stringData = "setheight = $setheight \n"; fwrite($fh, $stringData); $stringData = "fullurl = $fullurl \n"; fwrite($fh, $stringData); fclose($fh); function check_if_valid($fullurl) { $res = (($check = @fopen($fullurl, ‘r’)) === false) ? false : @fclose($check); return ($res == TRUE) ? VIDEO_IS_VALID:VIDEO_IS_INVALID ; } if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='$reloadtime'>"; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } } else { $self = $_SERVER['PHP_SELF']; echo "<table border='1'>"; echo "<form action='$self' method='post'>"; echo "<tr>"; echo "<td>Video Url:<input type='text' readonly='1' value='http://www.youtube.com/watch?v=' size='30'><input type='Text' name='url'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>(Number)<input type='text' name='times' value='10'> of Times to Display Video in <input type='text' name='reloadtime' value='5'>(Seconds)</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Set Width <input type='text' name='setwidth' value='425'> Set Height <input type='text' name='setheight' value='344'>"; echo "</tr>"; echo "<tr>"; echo "<td align='center' valign='center'><input type='submit' name='action' value='Submit'>"; echo "<input type='hidden' name='submitted' value='yes'>"; echo "</td>"; echo "</tr>"; echo "</form>"; echo "</table>"; } } ?> You had it check to see if $_POST['action'] is there, but not if it wasn't.
-
Well, <?php header("Location: showtop.php?t_id=".$_POST["t_id"]."&rt=".$_GET['rt']); ? The $_POST[] has " instead of '
-
I used http://www.tizag.com/phpT/ for a while. Their site is easy to navigate, easy to read, and they typically have the exact example I am looking for.
-
It doesn't appear they do - you can always try submitting a ticket to their support and ask if they will allow it (or have them do it for you)
-
If it's shared, most likely not. Who is your provider?
-
I could be mistaken, but your first line is missing # (haven't worked with sql dumps for a while, but thats what it looks like to me)
-
urlencode($string) would convert 'TeléfonoCasa' to 'Tel%E9fonoCasa' then you could use urldecode($string) to switch back to 'TeléfonoCasa'
-
What error are you getting?
-
get should work... i don't know why it wouldn't <?php if(isset($_GET['record'])) { echo $_GET['record']; } ?> That doesn't return anything?
-
include "../connect.php"; you must include the full path, i.e.: /home/username/public_html/folders/connect.php
-
If you have the form on the same page, you can do it like: <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <input type="text" name="email" value="<?php if(isset($_POST['email'])) { echo $_POST['email']; }?>"> ... </form> If not, then you could do sessions (i wouldnt recommend it since it takes up some memory for something pretty trivial such as this), or via GET & passing it through the URL. I would suggest looking into integrating the form on the same page as the php script.
-
[SOLVED] Re: Novice Help needed in php Arrays
Philip replied to edster1980's topic in PHP Coding Help
Maybe it's just me, but I'm not sure what you're trying to hit at here: <?php if($q2 == $number2[2] . $number2[1]) ?> -
You can have 2 sets of curly braces without an else clause? I'm 99.9% sure this isn't legit coding: <?php if($var) { echo $var; } { echo $var2; } ?>
-
From the sun boards, seems they got it solved - however it looks to be the same thing you are doing (on the PHP side anyways).... http://forums.sun.com/thread.jspa?threadID=780050
-
Sorry, I just realized I overlooked some of my mistakes in my first reply, which now is tested and works in all cases (well, almost... not "+1 - not correct", how you see that is really different from "1" I'm not sure.): <?php if(!is_int($quantity) || $quantity<0) { $quantity = 0; } ?>] However, btherl, I ran your preg with the test cases and they failed. Still allows the decimals/negatives
-
Why not just use is_int? http://us3.php.net/manual/en/function.is-int.php <?php $quantity = 2; if(is_int($quantity) && $quantity>0) { $quantity = 0; } ?>
-
SELECT * FROM `phones` WHERE `network` IN($network)
-
[SOLVED] Disabling HTML in INPUT and TEXTAREA
Philip replied to tomcommathe's topic in PHP Coding Help
You echo'd something before you put your header output echo $bar; ... header('Location:http://mopedstl.com/phpTest/newsUpdate/'); I would just comment out the header line, for now. -
Oops, didn't see there were 2 more $POST's.... they must be $_POST['varname'], not $POST['varname']