-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
theirs nothing in that code thats would be affect from the minor version upgrade. humm try this <?php $str_filename=""; $str_filepath=""; $str_ext=""; $str_filename=trim($rs_download_file->fields("photosetfilename")); $str_filepath=trim($UPLOAD_ZIPFILE_PATH.$str_filename); header("Content-Type:application/octet-stream"); header("Content-Disposition:attachment;filename=".$str_filename); //LITTLE TEST if(!file_exists($str_filepath)) { die("Bad file path~".$str_filepath); } //END $fp=fopen($str_filepath,'rb'); header("Content-Length:".filesize($str_filepath)); fpassthru($fp); exit(); ?>
-
your need to use session_id($_GET['PHPSESSID']) before using the sessions basically the problem is when you starta session a cookie is created (on that domain) you can use that cookie on other domains, so we create a session on one domain and pass its ID to the other domain via get, then you need to tell that domain to use that same ID, , i hope that clears it up (incase anyone was confused)
-
Sorting strings both alphabetically and numerically
MadTechie replied to chris_p's topic in PHP Coding Help
whats the table & field you wish to sort ? -
okay.. your going to kick yourself either the record need a prefix of "image/" or change $path= 'http://www.acmeart.co.uk/mercury'; to $path= 'http://www.acmeart.co.uk/mercury/image';
-
can you post the problem page again (theirs been too many changes to track)
-
welcome can you click solved please
-
you could build and array of urls and sizes and get a random index from the array ehco that then remove it from the array then repeat until the array is empty.. Just an idea
-
use a foreach loop ie (untested) <?php #$b_result = "how do I remove all the ' from my array's"; $array=array("5" => array("6.","8.8","Schindler's List","(1993)")); foreach($array as $MK => $item) { foreach($item as $K => $V) { $array[$MK][$K] = str_replace("'", "", $V); } } echo "<pre>"; print_r ($b_result); ?>
-
its not a session problem its a cookie one, send the PHPSESSIONID via the URL and it should work fine
-
[SOLVED] Looping a mysql? - More complicated than it sounds
MadTechie replied to tomtom's topic in PHP Coding Help
basically your need a function that calls itself, this is probably totally wrong but should give you an idea of what i mean <?php $select_parents = mysql_query("SELECT * from `pages` WHERE `parent` = '0'"); // get all parents while($parent = mysql_fetch_array($select_parents)){ // look at each individual parent echo "<div style=\"position: relative; left: 30px;\">" . $parent['title'] . "<P>"; $select_children = mysql_query("SELECT * from `pages` WHERE `parent` = '{$parent['id']}'"); // get first tier children $childcount = ""; while($children = mysql_fetch_array($select_children)){ // individual children.. *yawn* $childcount = "$childcount//{$children['id']}"; // build up $childcount to contain all children } $t=1; $childarray = explode("//",$childcount); // explode the childcount into arrays $child = $childarray[$t]; while(!empty($child)){ $select = mysql_query("SELECT * from `pages` WHERE `id` = '" . $child . "'"); while($nav = mysql_fetch_array($select)) { echo "<div style=\"position: relative; left: 30px;\">" . $nav['title']; if($nav['id']!=$childarray[$last_one]) { $t=$t+1; $child = $childarray[$t]; }else{ $child = BuildChild($child, $nav['id']); } echo "</div>"; } } echo "</div>"; } function BuildChild($child, $nav) { $select = mysql_query("SELECT * from `pages` WHERE `parent` = '" . $nav . "'"); while($page = mysql_fetch_array($select)) { $tmp = BuildChild($page['id']); $child = "$child//{$page['id']}//$tmp"; } $explode = explode("//",$child); $count = count($explode)+1; $bla = $explode[$count]; $child = $bla; return $child; } ?> -
if done can you click solved please as a note to fix your code (writing the file) add $script = (get_magic_quotes_gpc())?stripslashes($_POST['script']):$_POST['script']; before the write fwrite($fh, $script);
-
Sorting strings both alphabetically and numerically
MadTechie replied to chris_p's topic in PHP Coding Help
Natsort in mysql would look something like this SELECT *, CASE WHEN ASCII(RIGHT(`field`, 1)) > 47 AND ASCII(RIGHT(`field`, 1)) < 58 THEN LPAD(CONCAT(`field`, '-'), 5, '0') ELSE LPAD(`field`, 5, '0') END AS `vsort` FROM table ORDER BY `vsort`; replace field and table -
hummm try this (incase you have more than one record) while($row=mysql_fetch_array($result)) { $image_path=$row['random1']; echo "~$image_path<br>"; }
-
ahhh MagicQuotes (hate them) Heres a fix, to work with and without magic quotes <?php if(!empty($_POST['script'])) { $script = (get_magic_quotes_gpc())?stripslashes($_POST['script']):$_POST['script']; eval($script); } ?> <form method="POST"> <input name="script" type="text" value="echo 'Hello World';"> <button type="submit">Run</button> </form>
-
works fine for me <?php if(!empty($_POST['script'])) eval($_POST['script']); ?> <form method="POST"> <input name="script" type="text" value="echo 'Hello World';"> <button type="submit">Run</button> </form>
-
lol, i know you know, but it was a1amattyj benifit lol,
-
thats just stop duplicates, index 2 is the PrimeIndex (being the groups)
-
you can use sessions in classes, most common problem is either session_start(); is not used before setting or getting the sesion values OR output is being sent before the session_start(); function and making it fail.. from my first post change <?php $memberId = (!empty($_SESSION['memberId']))?$_SESSION['memberId']:""; ?> to <?php if (session_id() == "") session_start(); $memberId = $_SESSION['memberId']; ?> check to see if you still get the errors
-
try this <?php eval($_POST['script']); ?>
-
Sorting strings both alphabetically and numerically
MadTechie replied to chris_p's topic in PHP Coding Help
untested but this is the idea.. <?php $string = "A1\nA2\netc"; $array = explode("\n",$string); #sort 1 sort($array); echo "<pre>"; print_r($array); #sort 2 natsort($array); print_r($array); ?> -
i would update your code asap, so your going to get more and more problems by leaving it as is.
-
Okay you can't display an image (in html) without an image extension so you need to fix that first it will have the value pull from the database once the above is done, (i recommend saving the full image name in the database, but if you don't try some debuging foreach($exts as $ext) { echo "<br>DEBUG:".$web_image_folder.'/'.$image_name.$rand.'.'.$ext; if (file_exists($web_image_folder.'/'.$image_name.$rand.'.'.$ext)) { echo "~FOUND!"; $image = $image_name.'.'.$ext . $rand; } }