Jump to content

vchris

Members
  • Posts

    1,529
  • Joined

  • Last visited

Everything posted by vchris

  1. vchris

    Perl/CGI

    I run them through the command line and programmed it so it takes 2 arguments: first one is the file to convert (word file saved as web page) and second is the file converted (created by Perl). I downloaded activeperl which is offered free here:http://www.activestate.com/Products/ActivePerl/Also need to add the path to perl on your computer once you installed perl. Go in System Properties, Advanced Tab, Environment Variables. You shouldn't have a path for Perl in there so we'll add it. Click New. Enter this:Variable name: PATHVariable value: %PATH%;c:/perl/binThen you start programming. Go in your Command Line and go to your script then type Perl scriptname.pl and this will run your script. I'm still working on the scripting. Search and replace is complicated! You have a bunch of symbols /<*[]?. that mean something to perl but not to me . In the long run I'll save lots of time.
  2. vchris

    NAS

    Looks like an external HD but can also be used as a web server!!! you can run php/mysql, ftp server, runs on linux with 32mb of ram. I'm thinking of picking up one, finally a web server to develop on instead of my computer and storage for all my crap.http://www.tomsnetworking.com/2006/06/28/s..._nas/index.html
  3. vchris

    Perl/CGI

    That's true! I thought of that before, the only problem is php requires a webserver which I don't have at work. That's why I went with Perl, it can run on my computer, no need for a server.
  4. vchris

    Perl/CGI

    I found a perl coder at work :)I started working with perl to convert some docs and wow you could really save lots of time with this.He told me once someone had to convert lots and lots of excel tables into html tables and it would've taken months but with the script he wrote it took hours. Within a day he was done!!!Anyway I'm working on a script and it's nice.
  5. I agree with you The Praetorian, PC have the advantage on games. The thing is I plan to buy a modded xbox 1 for my games and a MAC for web development and all my multimedia (movies, music, photos...) The thing with a modded xbox is it can connect to the network and get your movies, music, photos and more off your computer, it can even connect to the net and browse and stuff... My buddy has a setup like that with his PC and xbox. But of course the xbox is by micro$oft so there's some bugs.
  6. If their price was lower, they would sell tons of them I think.
  7. No I haven't made my choice yet... Price is the biggest down side for me.Today one of the guys at work brought his mac mini he bought last week for ~1000$ CAN. It was pretty fast compared to WIN XP. It does pretty much the same as Windows but nicer. Unfortunately he didn't have Photoshop so we couldn't see how fast it works with graphics. I love the look and the included softwares. Another plus is the silence! No noise at all.I checked into setting it up as a media center but this would cost ~2000$ CAN. Mac mini + tv tuner + extra HD for mac (stack it's called). Getting expensive.Why so expensive? It's the same hardware as a PC isn't it?
  8. vchris

    Perl/CGI

    Now I only have a blank page.
  9. I'm thinking of getting a MAC. I've read on some forums that OS X is slow compared to Win XP but don't know if it's true?Gimme some pros and cons!!!
  10. vchris

    Perl/CGI

    Thanks I think I got it figured out.I am trying to search and replace a certain word which is PM 10 for PM<sub>10</sub> and here is the error I got: My code:#!/usr/bin/perlprint "Content-type: text/html\n\n";$string1 = "I love to eat apples all day. I can eat apples every day! Apples are yummy! PM 10";$string1 =~ s/PM 10/PM<sub>10</sub>/gi;print $string1; It doesn't seem to take html tags in there...
  11. vchris

    Perl/CGI

    At work I got a lot of search and replace to do from word files to coldfusion files. I was thinking of a way to speed up this process because I got over 500 pages to work with and it takes many days to complete the work. I was thinking of a perl/cgi script that would search and replace many words/codes which could be 75% of the work. I've seen perl/cgi before but how do I install it in IIS 5.1 so I can view them?
  12. Resolved. I just added some margins on the inner containers (header, content, footer...)
  13. I haven't tried but then that means that everything would have to be within span tags... Kinda makes the code dirty.
  14. I have this code for my container #container { width: 600px; margin: 0 auto; } So basically I have a centered container on my page which I want to add some margins into it so the text is not right against the borders.I tried with padding but this creates spaces outside the container and I no longer have my width of 600px. If I try margins then the container is no longer centered and is placed depending on the margins I specified. I don't understand why it's not working, I've done it before.Thanks for the help.
  15. Yes I do. Right here: if(!$_SESSION['linkid']){ //If linkid is not a session variable$_SESSION['linkid'] = $_REQUEST['linkid']; //Set session variable linkid to query string linkid$linkid = $_SESSION['linkid']; //Set session variable linkid to a $linkid}
  16. Everything is going well. I only have 1 problem and that's the edit.php page. First of all on the edit page I first do a check to make sure the linkid is in the query string so I can perform my select then I select the record where the linkids are equal and fill the form for the user. Let's say the user erases the sitename completely (form field). The form will not validate and will refresh but then the linkid will not be in the query string anymore and will then be forwarded to the acp.php page before being able to change the link. I tried a bit with the session but should I even do that? What is the best way to have this form work well?btw when the user has updated his link he is redirected to acp.php and when the form does not validate he should stay on the form edit.php. <?php //Start sessionsession_start(); ob_start(); if(isset($_SESSION['userid'])){ //Check if user is logged in if(isset($_POST['cancel'])){ //If user clicks cancel header("Location: acp.php"); //Redirect user to acp.php exit(); } if(!isset($_REQUEST['linkid'])){ //If linkid is not in the query string header("Location: acp.php"); exit(); } if(!$_SESSION['linkid']){ //If linkid is not a session variable $_SESSION['linkid'] = $_REQUEST['linkid']; //Set session variable linkid to query string linkid $linkid = $_SESSION['linkid']; //Set session variable linkid to a $linkid } include('../includes/mf/header.php'); //Include header?> <div class="fullcontent"> <h1>Edit Link</h1> <?php if (isset($_POST['edit'])) { //Check if form is submitted //Initialize error array $errors = array(); //Validate sitename if(empty($_POST['sitename'])){ $errors[] = "<p class=\"centerAlign\">Site name field is required.</p>"; } else { $sitename = trim($_POST['sitename']); } //Validate siteurl if(empty($_POST['siteurl'])){ $errors[] = "<p class=\"centerAlign\">Site URL field is required.</p>"; } else { $siteurl = trim($_POST['siteurl']); } //If everything is OK if(empty($errors)){ //Connect to database require_once('../includes/mysql_connect.php'); //Query the database $query2 = "UPDATE mf_links SET sitename = ".$_POST['sitename'].", siteurl = ".$_POST['siteurl']." WHERE linkid = ".$_SESSION['linkid']; //Run query $result2 = @mysql_query($query2); //Erase session variable linkid $_SESSION['linkid'] = NULL; //If it ran OK if($result2){ header("Location: acp.php"); exit(); } else { //If it didn't ran OK echo "<h3>Your link was not submitted due to a system error.</h3>"; echo "<p>" . mysql_error() . "<br><br>Query: " . $query2 . "</p>"; include('../includes/mf/footer.php'); exit(); } mysql_close(); } else { //Display the errors for($i=0 ; $i<sizeof($errors) ; $i++){ echo $errors[$i]; } } } //First query to fill text inputs in form require_once('../includes/mysql_connect.php'); $query1 = "SELECT linkid, sitename, siteurl FROM mf_links WHERE linkid = ".$_SESSION['linkid']; $result1 = @mysql_query($query1); if($result1) { while ($row = mysql_fetch_assoc($result1)){ ?> <form name="editlink" method="post" action="edit.php?linkid=<?php echo $linkid; ?>" class="form_addlink"> <div class="form_rowspacing"><label>Site Name</label> <input type="text" name="sitename" class="text_input" value="<?php echo $row['sitename']; ?>" /></div> <div class="form_rowspacing"><label>Site URL</label> http://<input type="text" name="siteurl" class="text_input" value="<?php echo $row['siteurl']; ?>" /></div> <hr /> <input type="submit" name="edit" value="Update" /> <input type="submit" name="cancel" value="Cancel" /> </form> <?php } mysql_free_result($result1); } else { echo "<h3>A system error occured.</h3>"; echo "<p>" . mysql_error() . "<br><br>Query:" . $query1 . "</p>"; include('../includes/mf/footer.php'); exit(); } mysql_close(); ?> </div><?php include("../includes/mf/footer.php");} else { //If user is not logged in header("Location: index.php"); exit();} ?>
  17. So there's no documentation on this?
  18. Hmmmmm... This is very interesting. I understand most of it but could you provide an example of a page where you use one of those functions so I understand better.
  19. I use mysql_connect.php to connect to the db instead of writing the script all the time. I should include more in there...
  20. WOW! very interesting :)Is there somewhere I could read about this way of programming with php? I'd like to know more.
  21. This $str = implode(",", $_POST['itemid']); will add commas between each value right?
  22. Should there be a php page to process the login different than this page?
×
×
  • Create New...