Jump to content

voip03

Members
  • Posts

    693
  • Joined

  • Last visited

Everything posted by voip03

  1. <?php if(isset($_POST['Submit'])) { $frontwidth = $_POST['fw']; $backwidth = $_POST['bw']; $firedepth = $_POST['fd']; $x = $frontwidth + $backwidth+ $firedepth; $y = ($x / 3) * .6667; $res1 = $y *2; echo $res1; echo $frontwidth; } ?> <div class="post"> <h2 class="title">Calculator</h2> <hr /> <form method="post" action="index.php"> Fireplace Front Width: <input type="text" name="fw"> <br /> Fireplace Back Width: <input type="text" name="bw"> <br />Fireplace Depth: <input type="text" name="fd"> <br /> <input type="submit" name="Submit" value="Submit"> </form> Pounds Of Glass Needed: <?php echo $res1; ?> </div>
  2. You need to move Pounds Of Glass Needed: <?php echo $res1; ?> to calculator2.php
  3. zero_ZX ! Can you kindly lets know , What are you trying to achieve?
  4. Switch Method <?php $status='complete'; switch ($status) { case 'placed': $background_color='red'; break; case processing: $background_color ='orange'; break; case 'complete': $background_color ='green'; break; } ?> <table width="100" border="1" cellspacing="0" cellpadding="0" bgcolor="<?php echo $background_color; ?>"> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>
  5. it like a leaving a front door open Try this code <?php session_start(); echo "<h3> PHP List All Session Variables</h3>"; foreach ($_SESSION as $key=>$val) echo $key." ".$val."<br/>"; ?> Now you know that why it is not advisable.
  6. Yes you can use username for session. Not password. if you google 'session hijacking php', you will get some knowladge.
  7. working <?php $status='placed'; if($status == 'placed'){$background_color='red';} if($status == 'processing'){$background_color ='orange';} if($status == 'complete'){$background_color ='green';} ?> <table width="100" border="1" cellspacing="0" cellpadding="0" bgcolor="<?php echo $background_color; ?>"> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>
  8. YOUR FULL CODE ( tested and it working) Main Page <?php /* "Warning: Cannot modify header information - headers already sent by " To avoid the header error , give value zero to $mosConfig_locale_debug = 0; $mosConfig_locale_use_gettext = 0; */ $mosConfig_locale_debug = 0; $mosConfig_locale_use_gettext = 0; ob_start(); /*This script can send an email and/or make an entry in a log file There are two variables below - one for an email address and one for a log file Set both variables to the values you want to use If you do not want either an email or log entry, comment out the respective line For example, if you do not want an email sent, put a // in front of the $emailAddress line - same for the $logFile line */ $logFile = $_SERVER['DOCUMENT_ROOT'].'/upload.log';// full path to your log $emailaddress = "email@gmail.com"; $home_page = "index.html"; // used for a link to return $uploaddir = "uploads/"; // the directory where files are to be uploaded - include the trailing slash $fileTypeArray = array(".jpg",".gif",".txt"); // enter in all lower case, the script will handle a match with upper case $maxSize = 500000; // maximum file size that can be uploaded - in bytes $maxFileSpace = 50000000; // maximum space that can be used by files matching the $fileTypeArray array in the upload directory - in bytes putenv('TZ=EST5EDT'); // eastern time// change nothing below this line $maxDisplay = $maxSize / 1000; ?> <html><head></head><body><div style="text-align: center; margin: 100px auto; border: 1px black solid; width:400px;"> <?php $file_name = $_FILES['file']['name']; $file_size = $_FILES['file']['size']; $file_tmp_name = $_FILES['file']['tmp_name']; if (!empty($file_name)) { unset($error); echo "<br>File Name: $file_name<br><br>"; echo "File Size: $file_size bytes<br><br>"; // file size test if ($file_size == 0 ) $error .= "<span style='color: red;'>Invalid file</span><br>"; if ($file_size > $maxSize ) $error .= "<span style='color: red;'>Your file exceeds $maxDisplay K.</span><br>"; // file type test if (!in_array(strtolower(strrchr($file_name,'.')),$fileTypeArray) ) $error .= "<span style='color: red;'>Your file is not a valid file type.</span><br>"; // max directory size test foreach(scandir($uploaddir) as $file_select) if (in_array(strtolower(strstr($file_select,'.')),$fileTypeArray)) $total_size = $total_size + filesize($uploaddir.$file_select); if (($total_size + $file_size) >= $maxFileSpace) $error .= "<span style='color: red;'>Total file space limits have been exceeded.</span><br>"; // scrub characters in the file name $file_name = stripslashes($file_name); $file_name = preg_replace("#[ ]#","_",$file_name); // change spaces to underscore $file_name = preg_replace('#[^()\.\-,\w]#','_',$file_name); //only parenthesis, underscore, letters, numbers, comma, hyphen, period - others to underscore $file_name = preg_replace('#(_)+#','_',$file_name); //eliminate duplicate underscore // check for file already exists if (file_exists($uploaddir.$file_name)) $error .= "<span style='color: red;'>File already exists.</span><br>"; // if all is valid, do the upload if (empty($error)) { if (move_uploaded_file($file_tmp_name,$uploaddir.$file_name)) { chmod($uploaddir.$file_name,0644); //echo "<span style='color: green;'>Your file was successfully uploaded!</span>"; /* 1st send the email confirmation to user 2nd redirect to display.php to show the image */ if (isset($emailAddress)) { $message = $file_name . " was uploaded by".$_SERVER['REMOTE_ADDR']."at".date('Y-m-d H:i:s'); mail($emailaddress,"You have a file upload",$message,"From: Website <>"); } if (isset($logFile)) { $logData = $file_name."||".$_SERVER['REMOTE_ADDR']."||".date('Y-m-d H:i:s')."\r\n"; @file_put_contents($logFile,$logData,FILE_APPEND|LOCK_EX); } ## redirect to display.php header("Location:display.php?imageName=".$file_name ); exit(); } else { echo "<span style='color: red;'>Your file could not be uploaded.</span>"; } } echo "$error<hr>";} ?> <p>Upload a <span style="color: blue;"> <?php foreach($fileTypeArray as $fileType) echo $fileType;?> </span> file to our server<br>Maximum file size is <?php echo $maxDisplay; ?>K</p> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data"> File: <input type="file" name="file" style="width: 250px;"><br> <input type="submit" name="submit" value="Upload File"> </form><a href="<?php echo $home_page; ?>">Return to the Home Page</a> display.php <?php // please validate the input $uploaddir = "uploads/"; // the directory where files are to be uploaded - include the trailing slash $file_name = $_GET['imageName']; echo "<img src='$uploaddir/$file_name' />"; ?>
  9. You can set the set timeout period then destroy the session.
  10. session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions. http://php.net/manual/en/book.session.php Basic PHP Sessions http://php.about.com/od/advancedphp/ss/php_sessions.htm session_destroy http://php.net/manual/en/function.session-destroy.php
  11. place this code top of codes. /* "Warning: Cannot modify header information - headers already sent by " To avoid the header error , give value zero to $mosConfig_locale_debug = 0; $mosConfig_locale_use_gettext = 0; */ $mosConfig_locale_debug = 0; $mosConfig_locale_use_gettext = 0; ob_start();
  12. <?php if (status == placed){$background_color ='red';} if (status == processing){$background_color ='orange'} if (status == complete){$background_color ='green'} ?> <table width="100" border="1" cellspacing="0" cellpadding="0" bgcolor="<?php echo $background_color; ?>"> also try with switch() statement
  13. header("Location:".$config_basedir ."display.php?imageName=".$file_name ); exit(); where is it?
  14. I have google it for you http://www.google.co.uk/#hl=en&sugexp=gsis%2Ci18n%3Dtrue&cp=41&gs_id=3c&xhr=t&q=date+difference+calculation+tutorials+php&pq=date+difference+calculation+tutorials&pf=p&sclient=psy&source=hp&pbx=1&oq=date+difference+calculation+tutorials+php&aq=f&aqi=&aql=&gs_sm=&gs_upl=&bav=on.2,or.r_gc.r_pw.&fp=a81c3c07a1872302&biw=1382&bih=720
  15. 1. User login 2. ? activate account – yes 3. Create the session 4. Go to main page 5. in the main page validate the session 6. If the validation failed go to sign /register page http://net.tutsplus.com/tutorials/php/user-membership-with-php/ Session Validation http://stackoverflow.com/questions/4959551/php-session-validation-best-practices
  16. Jquery Image and text slide show. http://www.gonetoosoon.org/ I would like to create slide show similar to this web page. As you can see the texts fades in and out of the image slides. I have seen so many examples but I am not able to figure out how I can do this. Can you give me some direction please? Thank you for your help.
  17. You can use switch statement http://php.net/manual/en/control-structures.switch.php
  18. Try google http://www.tizag.com/phpT/phpsessions.php http://www.freewebmasterhelp.com/tutorials/phpmysql
  19. http://stackoverflow.com/questions/1247950/how-to-remove-duplicated-2-dimension-array-in-php
  20. Your code should work.If You post the full code then we wll know the problem.
  21. It may help http://www.phpfreaks.com/forums/index.php?topic=343181.msg1619002#msg1619002
  22. After this code. echo "<span style='color: green;'>Your file was successfully uploaded!</span>"; Add new code echo "<span style='color: green;'>Your file was successfully uploaded!</span>";echo "<img src='$uploaddir.$file_name' />"; $config_basedir="http://www.XXX.com/"; header("Location:".$config_basedir ."display.php?imageName=".$file_name ); exit(); display.php <?php // please validate the input $uploaddir = "uploads/"; // the directory where files are to be uploaded - include the trailing slash $file_name = $_GET['imageName']; echo "<img src='$uploaddir.$file_name' />"; ?>
×
×
  • 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.