ldb358
Members-
Posts
199 -
Joined
-
Last visited
Never
Everything posted by ldb358
-
fairly basic php question, regarding a simple log-in system
ldb358 replied to js09's topic in PHP Coding Help
is because of how you register your sessions you need to remove the quotes from: session_register("myusername"); //with session_register($myusername); but as i said earlier that method is depreciated and you should use: $_SESSION['username'] = $myusername; //and to check of they are logged in if(isset($_SESSION['username']){} -
fairly basic php question, regarding a simple log-in system
ldb358 replied to js09's topic in PHP Coding Help
replace: session_register("myusername"); with: $_SESSION['username'] = $myusername; you could then fix the messy url problem by loading the username stright from $_SESSION['username'] or by using url rewriting( via htaccess not php) -
fairly basic php question, regarding a simple log-in system
ldb358 replied to js09's topic in PHP Coding Help
you could use a get variable and redirect like: header("Location: /gallery/?user=".$myusername); or you could have the index.php script in the gallery directory load the information based on the session that is set in the previous script also you should be registering your sessions like this: $_Session['username'] = $myusername; as session_register is deprecated -
yeah that one doesn't work either guess i cant think today
-
heres a fix of mine <?php $date = -1*(mktime(0, 0, 0, 9, 19, 2009)-time()); $diff = date('m,d,Y,h,i,s',$date); $unit = array('month','day','year','hour','minute','second'); $diff = explode(',',$diff); $output = ''; foreach($diff as $key => $time){ if($time < 1){ continue; }else if($time == 1){ if($output != ''){ $output .= ', '.$time.' '.$unit[$key]; }else{ $output .= ' '.$time.' '.$unit[$key]; } }else{ if($output != ''){ $output .= ', '.$time.' '.$unit[$key].'s'; }else{ $output .= ' '.$time.' '.$unit[$key].'s'; } } } $output .= ' ago'; echo $output; ?>
-
try: $diff = date('m,d,Y,h,i,s',mktime(0, 0, 0, 9, 19, 2009)-time()); $unit = array('month','day','year','hour','minute','second'); $diff = explode(',',$diff); $output = ''; foreach($diff as $key => $time){ if($time < 1){ continue; }else if($time = 1){ if($output != ''){ $output .= ', '.$time.' '.$unit[$key]; }else{ $output .= ' '.$time.' '.$unit[$key]; } }else{ if($output != ''){ $output .= ', '.$time.' '.$unit[$key].'s'; }else{ $output .= ' '.$time.' '.$unit[$key].'s'; } } } $output .= ' ago'; echo $output; to lower the amount of things shown just take away from the date format
-
Page Visual Count Down Timer? Once the timer is up runs a script?
ldb358 replied to jordz's topic in PHP Coding Help
you could also send an ajax request after the timer is up -
you dont need the ; after the include before the dot
-
what kind of errors are you getting, whats not working?
-
yeah i just found a bug in my thumbnail script it was creating a gif instead of a jpg where is should have and all the browsers except ie 7 were able to display it correctly despite this, so it wasn't an ie issue but an script issue
-
im creating an image gallery that generates thumbnails and html for a portfolio but ive run into an issue with images saved as image.tn.jpg they have an unknown file type when loaded in ie7. does any one know how to fix it so that i can still have a .tn in the file name(make it easier to check if the image is a tn)? example of project: <div class='portfolioitem'><img src='pics/book01.tn.jpg' alt='image:book01.jpg' title='book01' /></div>
-
function generate_thumbnail($image, $max, $output){ if(!file_exists($output)){ $size = getimagesize($image); if($size[0] > $size[1]){ $type = trim(str_replace('image/',' ', image_type_to_mime_type($size[2]))); $newheight = $max*($size[1]/$size[0]); switch($type){ case "png": $oimage = imagecreatefrompng($image); break; case "jpg": case "jpeg": $oimage = imagecreatefromjpeg($image); break; case "gif": $oimage = imagecreatefromgif($image); break; default: trigger_error("Invalid Image Type", E_USER_WARNING); break; } $nimage = imagecreatetruecolor( $max , $newheight ); imagecopyresampled($nimage,$oimage, 0,0, 0, 0, $max , $newheight, $size[0] , $size[1]); imagegif($nimage,$output,100); }else{ $type = trim(str_replace('image/',' ', image_type_to_mime_type($size[2]))); $newwidth = $max*($size[0]/$size[1]); switch($type){ case "png": $oimage = imagecreatefrompng($image); break; case "jpg": case "jpeg": $oimage = imagecreatefromjpeg($image); break; case "gif": $oimage = imagecreatefromgif($image); break; default: trigger_error("Invalid Image Type", E_USER_WARNING); break; } $nimage = imagecreatetruecolor( $newwidth , $max ); imagecopyresampled($nimage,$oimage, 0,0, 0, 0, $newwidth , $max , $size[0] , $size[1]); imagegif($nimage,$output,100); } } } where the $image is the beginning image and the $output is the new image to be generated
-
eval(the code to be executed);
-
you could use a session to hold a test key then on completion increment the key so that when they go back to the test page the keys wont match up and you can respond accordingly
-
Redirecting to thread a user has just submitted
ldb358 replied to andrew_biggart's topic in PHP Coding Help
a header cant be sent after any content has been printed add: ob_start(); what this does is it keeps the page from outputting content so add: ob_end_flush(); at the end of your page to display the contents of the page as normal(assuming there hasn't been a redirect) -
couldn't you use http://www.php.net/manual/en/function.imagecreate.php http://www.php.net/manual/en/function.imagecolorset.php to create a blank white image then use this: http://www.php.net/manual/en/function.imagecopyresampled.php to copy your original image on to the white image and center by changing the x and y values
-
i think just having: <?php $file = implode('', file ("post.xml")); echo $file; ?>
-
according to the manual (http://php.net/manual/en/function.simplexml-load-file.php) the function throw a warning for each xml error
-
i was think about charging 10 hour but then how should i charge for the stuff after the initial work
-
i have a client who wants a web site that would -include 2 public pages -a admin only section for mass email and web site updating i would also be in charge of finding a host(could use recommendations), purchasing the domains and maintaining the site i think that i could easy build this site but what is a fair amount to charge for this, they want an offer and are going to compare it to two other offers so it needs to be competitive and as this would be my first client i have no idea what is fair
-
Looking for suggestions as to how to do this..
ldb358 replied to Scooby08's topic in Application Design
yeah put something like "page is not current, one moment" on the top display the old data then make a php file that will give you the content to replace the body with, then replace all the content in the body tag when it is complete, as this could give them a general idea while they wait -
Looking for suggestions as to how to do this..
ldb358 replied to Scooby08's topic in Application Design
couldn't you feed them the data then have an iframe which triggers an update then when the update is complete use ajax to update the current page -
1) i use #1b just how ive always done it 2)i use #2b 3) i use #3a find it easier to read 4)i tend to use under scores as that's how i learned to code when my school taught me action script and it carried over to php
-
i dont think hes asking for the location of a cms but more wondering what cms best fits the purpose of a theater web site as for a recommendation i cant think of anything of the top of my head
-
use a session $_SESSION['value'] = $valuetobepassed; //then to access it $passedvalue = $_SESSION['value'];