Jul 20, 2008

Some Php Functions Explaination Required

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Some Php Functions Explaination Required

itssami
Can some one please tell me what is the purpose of the following functions , although there's a little explaination with everyline but i cant understand, can some one exaplin it bit clearly and tell me that why it is needed in config.inc.php.. what is its purpose and will it work if i dont include these files in config.inc.php
thanks

QUOTE
### Url were Website has been installed, not '/' in end!
define('C_URL','http://www.test.com/Website');

### Internal path to Website directory
define('C_PATH','Z:/home/www.test.com/www/Website');

### Site Name
define('C_SNAME','MyWebsiteName');

Reply

jlhaslip
QUOTE(itssami @ Apr 2 2006, 08:25 AM) *

what is its purpose and will it work if i dont include these files in config.inc.php
thanks


A 'config' file is one which contains information about the 'set-up' or the 'configuration' used for the cript or application. In the file you reference, the config information has to do with the source of the files for the application and the paths to those files which will be required for the script to operate properly and see all the data it need to and direct the user to the correct spot as they select . Without seeing the exact script you are talking about, it is difficult to know exactly what these defined constants do, but a pretty good guess would be that , yes, they will be required for the script to be able to do what you want.
QUOTE

### Url were Website has been installed, not '/' in end!
define('C_URL','http://www.test.com/Website');

### Internal path to Website directory
define('C_PATH','Z:/home/www.test.com/www/Website');

### Site Name
define('C_SNAME','MyWebsiteName');

They are pretty much explained by the comments included with the defines, so no need to outline what they do here. Someplace in the script, they would be used to identify paths to files on the server and the Web address for the site. They are defined outside the actual script for several reasons. First of all, so that one file can be 'required' by all scripts on the site and the data only needs to be changed in one location. Secondly, the 'defined' values can't be altered by accident inside the script whereas regular variables can be changed by methods like assignment statements (='s), but defined constants can not be, so they are safer.
Thirdly, having these 'defines' available makes the script 'portable'. They can be installed anywhere in the file or folder structure of your site and not be concerned about referencing from the server root, since the path is declared in the config file.

So, to answer your question, I would have the config file set-up and required_once in each of the scripts which need them to assure there are no difficulties. Also, the 'C_URL' and C_PATH' are Windows references right now. In order to upload them and use on the trap17 server, you will have to change them to Apache/Linux references.

 

 

 


Reply

