Jump to content

datafan

Members
  • Posts

    54
  • Joined

  • Last visited

About datafan

  • Birthday 12/21/1963

Contact Methods

  • Website URL
    http://2strokeengine.net

Profile Information

  • Gender
    Male
  • Location
    Plainview MN

datafan's Achievements

Member

Member (2/5)

0

Reputation

  1. The example I put in my first post actually works? I need to step away from the keyboard for a while, been staring at this script for too long LOL Thanks for the help, and the sanity check :-)
  2. <?php $foo = "bar"; echo "$foo\n"; $kungfoo = '"$foo"'; echo "$kungfoo\n"; ?> I apologize, I should have clarified a bit better in my question. My variable $foo is already set without the quotes, and I need to add quotes to the existing $variable. The above code returns bar "$foo" and I need bar "bar"
  3. This may be a simple question but it's difficult to Google it. I need to take an existing variable and put double quotes around it. So I have: $foo = "bar"; echo $foo; bar I need: "bar" I have tried several variations of something like this: $foo = '"' . $foo . '"'; (those are single quotes around double quotes in this example) But everything I try seems to either throw a syntax type error or not do what I need. Any ideas? Thank You
  4. Is it possible that the ~ and - in the file names (example: 06-23~06-23c2800-500.txt) are messing up the other comparisons somehow? How can the $keyword clearly not match but yet that entire line is also removed from the flat file? These are computers, that is not suppose to happen :-)
  5. This script allows my users to delete reservations from a flat file by ignoring the lines that match certain variables when it re-writes the file. It works great except that if the reservations are similar it will delete them, even if all the variables don't match. I must be overlooking something, can you see it? Thanks for any suggestions. Reservation deletion script: <?php if ($_POST['submit']) { $file = 'flatfolder/masterflat.txt'; $newfile = 'flatfolder/masterflat.txt.bak'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } else { $delete_msg = "File copied successfully"; } $class_name = $_POST['class_name']; $classfilename = $_POST['classfilename']; $keyword = $_POST['keyword']; $filename = "flatfolder/masterflat.txt"; $file_array = file($filename); foreach ($file_array as $file_line) { $file_lines = explode("|", trim($file_line)); if ($file_lines[4] != $classfilename && $file_lines[6] != $keyword && $file_lines[7] != $class_name) { $new_file_array[] = implode("|", $file_lines); } } $open_file = fopen($filename, 'w'); flock ($open_file, LOCK_EX); fwrite($open_file, implode("\n", $new_file_array)."\n"); flock ($open_file, LOCK_UN); fclose($open_file); unlink("reservations/$classfilename"); echo "The reservation has been removed successfully.<br />"; } ?> Flat file example: 1210568400|c5|0800|1700|05-12~05-14c5800-500.txt|no_wall_moves|1003|COE LSS Class 1210654800|c5|0800|1700|05-12~05-14c5800-500.txt|no_wall_moves|1003|COE LSS Class 1210741200|c5|0800|1700|05-12~05-14c5800-500.txt|no_wall_moves|1003|COE LSS Class 1214197200|c3|0800|1700|06-23~06-23c3800-500.txt|no_wall_moves|1004|jim'a class 1214197200|c2|0800|1700|06-23~06-23c2800-500.txt|no_wall_moves|1005|jim'a class So if i fill out the form with ($classfilename)06-23~06-23c2800-500.txt ($keyword)1004 ($class_name)jim'a class It will delete both the "jim'a class" entries at the end even though one of them has ($keyword)1005
  6. I finally figured it out, it jumps out of the "root" shell to the "scminsta" shell and as soon as it's done running that particular command it jumps back into the "root" shell. Here is the solution: #!/bin/sh A bunch of stuff runs as ROOT, then: db2 "connect to jac user scminsta using password" su - scminsta -c db2 "force applications all" su - scminsta -c db2 "db2stop" su - scminsta -c db2 "db2start" db2 "backup database jac user scminsta using password to $TMP_DIR" >> $LOG 2>&1 su - scminsta -c db2 "force applications all" su - scminsta -c db2 "db2stop" su - scminsta -c db2 "db2start" su - scminsta -c db2 "quit" #Now some stuff runs as ROOT.
  7. ok, when I run this script and get to the db2 stuff, it works only for the two db2 commands that specify the user(scminsta) and password. On all the other db2 commands I get "ROOT " does not have the authority to perform the requested command. I am not sure how to say this, but how can I get the script to "stay" with the db2 user and not default back to root until the quit command runs? Thanks for any ideas even, I can't find any info on this. #A bunch of stuff runs as ROOT, then: . /home/scminsta/sqllib/db2profile #this sets an environment for the db2 user scminsta db2 "connect to jac user scminsta using password" #this line runs fine db2 "force applications all" #all the rest of these lines try to run as ROOT user and fail db2 "db2stop" db2 "db2start" db2 "backup database jac user scminsta using password to $TMP_DIR" #this line runs fine db2 "force applications all" db2 "db2stop force" db2 "db2start" db2 "quit" #Now some stuff runs as ROOT.
  8. I appreciate the insight and examples and yes the constructive criticism as well. "Perhaps you should read about web accessibility and the W3C Web Accessibility Initiative rather than making facetious comments." This is very true. I seem to always find myself in a position of learning something on the fly, hacking it together, and later learning how it works and what my mistakes were.
  9. ahh, ok. Examples please? I don't want to require the user to have javascript enabled, and I don't have control over what my web host has loaded on their server. Perhaps we should all go back to simple text pages? They load a lot faster and work on any browser.
  10. Why would someone have styles disabled? CSS is everywhere and I don't see it going away. There is a point where you have to decide, am I going to contunue to cater to the minority or make them upgrade their browsers with rest of the world.
  11. I am a newb to css so if you find a better way post it please... .roundcont { width: 100%; background-color: #f90; color: #fff; } .roundcont p { margin:10px 10px; } .roundtop { background: url(../images/tr.gif) no-repeat top right; } .roundbottom { background: url(../images/br.gif) no-repeat top right; } img.corner { width: 15px; height: 15px; border: none; display: block !important; }
  12. Something like this? http://www.tamstouch.com You can view the source, the .gif files are the 4 rounded corners, (2 are called in the external style sheet) it's the only way I know how to do it. I don't think there is a simple way. If you want the style sheet file let me know. I downloaded it from somwhere else on the web and have been tweaking it for different things. I am in the process of building another one here http://www.goodstylist.com/files/test/new_page_top.php And the "Check Out Our Top rated Stylists" pain in the middle of this page is also using the code mentioned above http://www.goodstylist.com/
  13. I am working on a css template for one of my websites. My question is, is there a better way do repeat these yellow buttons? Take a look here please http://www.goodstylist.com/files/test/new_page_top.php Yes it works but it seems awefull bulky if you know what I mean. I have been playing with it and seem to have trouble with the background image "yellow button" resizing to the width of the font. Here is the code: #leftcontent { position: absolute; left:0px; top:0px; width:150px; background-color:#000080; } #centercontent { position: relative; background-color:#000080; margin-left: 50%; left:-400px; margin-right:0px; width:800px; top: 5px; text-align: center; } #rightcontent { position: absolute; right:0px; top:0px; width:150px; background-color:#000080; border:0px; } #banner_center { position: relative; background-image: url(../siteimages/500X100BANNER.jpg); background-position: center center; background-repeat: no-repeat; height:100px; margin-left: 50%; left:-400px; margin-right:0px; width:800px; text-align: center; } #banner_left { position: absolute; left:0px; bottom:0px; background-image: url(../siteimages/150X100BIZAD.jpg); background-repeat: no-repeat; height:100px; width:150px; } #banner_right { position: absolute; right:0px; bottom:0px; background-image: url(../siteimages/150X100BIZAD.jpg); background-repeat: no-repeat; height:100px; width:150px; } body { background-color: #000080; } .yellow_button { position: relative; width:150px; height:30px; background-color: #000080; } .yellow_button a { position: absolute; width:150px; height:30px; top: 0px; left: 0px; background: url(../siteimages/yellowbutton.gif); background-repeat: no-repeat; text-align: center; font-size:20px; font-weight: 700; color: #000080; vertical-align: middle; } font { font-family: arial; } font.yellow_4 { color: yellow; font-size:20px; font-weight: 700; text-align: center; } font.logo { font-family: century gothic; font-size: 52px; font-weight: 700; color: #99ccff; } font.under_logo { font-size: 16px; font-weight: 700; color: #ffffff; } font.light { color: #99CCFF; } font.dark { color: #000080; } And the html: (div /div div /div div /div.... you get the picture...) <?php //goodstylist.com page_.php template by Jim Marquardt //Address error handling. Turn off after testing. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Hairstyles | Haircuts | Hair Cuts | Search | Stylists | Community | Salons</title> <LINK REL=STYLESHEET HREF="../test/newstyle.css" TYPE="text/css"> <META NAME="Description" CONTENT="Hair Stylists community with free profiles, nation wide search and client rating system."> <META NAME="Keywords" CONTENT="hairforum,hairstyles,hair,styles,clients,haircut,haircutting,hairstyling,forum,salons"> <META NAME="Language" CONTENT="en"> <META NAME="Robots" CONTENT="All"> </head> <body> <!--Begin banner across top of page 800w X 100h--> <div id="banner_center"> <div id="banner_left"> <br /><font size="3" color="red"><b>Business Ads</b></font><br /><font size="2" color="red">Premium Ad Spots<br /><a href="mailto:datafan@datafan.com">Contact Us Now </a></font> </div> <font class="logo">goodstylist.com</font> <br /> <font class="under_logo">The Place To Promote Yourself As A Stylist</font> <div id="banner_right"> <br /><font size="3" color="red"><b>Business Ads</b></font><br /><font size="2" color="red">Premium Ad Spots<br /><a href="mailto:datafan@datafan.com">Contact Us Now </a></font> </div> </div> <!--End banner across top of page--> <!--Start left colum...........YELLOW BUTTONS!--> <div id="centercontent"> <div id="leftcontent"> <font class="yellow_4">Client Services</font><br /> <div class="yellow_button"> <a href="http://www.goodstylist.com/files/search.php">Find A Stylist</a><br /> </div> <div class="yellow_button"> <a href="http://www.goodstylist.com/files/search.php">Another Link</a><br /> </div> <div class="yellow_button"> <a href="http://www.goodstylist.com/files/search.php">Another Link</a><br /> </div> <div class="yellow_button"> <a href="http://www.goodstylist.com/files/search.php">Another Link</a><br /> </div> <div class="yellow_button"> <a href="http://www.goodstylist.com/files/search.php">Another Link</a><br /> </div> </div> ok, is there content in the center as well? <div id="rightcontent"> <p> looking for content on this side as well</p> </div> </div> </body> </html>
  14. When I use the following delete reservation script it works perfect except it removes the \n newline character from the last line of my flat file. That screws up the next line to be written to the file. Any idea? I tried to add a \n and ended up with a empy file! yikes <?php if ($_POST['submit']) { $classname = $_POST['classname']; $keyword = $_POST['keyword']; $filename = "flatfolder/masterflat.txt"; $file_array = file($filename); foreach ($file_array as $file_line) { $file_line = explode("|", trim($file_line)); if ($file_line[4] != $classname && $file_line[6] != $keyword) { $new_file_array[] = implode("|", $file_line); } } $open_file = fopen($filename, 'w'); fwrite($open_file, implode("\n", $new_file_array)); fclose($open_file); unlink("reservations/$classname"); echo "The reservation has been removed successfully.<br />"; } ?> This is what I tried but no workie. fwrite($open_file, implode("\n", $new_file_array."\n"));
×
×
  • 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.