-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] File extension not shown on downloads
MadTechie replied to Mutley's topic in PHP Coding Help
in that case your need to check where your getting $file from as its $file = "spreadsheet"; not $file = "spreadsheet.xls"; -
sprintf EG <?php $R = range(2,10); $folder = array(); foreach ($R as $V) { $V= sprintf("%02s",$V); //add the 0 for the 1to9 if(is_dir($V)) { $folder[] = $V; echo "FOUND: $V<br>"; }else{ echo "NOT FOUND: $V<br>"; } } echo "<pre>"; print_r($folder) ?> EDIT: missed a / on the comment
-
[SOLVED] File extension not shown on downloads
MadTechie replied to Mutley's topic in PHP Coding Help
does the downloaded file have the extension .xls ? if so then its a problem on the client (downloaders) PC ie office not installed -
htmlspecialchars encode html you want to decode html try html_entity_decode() ie echo html_entity_decode("سلام");
-
even if the folders are missing ? what do you mean by "get directories" i assumed to meant get the names of all existing directories within a range
-
benjamin_1 please create a New Thread in the PHP Help Section. Also please use the Code tag (# button) also redirect to where ?
-
So if for example, if you have folder 1 2 5 6 9 10 11 and done dirrange(2,10) you want it to return 2 5 6 9 10 right ? if so you could try something like this <?php $R = range(2,10); $folder = array(); $Path = "path/to/folders/"; foreach ($R as $V) { if(is_dir($Path.$V)) $folder[] = $V; } echo "<pre>"; print_r($folder) ?>
-
Okay the Idea behind my madness method is for every title the user gets a new record so when you get the users details (including UserdefinedDetails) your will get more than 1 record. example <?php //Normal stuff $UserID = 10; $query = "SELECT * FROM users WHERE ID = $UserID"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); echo $row['Name']; //Now UserdefinedDetails $query = "SELECT * FROM UserdefinedDetails WHERE UserID = $UserID"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo $row['uTitle']." - ".$row['uValue']."<br>"; } ?> for the user to add a title just INSERT into `UserdefinedDetails` making sure you also set the UserID
-
I did want to help, but not anymore good luck
-
thats because you are doing 2 queries.. put them into one and it will be fine I would really need to see a little more code but assume the fetch from the catalogue query goes to $row.. ie <?php $rowsPerPage = 6; $pageNum = 1; if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $self = $_SERVER['PHP_SELF']; $catalogue_query = "SELECT COUNT(Product_ID) AS numrows, Product_ID, Genus, Division FROM products"; if (isset($_GET['Genus'])) { $catalogue_query .=" WHERE Genus = '" .mysql_real_escape_string($_GET['Genus']). "'"; } if (isset($_GET['Division'])) { $catalogue_query .=" AND Division = '" .mysql_real_escape_string($_GET['Division']). "'"; } $catalogue_query .= " ORDER BY Product_ID DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($catalogue_query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/$rowsPerPage); echo " Showing page $pageNum of $maxPage pages "; ?>
-
center the table in the page or center the contents of the table ? Also this is a HTML problem not PHP, please you the correct section
-
Thanks for letting us know.. but theirs no question.. so why post that in PHP Help ?
-
Launch skype and connect to users name in the app.
MadTechie replied to travillaintim's topic in HTML Help
update if ($player['skype'] == "n/a") { to if ($player['skype'] == "n/a" || empty($player['skype'])) { and check the results but without more info/code it hard for us to say -
Headers already sent - please help with workaround
MadTechie replied to tommyda's topic in PHP Coding Help
<?php ob_start(); $cookieCheck = setcookie("BoardTest","cookie",time()+3600); include("header.php"); $u = $_POST['u']; $p = $_POST['p']; $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$u' AND `password`='$p'")); if($check==1) { if($cookieCheck) { ob_end_clean(); setcookie("BoardW",$u,time()+3600); Header("Location: index.php"); } else { print "Cant set cookie!"; } } else { print "User/Pass mismatch!"; } include("footer.php"); ?> -
try this.. if possible post a short encrypted and decrypted file from silverlight for testing. <?php $plaintext = aes_128_decrypt($data, $key); function aes_128_decrypt($encrypted_text,$password) { $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM); preg_match('/([\x20-\x7E]*)/',mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $encrypted_text), MCRYPT_MODE_ECB, $iv), $a); return $a[0]; } ?>
-
Headers already sent - please help with workaround
MadTechie replied to tommyda's topic in PHP Coding Help
try this <?php include_once("../config.php"); $u = $_POST['u']; $p = $_POST['p']; $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$u' AND `password`='$p'")); if($check==1) { if(setcookie("BoardW",$u,time()+3600)) { Header("Location: index.php"); } else { $msg ="Cant set cookie!"; } } else { $msg ="User/Pass mismatch!"; } include("header.php"); echo $msg; include("footer.php"); ?> -
I don't think their is a solution.. due to the fact you are creating a conflict! tracking anonymous users.. if you can identify them then they are not anonymous ! personally i think you are going to need them to register an email or allow only 1 vote per IP but even then that can be spoofed (as with creating multiple emails).. I guess you could add some image verfications to make it a longer process..
-
Headers already sent - please help with workaround
MadTechie replied to tommyda's topic in PHP Coding Help
also check ./paths.php for output.. -
Is it possible to make this code dry and clean
MadTechie replied to werushka's topic in PHP Coding Help
Well their is nothing wrong with the if statement but if you was planning to extend it you could use an array or something instead ie <?php $discounts = array( 100=>15, 10=>5, 50=>10 ); asort($discounts); $allproducts = $tireqty + $oilqty + $sparkqty; foreach($discounts as $Q => $D) { if($allproducts>=$Q) { $discount = $D; continue; } } echo $discount; ?> So if you wanted to add 20% discount for 500 or over you only have to add 500=>20 to the array ie $discounts = array( 500=>20, 100=>15, 10=>5, 50=>10 ); But as i said it is fine as it is -
correct Referrer will be blank
-
[SOLVED] new user activation email - theory and implementation
MadTechie replied to Lodius2000's topic in PHP Coding Help
and they can't just have a hash of nothing due to the if($hash != '') to unsolve a post click solved again ??? Happy 1000 post ratcateme -
referrer isn't much good really but the logs on the site to are re-directing people to will appear as if they the people entred the site directly (via the address bar) NOTE: I have not done my own testing on this (so i am not 100% sure) but it should be as described, of course if someone tell them they was directed from your site then theirs not much you can do lol
-
Launch skype and connect to users name in the app.
MadTechie replied to travillaintim's topic in HTML Help
I think your missing the call option "?call" $skypepic = "<a href='skype:$skypename?call'><img border='1' src='images/skype.gif' align='absmiddle' alt='skypename' /></a>"; also hover other the link and check the url is correct ie skype:MadTechi?call if you don't see the number then we probablt need more code -
if you don't normally use header then you may want to create a redirect page, as you can't have any thing displayed before the header ie <?php header("location: {$_GET['url']}"); ?>
-
Will work but theirs probably a better way $HTTP_HOST = preg_replace('/^www\./i', '', $_SERVER['HTTP_HOST']); echo $HTTP_HOST;