rvalkass
I presume you are installing a forum or suchlike? This information is needed to allow the pages to call other scripts, save information in other files and stuff like that. For the first one enter your web address, where the script is stored. For example [colour=blue]http://www.username.trap17.com/Website[/color]. The next one is mainly used for accessing files, and you can get it from looking in cPanel. The last one looks like it should just be the 'friendly' name for your site. Try looking in the installation help files for more information.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php functions explaination required

  1. Functions - ??? (7)
  2. Script Help Required: Undefined Variable - A fault I cannot spot in PHP (3)
    Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
    in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
    variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
    yes, I get it twice). The code related to the variable is as follows: CODE function
    LogString($string,$type)     {         $t_log = "\n";
            $t_log .=
    $this->globaldata->server_vars['REMOTE_ADDR']."...
  3. Wappy's Php Snippets - I will place here usefull php snippets and functions that i learn/use (13)
    Here is a function you can use to generate a simple random password for whatever use ;-) CODE
    <? function rand_pass($numchar){ $string = str_shuffle
    ("abcdefghijklmnopqrstuvwxyz1234567890"); $password = substr ($string,
    1, $numchar); return ($password); } //example echo
    rand_pass('8'); // will return an 8 character long random password of numbers and
    letters like c8k4ss42 ?> CODE tags added. Here is an extremly usefull search function
    that will search a directory and...
  4. Making Sure They Did Not Leave Any Required Fields Blank - (3)
    how to make sure they did not leave any required fields blank? CODE <?php
        include("config/config.inc.php");
        include("config/dbcon.php");     include("checksession.php");
                 if(isset($_POST['action'])){         $gname =
    $_POST['gname'];         $gemail = $_POST['mail'];
            $gmsg = $_POST['gmsg'];         $date =
    date("m.d.y"); $sql = "insert into tblg...
  5. Php Email Validation - A PHP data validation class with many functions (1)
    I've been reading through my old php book (PHP 4.1) and came across this data validation class.
    It can check a number of things ranging from telephone numbers , credit card number formats, email
    address and some others. I checked out some of the methods although I didnt expect it to work 100%
    because I've found source code errors thoughout the book and CD. I tested out a few of the
    methods to check and some of them did return expected results but some didnt either so the data
    validation class was not perfect and it didnt really bother me. The cool thing I found...
  6. Php Functions To Send Mail - (4)
    Which other methods to send mail from a form? I just know mail function, like: mail(string to,
    string subject, string message) Has anyother?...
  7. Arrays Outside A Function - Need to have arrays available to all functions. (3)
    I've got a bunch of arrays that i want to use for more then 1 function. when i declear the
    arrays outside a function i cant use it in a function. This code was originally written in
    javascript by another person but since I plan to use it and extend it with php I had to change it
    from javascript to php code. In the javascript code the arrays were decleared outside the functions
    with 'var arrayname' I read somewhere that declearing javascript variables with
    'var' gives it global access. Any ideas on how I can go about declearing 1 set of these
    arrays t...
  8. What Coding Languages Are Required? - (5)
    I want to add a feature in my website so that users can make a professional -looking resume-like web
    page. It will be like a form based series of questions that visitor ll need to answer.Based on this
    a webpage as prescribed in pre-defined template ll be created .I want to know to do this what
    languages are used? I want some suggestion regarding this.My site is currently on Joomla platform.
    thanks in advance...
  9. Encrypt Functions - (0)
    Here is my 3rd Code: By this code you can encrypt your text: CODE <?php $a =
    md5("hello"); $b = base64_encode("hello"); $c =
    base64_decode("hello"); print "md5 = ".$a." base64_encode =
    ".$b." base64_decode = ".$c; ?> EASY!...
  10. [php](simple) Using Functions To Combine Values In A Form - Really simple example on how to combine values with function (2)
    I just learned this simple method on how to use functions to combine two values from a form. First
    we create ourselves a simple POST form CODE <form method="POST"> Name:
    <input type="text" name="nickname"> Location: <input
    type="text" name="location"> <input type="submit"
    value="Input"> </form> Now we add this php to that same file CODE
    <?php $nick = $_POST['nickname']; $location =
    $_POST['location' ...
  11. How To Delete A Row In Mysql. - A very simple help required (4)
    Im using the following code, for very simple work.. it simply gets and print the comments which are
    stored in the database. Now it will show like comment 1. comment 2. comment 3. etc etc i want to
    add 'delete' option that i can delete any comment. it displays like comment 1.
    Delete comment 2. Delete comment 3. Delete
    So that when i click on delete, it simply deletes the comment and print the remaining comments. Its
    very simple. i hope you understand. QUOTE $result = mysql_query("sele...
  12. Files Required? - (5)
    I want to learn php and I am already on the first steps to doing it. I have set up my server using
    easyPHP as well as XAMPP which is a package containing FileZilla, Apache and MySQL. Other than
    easyPHP, XAMPP and MySQL, what other softwares are required to be set up for me to successfully
    learn how to program with PHP?...
  13. Gd Functions - Questions (2)
    Hi all I want begin a new project , my new project is Photo blog ( weblog and image album ) in one
    script for example you can post many image in one post at once case . so its very good and very easy
    but we have some problems . if you can plz help me to fix this problems for example : we need
    change image size for page speed ( we dont want show 16 image in one page ) * we need GD functions
    to change image size to smaller and then show smaller image at page if you know source or tutorial
    about change image size plz post here . thankx we know we can change image size (w...
  14. Php Code Fix Required - URGENT (3)
    I am running a Web Chat and need to get this to display the User IP to them, but this code isnt
    working. CODE <PARAM NAME="welcomemessage" VALUE="<?php
    echo  $_SERVER['REMOTE_SERVER'];" has been logged. Chat powered by
    GCN"> Any help would be extremly grateful. Thank you Inserted the code in CODES tag ...
  15. Globals Inside Functions - (4)
    I've got the following function, that has a function inside of it, when I run it I get the
    followin error: PHP Code: CODE Fatal error: Call to a member function on a non-object in
    See the code below where I get the error message. I'm guessing the scope of my varaibles is
    messed up, but I'm not sure how to fix it. I've abbreviated the code so as to make it easier
    to read. PHP Code: CODE function getMemberRegistrationForm( &$tpl, &$db ) {
       function displayRegistrationForm( $action, &$db, $defaults =...
  16. Personal Blog - [ Database Required ] (4)
    Okay, after a week, I have successfully created a personal web blog. I first created it using a flat
    text file, I but realized that it was just too limited like that. So, I redid it in a
    database-compatible manner. NOTES: CODE - This blog does not support comments yet. If you
    want, you can build  on this script by creating a comment system as well. I may also    update it
    with a comment system in the future. - You should have an average to intermediate knowledge of
    MySQL    commands and database manipulation in general, especially if you    want to add a ...
  17. Using The Image Editing Functions Of Php - Specifically, lines or regular polygons. (4)
    I've been experimenting a little with PHP's image functions and I was trying to see if I
    could make something that looked 3D, so I started with a cube because it's simple. To make an
    isometric picture of a cube, you need to start with a regular hexagon. However, making a regular
    hexagon isn't the easiest thing. Is there a function to create a regular polygon, or specify an
    angle and magnitude for a vector?...
  18. Writing Your Own Functions In Php - how do i write php functions that takes arguments in php? (2)
    I'll set up the background for the question: I have a separate file that I include on all the
    webpages on my site which I call with PHP using the include() function, so everything will be much
    easier to maintain and update. Well, I have three include files for each page: header.php (includes
    stuff like meta tags, googlebot/spider info), footer.php (the footer/copyright thing), leftnav.php
    (includes the navigation bar). I also like the titles of my pages to be as descriptive as possible
    so I try to include the path of a page (how the user got to that page: "Excite Y...
  19. Confused... - some php functions that i am confused (5)
    First of all, if you have answers to the following QUOTE
    http://www.trap17.com/forums/A-Lot-Of-Php-...ions-t7653.html
    http://www.trap17.com/forums/A-Lot-Of-Html...ions-t7651.html Feel free to answer them all. Now,
    in PHP i know there's microtime, srand, float, array_rand, arrays, foreach, or any other loop
    functions. i'm really confused . Please help me!...
  20. Chatbox / Guestbook - No Database required (2)
    Okay, this is a simple script that lets your visitors enter in messages via a chatbox/guestbook. You
    can use this how you like. Adjust it if need be. It's very simple, so there is much room for
    improvement. Enjoy! CODE echo "<form action='chatbox.php'
    method='get'>"; echo "Name: <input type='text'
    name='visName' size=15><br>"; echo "Message: <input
    type='text' name='message' size = 15><br>"; echo "<input
    type='submit' value...



Looking for php, functions, explaination, required

Searching Video's for php, functions, explaination, required
advertisement



Some Php Functions Explaination Required



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE