Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

Everything posted by severndigital

  1. ok .. I am now having another problem. my sessions aren't holding. I have an index page that uses a switch with the sesssion_start(); as the first line. //start the session session_start(); //define includes include_once('lib/connect_db.php'); include_once('func/system.func.php'); include_once('class/system.class.php'); include_once('func/session.func.php'); //start main index.php switch switch($_GET['view']){ ## case 'login': $doLogin = doLogin(); if($doLogin[0] == 0){ $error = $doLogin[2]; $mainContent = $doLogin[3]; }else if($doLogin[0] == 1){ $regSessions = registerSessions($item=$doLogin); $mainContent = $doLogin[8]; } break; ## case 'campaign': $mainContent = 'camps/newcamp.php'; break; ## case 'logout': //$destroy = destroyAll(); $error = '<span class="error">You have been logged out.</span>'; $mainContent = 'forms/login.php'; break; } include_once('template.php'); when I login it .. i get all my sessions and they are registered. as soon as I navigate away from the login case and goto anything, in this chunk of code the campaign case, I loose all my sessions any ideas?? thanks chris *******EDIT ************ sorry for the DUP post. i got a MySQL error from the site.
  2. Ahhh .. yeah .. that solved the duplicate problems.. thank you.
  3. it still displays duplicates of the sessions Array ( [0] => [0] => 0 [1] => [1] => 1 [2] => [2] => 2 [3] => [3] => 3 [4] => [4] => 4 )
  4. I have two things happening .. when the user logsin .. I am registering sessions automatically with this code $item = array($var1,$var2,$var3,$var4); function registerSessions($item){ foreach($item as $key => $val){ session_register("$key"); $_SESSION["$key"] = $val; } }//END registerSessions this loads sessions that when I echo all the sessions I get duplicates. foreach($_SESSION as $key => $val){ echo "This is session: $key value = $val<BR>"; } returns this: This is session: 0 value = This is session: 0 value = 0 This is session: 1 value = This is session: 1 value = 1 This is session: 2 value = This is session: 2 value = 2 This is session: 3 value = This is session: 3 value = 3 This is session: 4 value = This is session: 4 value = 4 Why is it showing the session twice?? The rest of my code is only pulling the first session .. so if session[0] is empty .. nothing happens. when I navigate to another page and run the same foreach statement. I only get this This is session: 0 value = The session is registered because the number is there session[0]. but it has no value. any ideas?? thanks, chris
  5. Nice .. thanks. $50 isn't that bad, plus it has a trial. I'll give it a shot .. I just hate to pay $500 for software I will only use 10% of. Visio is great, but i don't need all the bells and whistles. Thanks again. chris
  6. not really sure you can do this with php as it is a server side language. you would need access to the other websites back end. you might be able to accomplish something with Javascript as it is a client side language. Not to sure about the security of it though, and there are alot of variables that come into play. i.e. the name of the text field in the form would have to match that of yours. etc.. Interesting little script though, if you can get it working.
  7. Anyone know of a freeware db design software, kind of like the DB workflow stuff found in Visio? thanks, chris
  8. http://us2.php.net/manual/en/ref.mail.php the first example at the bottom shows you how to do it. It is rather complicated using the mail() func IMO. I switched to PHPMailer a few years ago. Soooooo much easier. http://phpmailer.sourceforge.net/
  9. i've had to deal with this problem several times so I wrote a function to handle it. $datetoparse = '21/11/2007'; function parseDate($datetoparse){ $edate = explode("/",$datetoparse); //explodes the date into sections $month = $e[1]; $day = $e[0]; $year = $e[2]; //now put it back together in the format you want. $result = "$year-$month-$day"; return $result; } the function should return this .. 2007-11-21 That should do it, you can switch around result to accommodate your format in the database. you can add some validators if you want like .. if($month is > 12){ echo 'some error code here'; } This would keep them from inputing the date the in wrong format.
  10. not sure what you mean?? for use with other what?? chris
  11. Why can't people read the posts before they respond. GD gets tricky when using more than one image. This is how I worked it. This code is pulled from a working script of mine, so some the variables are calling Mysql References. //apply the logo to the base img //set base image $background_file = 'location\to\background\file.png'; //set logo file $source_file = 'images/dimgs/' . $gLogo['logo'] . ''; /* Load a source image and a background */ $iSource = imagecreatefrompng($source_file); $iBackground = imagecreatefrompng($background_file); //resize the overlaid image. $orig_imgsize = getimagesize($source_file); $orig_width = $orig_imgsize['0']; $orig_height = $orig_imgsize['1']; $orig_width = $orig_imgsize['0']; $orig_height = $orig_imgsize['1']; //to resize proportionatley, we must calculate reduction percentage. $final_height = 45; //this is a fixed number //get percentage of original width $perc = $final_height / $orig_height; // use perc to calculate height $final_width = $orig_width * $perc; $img_n = imagecreatetruecolor($final_width,$final_height); $iSourceR = imagecopyresized ($img_n,$iSource,0,0,0,0,$final_width,$final_height,$orig_width,$orig_height); $iMarginW = 5; //$iMaringH = 50; ImagePng($img_n,"images/source.png"); //now we can call this image if it exists. if not we call the default blank template. like i said it GD can get a bit confusing, but it gets the job done. That should get you started at least. wait until you try to apply a text based watermark to a picture within another pic. It take about another 50 lines of code hope this helps, Chris
  12. basically I want to transfer a file from the client to the server. I wanted to use some type of encryption to deter packet sniffers. I also wanted to bypass the need for an SSL key and keep the user at the http:// instead of https:// We use SCP to transfer between servers, I was hope to incorporate the same security into the client/server model. I was hoping for a prewritten ajax and or PHP class/function that would handle this. thanks, chris
  13. Any ideas where to start on this?? I basically want to be able to encrypt a file before transmission and then send it securely then decrypt it on the other side. thanks, Chris
  14. i use this script currently. it's javascript but when you call it, it will display the current server time. <script type="text/javascript"> // Current Server Time script (SSI or PHP)- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use. //Depending on whether your page supports SSI (.shtml) or PHP (.php), UNCOMMENT the line below your page supports and COMMENT the one it does not: //Default is that SSI method is uncommented, and PHP is commented: //var currenttime = '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' //SSI method of getting server date var currenttime = '<?php print date("F d, Y g:i:s", time())?>' //PHP method of getting server date ///////////Stop editting here///////////////////////////////// var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var serverdate=new Date(currenttime) function padlength(what){ var output=(what.toString().length==1)? "0"+what : what return output } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) //document.getElementById("servertime").innerHTML=datestring+" "+timestring document.getElementById("serverdate").innerHTML=datestring document.getElementById("servertime").innerHTML=timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script> to call it use <span class="servertime" id="servertime"></span> that has served me well to date. Chris the pic attached is how I have it formatted for my use. [attachment deleted by admin]
  15. I assumed as much, but I was hoping. I will poke around, maybe there is a premade ajax script that will handle this. thanks, chris
  16. it will take quite a bit of coding, but it can be done with the ImageMagik library. I have done something similar to auto convert to .png file in the past using GD image lib, but it does not support Tif files. you will need to examine the tif file for size and create a new jpeg image with those demensions, then apply the tif file to the new jpg and save out.
  17. you could do something like this, my first attempt anyway $string = "blab blab some useless html tags here <strong>Downloads:</strong> 1,826 </p> and some other "; $var = explode(":",$string); //this will split the string into two pieces. $downloads = substr($var[1],9,4); //go out 9 chars and take the next 4 question, how are you getting the download count initially? can the grab be done prior to display?
  18. if i am understanding your post correctly you should be able to get what you need from the preg_replace command http://us3.php.net/manual/en/function.preg-replace.php basically just search the string for what you are looking for and return a whitespace. but you might run into some problems with the content between the [image][/image] tags. hmmm... now that i think about it, seems like a job for a custom class or function. see what we can come up with
  19. Anyone know if this is possible? basically I want to allow for a file upload but encrypt the data much like SCP but through the PHP script? I've look through some of the php.net functions but it only seems to cover encrypting text like through an md5() command and things like that. Thanks, Chris
  20. NICE!!! ;D I knew there had to be a way. thanks, chris
  21. that will only accommodate one user name. note the etc. at the end of the statement.
  22. I need to know what day of the week the date 2007-11-25 is on (monday, tuesday, wednesday etc...)
  23. that would be totally excellent if i need to get the DATE. I need to know what day of the week, that particular date falls on. please read the posts before responding to them.
  24. i would define an array of usernames you don't want to log in prior to any of the if statments and then just add another else at the end of your script like this $disallow = array("username1","username2","username3"); //then add something like this within your if/else else if(in_array($disallow)){ //the code that generates the error message or whatever } It's probably not the most robust way, but it should get the job done. http://us2.php.net/manual/en/function.in-array.php //the link to the function at php.net
  25. I would like to find out what day of the week a certain date falls on. i know the command for doing it for today. $today = date("w"); anyone know how to do it for a variable date? like say 2007-11-25 I can't seem to find that. I can write some whacked out function to it. But i was hoping for an easier way. thanks, chris
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.