PHP - Problem With Php Short Links Script
Hello guys
i want your help in adfly clone script , i have it installed it but i have problem - shrinking links not working on main page, but working good when user logged in all server Requirements are ok my website: adglo.be script: mediafire vt: virustotal regards, Edited by ForexSon, 09 August 2014 - 06:49 PM. Similar TutorialsI am re-using a simple script that works good to get random files from a folder to get embed codes into a jquery slider(to embed videos)to create a video slider/gallery( http://www.awkward.se/demo/showcase/).The reason for the embed is there will be 50 and more videos in gallery and that's bad for page weight/page load. I have taken out the random element for this code because i just want videos to get embeded when icons are clicked(the onclick is already set up with the jquery script-->no worry about that). I have change a few things (in red) and i thought i would work, but i am really not sure how to make it work at this point??? I get this error message: Quote Fatal error: Cannot use object of type DirectoryIterator as array The original random code to get files which works perfect: Quote <?php function getRandomFile($path) { $files = array(); foreach( new DirectoryIterator($path) as $file ) { if($file->isFile()) { $files[] = $path . $file->getFilename(); } } $i = array_rand($files); return $files[$i]; } $path = "vids"; $file = getRandomFile($path); $final= substr($file, 4); ?> It inserts into the html like this: Quote <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="280" height="210" id="FLVPlayer"> ... <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_2&streamName=vids/<?php echo ($final); ?>&autoPlay=false&autoRewind=false" /> <param name="swfversion" value="8,0,0,0" /> ... I modified it like this to get files to embed in the jquery gallery(changed values in blue): Quote <?php function getEmbedFile($path) { $filesEmbed = array(); foreach( new DirectoryIterator($path) as $filesEmbed ) { if($filesEmbed->isFile()) { $filesEmbed[] = $path . $filesEmbed->getFilename(); } } $i = array_rand($filesEmbed); return $filesEmbed[$i]; } $path = "thumbEmbed"; $filesEmbed = getEmbedFile($path); ?> <div> <?php echo ($filesEmbed); ?> It inserts into the html like this: Quote <div class="showcase-thumbnail" > <img src="images/ShowcaseThumbs/video1.GIF" alt="01" width="55px" /> <div class="showcase-thumbnail-caption">Play video 1</div> To give you a better idea this a pic of the jquery slider: So this is a bit of a puzzler for me? I have a code that takes a form submit and chucks it to a DB that all works fine but the second part is it also takes the submit and sends it to a email. now this is the crazy part it works fine 80% of the time but some times it sends back a blank email or one that is only hafe there, but still all shows fine in the DB and I have been trying to work this out for 5 days now and ..... nothing worked and I am lost for any ideas on what it could be <?php # Game Info # $game_link = "http://mob-dynamic-lb".rand(1,5).".mobsters0".rand(1,9).".com/mob/"; //$id2 = 548685167; # ID / Auth Key file info # $filename = "auth-keys111.txt"; $fp = file($filename); foreach($fp as $cwb){ list($id,$auth) = explode(" ",$cwb); $a = file_get_contents($game_link."attack?user_id=".$id."&target_id=548685167&punch_in_face=true&auth_key=".$auth); echo "WTF!"; //////////////////////////////////////////// //////////////////////////////////////////// $a = file_get_contents($game_link."attack?user_id=".$id."&target_id=548685167&punch_in_face=true&auth_key=".$auth); $b = file_get_contents($game_link."top_mob_gift?user_id=".$id."&target_id=".$id."&auth_key=".$auth); $c = file_get_contents($game_link."remove_top_mob?user_id=".$id."&target_id=548685167&auth_key=".$auth); echo "WTF?!";} ?> everything is correct for $game_link and all that.. but its not workin.. Any ideas? 'm trying to set up short urls on my page and what I need to do is insert a url from a parent frame page into an input. So on the child iframe I'm using this to pull the referers url Code: [Select] <?php $url="".$_SERVER['HTTP_REFERER']; echo $url; ?> which works great Then I want to insert it in an input on the same page Code: [Select] $site = my_SITE; echo <<<HTML <form method="post" action=""> <input type="text" name="url" value="Insert Here" size="30" /> <input type="submit" value="submit" /> </form> HTML; Any Help? HI,
I'm using;
https://github.com/o.../PHP-Pagination
It works on my local test server, but on EC2, short tags are apparently not enabled by default.
The pagination is printing php:
<div class="pagination"><ul class="<?php= implode(' ', $classes) ?>"> <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($previous) ?></a></li> <li class="number active"><a data-pagenumber="<?php= ($current) ?>" href="#"><?php= ($current) ?></a></li> <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li> <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li> <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($next) ?></a></li>I tried replacing <? with <?php to no avail. Not sure if the fact that one dependency is named "render.inc.php" instead of just ".php" which is causing the issue. Any ideas why apache is doing this? I'd rather not edit the .ini. Thanks.. Edited by arbitrageur, 03 November 2014 - 01:00 AM. Hey eveyone, I have this great idea I would love to do but I have some questions and whenever I have questions I come here and they always get answered :-) Anyway what do you guys know about SMS short codes (you know those commercials on TV that are like text ringtone1 to 555)? I did some quick reading and it seems they are super expensive?!? Is there anyway to get them free or cheaper if you can write your own code? Has anyone had any experience with sms short codes? Also is there anyway for a site to receive a SMS and then charge that persons service provider with php? Thanks How do I re write my code so it's
$itemAnnual0 = $values[0] * $periods[0]; $itemAnnual1 = $values[1] * $periods[1]; $itemAnnual2 = $values[2] * $periods[2]; ... $itemAnnual79 = $values[79] * $periods[79];
And for my previous post, I solved it. What is the best way to handle an auto database check? could php do this without the help of JQUERY or JAVASCRIPT? Long Version Associative Array:
/* associative array */ $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo $row["name"]." ".$row["author_name"]." ".$row['price'];
Short Version Associative Array:
($row = mysqli_fetch_assoc($result))
As in:
while ($row = mysqli_fetch_assoc($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Q1. Correct ?
Q2. Long Version Numeric Array:
/* numeric array */ $row = mysqli_fetch_array($result, MYSQLI_NUM); echo $row[0]." ".$row[1]." ".$row[2];
Can you not do short Version like this :
($row = mysqli_fetch_num($result))
As in:
while ($row = mysqli_fetch_num($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Q3. Long Version "Both":
/* associative and numeric array */ $row = mysqli_fetch_array($result, MYSQLI_BOTH); echo $row[0]." ".$row["author_name"]." ".$row[2];
Can you not do short Version like this:
($row = mysqli_fetch_both($result))
As in:
while ($row = mysqli_fetch_both($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Edited February 3, 2019 by phpsane I haven't really messed with PHP in like 2 years. Just little fixes on old scripts every now and then. I've been kind of in an argument with myself the past couple of days while writing a script. The thing is I only have around 3 or 4 sets of information I need. Such as: Code: [Select] option1: information for option 1 option2: information for option 2 option3: information for option 3 etc.. NOW, at first I was doing this all in a text file. This information doesn't necessarily need to be private but i also don't want people to know what file needs to be edited right off the bat. I don't see any reason at all for using databases here, I'd much rather stick to files. I'm thinking it may be best to store this is strings in a seperate PHP file and include it? Then if I need to edit it, I can simply write a new file. Any suggestions? Can't fix it? Code: [Select] <?php include('connect.php'); mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error()); $row = mysql_fetch_array( $result ); echo $row['sum(itemQty)']; ?> This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=332844.0 I am assuming doing the following is bad practice as the short name "Account" is both for the repository and account. Agree? Appears that use always takes precedent over namespace and just Account\User is always short for \NotionCommotion\Domain\Entity\Account\User and not \NotionCommotion\Api\Account\User. Still sees like it could easily result in confusion. namespace NotionCommotion\Domain\Repository\Account; use NotionCommotion\Domain\Entity\Account; class AccountRepository { public function getUser(string $mainKey, int $userId):?Account\User { // } } Would it be better to do something like the following? Interestingly, it worked fine on the below class but when I tried to do so on the above AccountRepository class, it resulted in AccountDir\User class not found error. Is there any logic reason why that might/should happen, or is it more likely I just have some error elsewhere? namespace NotionCommotion\Api\Account; use NotionCommotion\Domain\Entity\Account as AccountDir; class AccountService { public function read():AccountDir\Account { // } } Someone showed me a while ago this trick for loading variables, but it creates an error when you go to the page initially:
$fname = $_POST['fname'] ? $_POST['fname'] : null;How do I write the short hand to run correctly? Hi! I have an odd problem... I inserted a flash file in a php doc, and basically what happens is that on some computers, the link does not work without the www extension ... by that i mean if people go to http://mysite.com they will not be able to click the banner but if they put http://www.mysite.com it works... Very odd as the link is part of the flash movie and it only happens on some computers not all ... anyone would have an idea as to what could cause this ? Alternativly what can I do with this piece of code that does not seem to do the trick either Code: [Select] <div class="subtitulo"><a href="http://hostelsuites.com/hostel-banner.php?Buenos+Aires+Hostel+Suites+Florida&id_hostel=30&idioma=3&id_banner=2"><?php echo ucfirst($lang["expanish"]) ?></a><br /> <br/></div> Many thanks for any help ! This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=359016.0 As you can see, this array is setting each colorvalue to each idvalue. Code: [Select] <?php include("config.php"); include("db.php"); $arrid=$_POST['id']; $arrcolor=$_POST['color']; foreach ($arrid as $idvalue) { foreach ($arrcolor as $colorvalue) { $sql = "UPDATE colors SET color='$colorvalue' WHERE id = '$idvalue'"; mysql_query($sql) or die("Error: ".mysql_error()); echo $sql; } } header("Location: " . $config_basedir . "adminhome.php"); ?> I am having trouble get links to email when the Link Text does not match the link. <a href=\"http://mysite.org/?upfriday.php&e=$email&v=$v&r=no\">I do not need a ride this Friday</a> Just prints the text with no link, while: <a href=\"http://mysite.org/?upfriday.php&e=$email&v=$v&r=no\">http://mysite.org/?upfriday.php&e=$email&v=$v&r=no</a> Sends the link just fine. Is there a workaround for this? Or is this just a limitation of PHP? The thing is that I want to put 3 options in each email... each of which sends a different response to a script that will enter their response into the database. I'm afraid if the links are this long and non-descriptive, it will confuse my users. Thanks for any help. Hi Everyone, I have a page on my website that displays a list of products from a mysql database in a table. Currently when the column titles are clicked, the data is sorted in order with the highest first. $sort = $_GET['sort']; if ($sort == 'price') { $query = mysql_query("SELECT * FROM products ORDER BY price DESC"); } else{ $query = mysql_query("SELECT * FROM products ORDER BY product"); } ... echo "<a href='products.php?sort=price'>Price</a>"; Does anybody know how i would go about setting it up so that if the sort link is clicked a second time, the data is re ordered from descending to ascending? Then if the click is clicked again it would change back to descending, and so on.....? Many thanks Hello everybody,
i have an easy short code to upload multiple photos to "images" directory.
after upload each file, i give it unique name.
the problem i have is:
i want see the name of uploaded files and print this using echo as in line 21.
the line 21 gives me names but not the same names of uploaded files!
thank you very much for your help.
Rafal
<?php foreach ($_FILES['file']['name'] as $i => $name) { $types = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $name); $extension = end($temp); if ($_FILES["file"]["size"][$i] < 10240000 && in_array($extension, $types)) { if ($_FILES["file"]["error"][$i] > 0) { echo "Return Code: " . $_FILES["file"]["error"][$i] . "<br>"; } else { if (file_exists("images/" . $name)) { } else { move_uploaded_file($_FILES["file"]["tmp_name"][$i], "images/" . uniqid() . "." . $extension); echo "uploaded " . $_FILES["file"] , uniqid() . "." . $extension ; echo "<br>"; } } } else { $error = "Invalid file"; } } ?> <html> <head> <title></title> </head> <body> <form enctype="multipart/form-data" action="photo.php" method="POST"> <input type="file" name="file[]" id="file" ><br> <input type="file" name="file[]" id="file" ><br> <input type="file" name="file[]" id="file" ><br> <input type="file" name="file[]" id="file" ><br> <input type="submit" value="upload"> </form> </body> </html> |