Jump to content

Search the Community

Showing results for tags 'PHP'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 988 results

  1. dalawh

    Writing into a file

    I was wondering if there was any way to set a file to write to beginning? It seems I am only allowed to do one or the other. Is there an alternative to this?
  2. sunziun

    PHP Min Max

    Hello Everyone, right now I am trying to do an small app that can calculate fees based on the price a user has given. Example: $0.01 - $0.99 = $0.09$1 - $5.99 = $0.13$99 or more = $1.34 So far I have this code but I cannot get it to work properly: if($start < 1.00){ echo "<p>" . $ins_fees[0] . $sym . $ins_fees[1] . "</p>"; // FURTHER CALCULATION } if($start == 1.00){ echo "<p>" . $ins_fees[0] . $sym . $ins_fees[2] . "</p>"; // FURTHER CALCULATION } else{ if($start > 1){ echo "<p>" . $ins_fees[0] . $sym . $ins_fees[2] . "</p>"; // FURTHER CALCULATION } } thanks for everyone!
  3. I would like to use PHP to put a vertical space on a web page. echo "<br \><br \><br \><br \>"; works fine on FireFox but probably breaks several rules in relation to strict xhtml and may not work as well on other browsers. Is there are more standard/correct/robust way of doing this? Thanks,Peter.
  4. Hello there, I have developed this piece of php/html code, for my custom Wordpress theme. <?php get_header(); ?><div class="layout clearfix"> <div id="content"> <?php if (have_posts()) : ?> <div id="loops-wrapper" class="left"> <?php while (have_posts()) : the_post(); ?> <div id="article-<?php the_id(); ?>" class="article clearfix"> <div class="post-others-wrap"> <p class="categories"><?php the_category('<br />'); ?></p> <div class="khmedia-social"> <p class='st_facebook_vcount' displayText='Facebook'></p> <p class='st_twitter_vcount' displayText='Tweet'></p> <p class='st_email_vcount' displayText='Email'></p> </div> </div> <div class="post-date-wrap"> <p class="post-date"> <span class="day"><?php the_time('d'); ?></span> <span class="month"><?php the_time('M'); ?></span> <span class="year"><?php the_time('Y'); ?></span> </p> </div> <div id="article-title-<?php the_id(); ?>" class="post-title"> <h1> <?php echo the_title(); ?> </h1> <div id="article-excerpt-<?php the_id(); ?>" class="post-content"> <?php wp_link_pages( array( 'before' => '<div class="pages">'.'पृष्ठ:', 'after' => '</div>' ) ); ?> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="pages">'.'पृष्ठ:', 'after' => '</div>' ) ); ?> </div> </div> </div> <?php endwhile; ?> <div id="pagelinks" class="clearfix"> <?php previous_post_link('<div class="prevlink">%link</div>'); ?> <?php next_post_link('<div class="nextlink">%link</div>'); ?> </div> </div> <?php endif; ?> </div> <div class="sidebar"> <?php if ( is_active_sidebar( 'primary' ) ) : dynamic_sidebar( 'primary' ); endif; ?> </div></div><?php get_footer(); ?> And now here is the CSS for it: .layout { display: block; margin-top: 3em; width: 100%;} #content { line-height: 1.5em; width: 697px; float: left; padding-right: 30px; position: relative; min-height: 300px;} .clearfix { clear: both; content: " "; display: block; line-height: 0; visibility: inherit;} #loops-wrapper { display: block;} #loops-wrapper .article { padding-left: 122px; width: 600px; margin-bottom: 50px; min-height: 150px; display: block; position: relative;} #loops-wrapper .article .post-others-wrap { left: 0; display: block; position: absolute; width: 100px; margin: 55px 0 0; text-align: right; line-height: 1.5em;} #loops-wrapper .article .post-others-wrap .khmedia-social { display: block; border-top: 2px solid #8AE234; border-bottom: 2px solid #8ae234; padding: 0 0 5px; margin-top: 20px;} #loops-wrapper .article .post-others-wrap .categories { color: black; position: relative;} Actually, the main content area is expanding with large data. But, when I insert a simple post with only the title. The div is overlapping with the footer.Here is my site link: http://www.khmedia.in Please help guys...
  5. yoyo w3s...a question is needed to be answered... i have lately readed a little on to cakePHP... but i would like to know, if any in here think its better then normal PHP. and if so, then can anyone help me a little here?... because im trying to build up a design in it, so that an another coder from my mentor team online at ''World Wide Web'' ^^', can code the functionality to it... ideas?...and yes, i have downloaded latest version, just how to use it... i have tried to build up the simple blog at their main website, but it was a ###### without equal... that is why im asking here, when i now did not got my question in that tutorial answered... so... please answer ^^'...
  6. I been trying ti figure this out for a few hours now and I can't seem to figure it out. Hopefully, someone will be able to solve my dilemma. The error I get is "Fatal error: Cannot redeclare getDate() in C:\xampp\htdocs\dalawh\date.php on line 4" test.php <?phprequire 'date.php';$data=$last.' | '.$first.' | '.getDate().' | '.$_SERVER['SCRIPT_FILENAME'];echo $data;?> date.php <?phpfunction getDate(){echo date("l, M j, Y g:i:s A T");}?> When I comment out "require 'date.php'", everything works fine, but of course getDate() returns nothing. So I figured it had to do with that line. I thought it may have been the echo in date.php, so I tried return, but I still got the same error.
  7. When I am coding in a php file (.php extension), is it better to reduce the php area to as small as possible (like in the first case) or does it not matter (like the second case)? <html><body><?php//Some php code?></body></html> OR <?php<html><body>//Some php code</body></html>?>
  8. I know that require give an error and include gives warnings when something goes wrong. I assume require is used for something that you want on the page like a navigation bar or something that appears on multiple pages that doesn't change. I am trying to use include to use a function in another php file, but it seems it only works if I use all the functions in that php page. Is there any way to only use some of the functions and not all? Also, the once means it only shows up once, so any repeats will not show up. Does this apply to each page or the whole site altogether?
  9. dalawh


    I am using an if and else statement. it will display the index.php if the cookies are set and it will display the other.php if the cookies are not set. I have been using the header function to redirect. instead of using require/include to display the page. Is there a better way to redirect the pages or is the header the best way?
  10. dalawh


    I was wondering how sessions worked and how similar are they to cookies. Is there a set indexes for sessions or do you define your own? How do sessions look like? Are they like cookies, where each cookie is like a file with a bunch of variables? Where are the sessions stored?
  11. iam faceing problem in installing SquirrelMail in localhost. please help me...
  12. dalawh

    Visitor IP

    I did a few searches and I found that though $_SERVER['REMOTE_ADDR'] gets you the IP of a visistor, it is not always accurate because they could be hiding behind a proxy. I read that it was good to check $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] to see if they contained value and if they did, it meant that they were behind a proxy, so it was better to use $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] instead of $_SERVER['REMOTE_ADDR']. Now my question is whether $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] where the same or not. If not, what is the difference between them? I also read that $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not always accurate because of the fact that the header could be spoofed. I tested this and it seems that the few proxies I used, the $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not able to detect that it was behind a proxy. My question now is if there was a more accurate way to track an IP as opposed to this? I also want to know if there was any way to track the original IP of someone using a VPN or VPS?
  13. I installed wamp on my windows machine and when i tried to open localhost on my browser i received the message."you dont have permission to access / on this server." I searched this on the internet and got to know that there is problem with file and folder permissions.I shoulls change it to 644 and 755.But can you help me on how to change the permmissions.
  14. sonu

    PHP Redirect

    Hi,Friends I need small help.I know it is not an big issue for PHP Experts.I need a redirect code like the example below:If user tries to visit www.domain.com/page1.php then it should redirect to home page means index.phpI need to redirect only 1 particular page not all pages.I will insert this code in index.php .Then,if user tries to visit page1.php then it should be redirected to page2.php .But,the code should redirect only if user trying to access page1.Thanks in Advance! Help me Guys.
  15. <form name="form" action="enter.php" method="post"> First Name: <input type="text" name="first" /><br /> Last Name: <input type="text" name="last" /><br /> <input type="checkbox" name="c1" value="1" onclick="showSubmit()" /> <input type="checkbox" name="c1" value="1" onclick="showSubmit()" /> <input type="checkbox" name="c3" value="1" onclick="showSubmit()" /> <!-- SUBMIT BUTTON HERE --> </form> If I only check the 1st and the 3rd checkbox and press the submit button, but in my enter.php, I made it check print out each of the inputs like so: <?php echo $_POST["first"];echo $_POST["last"];echo $_POST["c1"]; echo $_POST["c2"]; echo $_POST["c3"];?> I will get a warning/error claiming that the c2 is undefined. Is there a built in function that checks if something is undefined ? That way I can use a if and else statement: if is it undefined, it will print something, and if it is checked (defined), make it print something else.
  16. What is the difference between using the directory functions to change the directory and opening file as opposed to just opening the file straight? I am not sure if you can open a file in a different directory by using the directory function or not, so correct me if it is not possible. chdir("info/");$fileName="info.txt";$file=fopen($fileName,"r+"); VS $directory="info/";$fileName="info.txt";$file=fopen($directory.$fileName,"r+"); If we use the first, how do we change back to the previous directory? If both is possible, which is the better method? Outside of opening files, which is better? Using strings or directory functions?
  17. dalawh


    I notice that you can check if a cookie is set or retrieve the information if you knew the name, but what happens if the name was dynamic (changing for each person)? Is there no way to retrieve it? Should the name always be dynamic?
  18. dmallia

    content script

    I would like to do a script that includes content from pages according what the user chooses. Example If the users chooses Contact us from the menu I would like to have the index page displayed with the contact us content( www.website.com/index.php?page=contact-us ). I know it is done by GET requests but don't know how to do it or what is it called. Does anyone have a script or a tutorial on how to do it? Or at lest what is it called so I find a tutorial. Thanks before hand.
  19. Could some of you tell me the basic protection that PHP & MySQL website needs. For example new stuff to me was SQL injection. Q: How to prevent website from SQL injection?Q: What other protection websites require than SQL injection protect? I know that the password should be crypted but somehow i think its not enough or is it?
  20. Hello, I am currently trying to take an html form with array entry, then store these array's into $_SESSION. Please help. The code is listed below. This is the form: <form method="post" action="system/processor/ac36e5fbdefed15a4daf3d7008723c87.php"> <p><table cellpadding=5 cellspacing=5 rules=none width="100%"> <tr> <th>Date</th> <th> </th> <th> </th> <th>Start Time</th> <th>End Time</th> </tr> <?php session_start(); $i = 1; while($i <= "$_SESSION[amt_dates]") { echo("<tr>"); echo("<td><select name=\"month[]\"> <option value=\"01\">January</option> <option value=\"02\">Febuary</option> <option value=\"03\">March</option> <option value=\"04\">April</option> <option value=\"05\">May</option> <option value=\"06\">June</option> <option value=\"07\">July</option> <option value=\"08\">August</option> <option value=\"09\">September</option> <option value=\"10\">October</option> <option value=\"11\">November</option> <option value=\"12\">December</option> </select></td>"); echo("<td><select name=\"day[]\">"); $h=1; while($h <= 31) { echo("<option value=\"$h\">$h</option>"); $h++; } echo("</select></td>"); echo("<td><select name=\"year[]\">"); $e= date(Y) + 10; $u = date(Y); while($u <= $e) { echo("<option value=\"$u\">$u</option>"); $u++; } echo("</select></td>"); echo("<td><select name=\"s_time[]\"> <option value=\"8\">8:00 AM</option> <option value=\"9\">9:00 AM</option> <option value=\"10\">10:00 AM</option> <option value=\"11\">11:00 AM</option> <option value=\"12\">12:00 PM</option> <option value=\"13\">1:00 PM</option> <option value=\"14\">2:00 PM</option> <option value=\"15\">3:00 PM</option> <option value=\"16\">4:00 PM</option> <option value=\"17\">5:00 PM</option> <option value=\"18\">6:00 PM</option> <option value=\"19\">7:00 PM</option> <option value=\"20\">8:00 PM</option> <option value=\"21\">9:00 PM</option></select></td>"); echo("<td><select name=\"e_time[]\"> <option value=\"8\">8:00 AM</option> <option value=\"9\">9:00 AM</option> <option value=\"10\">10:00 AM</option> <option value=\"11\">11:00 AM</option> <option value=\"12\">12:00 PM</option> <option value=\"13\">1:00 PM</option> <option value=\"14\">2:00 PM</option> <option value=\"15\">3:00 PM</option> <option value=\"16\">4:00 PM</option> <option value=\"17\">5:00 PM</option> <option value=\"18\">6:00 PM</option> <option value=\"19\">7:00 PM</option> <option value=\"20\">8:00 PM</option> <option value=\"21\">9:00 PM</option></select></td>"); $i++; } ?> <tr> <td colspan="5"><center><input type="submit" value="Add Dates To Order"></center></td> </tr> </table> </form> ac36e5fbdefed15a4daf3d7008723c87.php: <?phpsession_start();require('sql.php');#$a = "$_SESSION[amt_dates]";#$i = 1;#while($i <= $a){#Month$_SESSION['month'][$i] = "$_POST[month][$i]";$i++;}#$i = 1;#while($i <= $a){#day$_SESSION['day'][$i] = "$_POST[day][$i]";$i++;}#$i = 1;#while($i <= $a){#year$_SESSION['year'][$i] = "$_POST[year][$i]";$i++;}#$i = 1;#while($i <= $a){#s_time$_SESSION['s_time'][$i] = "$_POST[s_time][$i]";$i++;}#$i = 1;#while($i <= $a){#e_time$_SESSION['e_time'][$i] = "$_POST[e_time][$i]";$i++;}##header("location: http://www.pickinpal.zxq.net/review.php");exit;?> review.php: <form method="post" action=""> <p><table cellpadding=5 cellspacing=5 rules=none width="100%"> <tr> <th>Date</th> <th> </th> <th> </th> <th>Start Time</th> <th>End Time</th> </tr> <?php session_start(); # $a = "$_SESSION[amt_dates]"; # $i = 0; # while($i <= $a) { # echo("<tr>"); echo("<td>" . $_SESSION[month]['$i'] . "</td>"); echo("<td>" . $_SESSION[day]['$i'] . "</td>"); echo("<td>" . $_SESSION[year]['$i'] . "</td>"); echo("<td>" . $_SESSION[s_time]['$i'] . "</td>"); echo("<td>" . $_SESSION[e_time]['$i'] . "</td>"); echo("</tr>"); $i++; } # ?> </table></p>
  21. I want to count user who open the page , I want to insert in mysql table when user open the page and I want to insert or upadet when close the page by click [x] or press alt+F4 but not onunload or onbeforeunload , cause this also call when refresh I want to call this alert when close onlyI can use a code which insert when open and not insert when refresh , but I couldnt solve insert or update when close the pagehere is my code: <?session_start();if (!isset($_SESSION["visits"])) $_SESSION["visits"] = 0;if ($_SESSION["visits"] > 0){echo 'visit='.$_SESSION["visits"];echo "You hit the refresh button!";}else{ mysql_query( "INSERT INTO najd_visit( visit_userId, visit_staticId, visit_page, visit_enterTime)VALUES ('$userId', '$Sid', '$title', '$date') "); $_SESSION["visits"] = $_SESSION["visits"] + 1;echo 'visit='.$_SESSION["visits"];echo "This is my site";}?>
  22. Are they the same or are they different?
  23. ok... i tried to enter my localhost again today to edit a little more on my projects... then i get this error: (PICTURE ATTACHED...) What the heck is that?... i mean... this is the line its talking about: (?>) witch are my PHP ending tag... someone?... Attached my config file also...
  24. I got this textarea it works when i paste chars asdsakopöosatfsjoqtqpw but it gives error on result when there is öäå Error result Incorrect string value: '\xE4as\xF6da...' for column 'Teksti' at row 1
  25. I have this php script stop.php <?phpinclude('ssh_con.php');$stop = 'screen -S testapplication -X quit';ssh2_exec($con, $stop);mysql_query("UPDATE servers SET Online=0 WHERE Owner='".$_SESSION['Username']."'");echo "<meta http-equiv='refresh' content='0;index.php'>";?> now i want to execute/call/get this page/script using javascript onclick to execute the code and the page refreshes itself. Can anyone guide me to do this? Thanks before hand.
  • Create New...