Jump to content

nadeemshafi9

Members
  • Posts

    1,245
  • Joined

  • Last visited

Posts posted by nadeemshafi9

  1. Original

    $tn = ereg_replace(" ", "_", $template_name);
    $tn = ereg_replace(".html", "", $tn);
    $tn = ereg_replace(".htm", "", $tn);
    
    $f = ereg_replace(" ", "_", $filesToAdd_v);
    $f = ereg_replace(".html", "", $f);
    $f = ereg_replace(".htm", "", $f);
    

     

    One-liner regular expressions

    $tn = preg_replace(array("/ /", "/\.html?/"), array("_", ""), $template_name);
    $f  = preg_replace(array("/ /", "/\.html?/"), array("_", ""), $filesToAdd_v);
    

     

    String replacements

    $tn = str_replace(array(" ", ".html", ".htm"), array("_", "", ""), $template_name);
    $f  = str_replace(array(" ", ".html", ".htm"), array("_", "", ""), $filesToAdd_v);
    

     

    One-liner

    list($tn, $f) = str_replace(array(" ", ".html", ".htm"), array("_", "", ""), array($template_name, $filesToAdd_v));
    

     

     

     

    dude thanks thats realy good

  2. yes i know that and i am trying my best to use preg but by reflex i use ereg, the thing is that i dont think the app will port into php 6 anyways so whats the point, but yes i do use preg instead now.

     

    Well, I think it boils down to habit more than anything else. Sticking with ereg relfex habits will come back to haunt you sooner or later (as sooner or later [most likely the latter], hosting providers will ditch PHP 5.x in favor of 6, once 5.x is old enough and falls out of favor [much like what's happening with PHP 4]). By future proofing your code now (getting into PCRE habits), you won't have to worry about the day your code breaks in the event your hosting provider switches to 6 and doesn't happen to include POSIX's extention.

     

    Or rephrased another way, sticking with PCRE, you can't go wrong.. but sticking with POSIX, something can go wrong down the line. Ultimately, it's your call.. just trying to encourage going the safer route is all.

     

    most of the systems i developed are large scale so they are sitting on in house custom built servers made just for them and they have there personal interface to the internet eg there own lines, they will be kept as legacy systems and code.

     

    i completely understand what your saying thogh, good practice is good practice.

  3. nadeem, I would ditch ereg as POSIX is technically depreciated as of PHP 5.3 and will not be included within the core as of 6. Using PCRE is the prefered regex flavor.

     

    yes i know that and i am trying my best to use preg but by reflex i use ereg, the thing is that i dont think the app will port into php 6 anyways so whats the point, but yes i do use preg instead now.

  4. try

     

    
    $name = $_SESSION['post']['name'];
    
    $content=<<<EOF
    
    <div id="main-container">
    
       <div id="form-container">
        <h1>Contact Form</h1>
        <h2>Why not drop us a line and we will get back to you!</h2>
        
        <form id="contact-form" name="contact-form" method="post" action="submit.php">
          <table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="15%"><label for="name">Name</label></td>
              <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="$name" /></td>
    
    OR
    
    <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="{$name}" /></td>
    
              <td width="15%" id="errOffset"> </td>
            </tr>
            <tr>
              <td><label for="email">Email</label></td>
              <td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
              <td> </td>
    

  5. Advanced JavaScript with Internet Explorer: Retrieving Networking Configuration Information - How to retrieve MAC address and other extended network information using JavaScript

     

    (Page 2 of 6 )

     

    Now, let us try to extend the previous sample by showing further information about the network adapters.  The entire code for the sample is as follows:

    <!DOCTYPE  HTML  PUBLIC  "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
          <head>
                <title></title>
                <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
                <meta name="vs_targetSchema" content="http://schemas.
    microsoft.com/intellisense/ie5">
                <script id="clientEventHandlersJS" language="javascript">
    <!--
    
    function Button1_onclick() {
          var locator = new ActiveXObject
    "WbemScripting.SWbemLocator");
          var service = locator.ConnectServer(".");
          var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
          var e = new Enumerator (properties);
          document.write("<table border=1>");
          dispHeading();
          for (;!e.atEnd();e.moveNext ())
          {
                var p = e.item ();
                document.write("<tr>");
                document.write("<td>" + p.Caption + "</td>");
                document.write("<td>" + p.IPFilterSecurityEnabled + "</td>");
                document.write("<td>" + p.IPPortSecurityEnabled + "</td>");
                document.write("<td>" + p.IPXAddress + "</td>");
                document.write("<td>" + p.IPXEnabled + "</td>");
                document.write("<td>" + p.IPXNetworkNumber + "</td>");
                document.write("<td>" + p.MACAddress + "</td>");
                document.write("<td>" + p.WINSPrimaryServer + "</td>");
                document.write("<td>" + p.WINSSecondaryServer + "</td>");
                document.write("</tr>");
          }
          document.write("</table>");
    }
    
    function dispHeading()
    {
          document.write("<thead>");
          document.write("<td>Caption</td>");
          document.write("<td>IPFilterSecurityEnabled</td>");
            document.write("<td>IPPortSecurityEnabled</td>");
            document.write("<td>IPXAddress</td>");
          document.write("<td>IPXEnabled</td>");
          document.write("<td>IPXNetworkNumber</td>");
          document.write("<td>MACAddress</td>");
          document.write("<td>WINSPrimaryServer</td>");
          document.write("<td>WINSSecondaryServer</td>");
          document.write("</thead>");
    }
    
    //-->
                </script>
          </head>
          <body>
                <INPUT id="Button1" type="button" value="Button" 
    name="Button1" language="javascript" onclick="return Button1_onclick()">
          </body>
    </html>
    

  6. var strComputer = ".";
    var objWMIService = GetObject("winmgmts:\\\\" + strComputer + "\\root\\cimv2");
    var e = new Enumerator(objWMIService.ExecQuery("Select * from Win32_NetworkAdapter","WQL",48));
    
    for (;!e.atEnd();e.moveNext())
    {	objItem = e.item();
    WScript.Echo ("MACAddress: " + objItem.MACAddress)
    }
    

  7. <html>

    <title>VLC Mozilla plugin test page</title>

    <body>

    <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"

        width="640"

        height="480"

        id="vlc">

    </embed>

    <script language="Javascript">

    <!--

    var vlc = document.getElementById("vlc");

    vlc.audio.toggleMute();

    !-->

    </script>

    </body>

    </html>

     

  8. You don't need to do the mammoth task by yourself. When I looked into this sometime back, there were commercial solutions available which could bundle everything together into an executable, not too sure if there are open-source/freeware alternatives.

     

    Anyway, I have figured that if you want a client-side executable as the end result, it would be better off to start coding in a client-side language like C/C++ or Java..

     

    welll put

  9. Hi !

    is it possible to protect my code of PHP?

    is it possible i can make an .exe program instead of giving script and it will run like a desktop app even user dont have php installed etc?

     

    Thanks for any idea  ::)

     

    ofcourse its possible, you would need to have an exe that when executed started the php service in a process sprouted from its self and then would also contain all the binary for php, the next ap would have to mimic the web server unless you can hook it up to apache local.

     

    This is a momouth task mate, you wont be able to do 30 or 40 years work in a couple of hours

     

    tbh its not worth it, your scripts are protected via unix permissions

  10.     * SRC: URL of resource to be embedded

        * WIDTH: width of area in which to show resource

        * HEIGHT: height of area in which to show resource

        * ALIGN: how text should flow around the picture

        * NAME: name of the embedded object

        * PLUGINSPAGE: where to get the plugin software

        * PLUGINURL: where to get the JAR archive for automatic installation

        * HIDDEN: if the object is visible or not

        * HREF: make this object a link

        * TARGET: frame to link to

     

     

    <EMBED

        SRC="/cgi-bin/whack.slack.cgi"

        HEIGHT=170 WIDTH=150

        PLUGINSPAGE="WhackSlackPlugin.html"

        >

     

     

    If the browser has not already prompted you to retrieve the plugin software, and if you have the type of browser which supports plugins, try clicking on the plugin space above.

     

    http://www.htmlcodetutorial.com/embeddedobjects/_EMBED_PLUGINSPAGE.html

     

  11. Do people still develop for ie6 ? i dont even develop for ie7, i used to for 1.5 years , the code gets messy with irrelevant fixes and hacks, your doing yourself bad. Peopel that dont have java script enabled or are using ie6 dont deserve to see your website.

  12. i don't think that's how it works, your operating system selects what player you will use.

     

    in order to do what your saying, you would need to have an (completely not worth it) object witch imports a downloaded player which has been installed automatically onto your system.

×
×
  • 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.