premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Maq's code was more for entering it into a database, hence the psuedo mention. <?php $query = mysql_query ("SELECT * FROM Failures"); $result = mysql_fetch_assoc ($query); $parts = explode(" ", $result['Name']); echo 'First Name: '. $parts[0] . '<br />'; echo 'Last Name: ' . $parts[1]; ?> Should work.
-
You cannot protect "html" unless you make the client install software of yours to view the website. Then it might be possible, however they could still potentially get the code. Just out of curiosity, why is your HTML output so important to protect? You could take a page out of google's book and use AJAX to display the full page, but this also requires javascript or the user cannot see the page. But if you go into gmail and view the source all you see is Javascript, nothing more. Other than doing that (which with a DOM viewer you may still be able to get the HTML, I do not know as I never tried) yea.
-
Yes, with Javascript you can code in a function to disable the "right" click. However it is easily by passed by turning off Javascript or a few tricks like holding the right mouse button then when you left click ok hold the right mouse button again and move it on the page and viola you get the menu. Or just View -> Source. Anyhow someone in this forum should be able to help you, but you can google, "Javascript disable right click" and find an answer quicker. Technically, I would not consider HTML source code. That is more like a template/median used to display data.
-
It is all based on guesses. The OP failed to provide any code or extra information that may help him get the correct solution to his problem. Frankly the fact that the last name could contain a space, is null. As they never stated it could be a possibility, thus I would not worry about it. As the OP needs to learn how to ask a proper question and show relevant code to get their code working like they would want.
-
To elaborate. You need to set it as a .php extension and I believe you should also send the header content-type as text/javascript since that is the type of file you are dishing out. It is "not" required to send the content-type. But I just like to
-
PHP does not work with Apache
premiso replied to gorokhmn's topic in PHP Installation and Configuration
The only thing I could think of is your .htaccess on Workstation1 has it added to it. As it does not "have" to be in the httpd.conf if it is located in .htaccess. It is just better to do it in httpd.conf unless you want to limit who gets PHP access. -
<input type="submit" name="submit" value="submit" /> Your submit button was missing the name field.
-
Why not just use str_replace ???
-
Gotcha, the javascript setting the cookie is the bitch part. I do not think there is a way to bypass this. What is the cookie it is setting? Is it just to test that you have javascript enabled? If so, you may be able to browse the site on your local box and copy the cookie from the file on your local box and mimic that way in your cookies.txt that you are using in the cURL function. You may have to dynamically write it each time, but if it is just a test that should work.
-
Do either providers support OpenID? But what you are doing is having the user enter in their email information then going to the site and signing them in and allowing them to browse it from your site like they are logged in? Is that correct? Is there a reason you are doing it this way?
-
Avoid using addslashes for database entries. There is a reason mysql_real_escape_string was created. <?php $n_desc=mysql_real_escape_string(htmlspecialchars($_POST['n_desc'])); Should be all you have to do. Adding slashes should not be used as this there is a function designed for this specific event.
-
MySQL Date Format Why not pull it out of MySQL the way you want it instead of converting it to a timestamp?
-
PHP and MySQL are made for massive amounts of Traffic. I believe that Facebook and yahoo are coded in PHP (not sure on the DB). Do not worry about the traffic. Honestly, javascript would only do a minor amount it is not worth it. PHP is extremely efficient if coded properly. Traffic tasks the server more. PHP will not as long as it is coded properly. Simple as that. To think, this page took 0.071 seconds to create and ran 21 MySQL queries. If it did not have to run those queries it would have loaded up a ton faster. You are bogging yourself down with something that is not even relevant. The traffic will be the same with or without Javascript, so will PHP executing tasks. Simple as that. Handle data where it needs to be handled.
-
Two separate items. Javascript is client side. PHP is serverside. The problem with javascript is it can be disabled on the client. PHP code will always be executed. So you have to ask yourself, is the task you want to preform necessary? Cause if it is, then PHP is the sure fire way to do it.
-
Do you understand what a View is? http://en.wikipedia.org/wiki/View_(database) EDIT: As for views working in MySQL 4.5 you cannot. http://dev.mysql.com/tech-resources/articles/mysql-views.html MySQL Views were released in 5.
-
if (isset($_POST['submit'])) { Sorry, missed an ending )
-
[SOLVED] Unsetting arrayed errors in switch statements???
premiso replied to darkfreaks's topic in PHP Coding Help
But why. It makes more code for you to write. I do not see the purpose of using switch case in this scenario. It just does not make sense to me, as it is much more code than if/else if/else would take. EDIT: As to your problem: <?php if ($_POST) { echo $error['height'];} ?><b>Weight(lbs.):</b><input name="weight" type="text" size="3"><?php if ($_POST) { echo $error['weight'];} ?> You are checking if $_POST and echoing an error? Why ??? how does $_POST = an error? This is probably what you were intending to do: <?php echo isset($error['height'])?$error['height']:''; ?> You should be checking if the error index has been set, not if $_POST as that will execute no matter what if the form has been submitted. EDIT: EDIT: Also: if($error){?> Why do you not use proper checking conditions in the if statement? if (count($error) > 1 || !isset($_POST['Calculate!'])){?> That way, only display the form if there have been errors recorded to the array. And you will know that the condition will not fluke out just because $error has been set. EDIT: Added the !isset to the calculate. I would suggest not using non-alpha numeric characters in your form item names. This way, if there were no errors or if the form has not been submitted then show the form, else show the msg. -
[SOLVED] Unsetting arrayed errors in switch statements???
premiso replied to darkfreaks's topic in PHP Coding Help
switch. I do not believe you can use conditional cases like you are. Use IF/Else If/Else instead. If you can do that, then yea. Why not just use an if/else if/else statement. It would be much less code and easier to read, in my opinion. -
<?php $file = "submitCount.txt"; $count = (file_exists($file))?file_get_contents($file):0; if (isset($_POST['submit']) { $count++; $fh = fopen($file, "w+"); fwrite($fh, $count); fclose($fh); } ?> Submit Count is now <?php echo $count; ?><br /> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="submit" name="submit" value="Submit!" /> </form> Should add one each time that form is submitted and display the count.
-
[SOLVED] Unsetting arrayed errors in switch statements???
premiso replied to darkfreaks's topic in PHP Coding Help
Yes. It probably would have thrown an Undefined index notice, to be honest. -
[SOLVED] Unsetting arrayed errors in switch statements???
premiso replied to darkfreaks's topic in PHP Coding Help
$error = array(); // start with a clean bill of health if (empty($_POST['variable'])) { $error['variable'] = "This variable was empty."; if (count($error) > 1) { echo "You had errors which were: <br />"; echo implode("<br />", $error); }else { echo "No errors, woohoo!"; } No need to unset it, if you do not set it in the first place. -
$file = "submitCount.txt"; if (!file_exists($file)) { $count = 0; }else { $count = file_get_contents($file); } $fh = fopen($file, "w+"); fwrite($fh, ($count + 1)); fclose($fh); Simple as that with a flat file housing the data. You will of course have to put that into an if to check if the form was submitted or not.
-
Try this for the if statement: if (!is_dir('users/'.$userid) && !file_exists('users/' . $userid)) { mkdir('../users/'.$userid); mkdir('../temp/'.$userid); } And see if that gets you better results.
-
@OP: The issue seems clear, your including the file to the wrong path. Show us some (the first 20 lines) of code from the file and maybe we can help you resolve this issue. Moving to PHP Help. For anyone trying to help the errors are as follows Warning: include(./includes/phpclass.inc.php) [function.include]: failed to open stream: No such file or directory in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 6 Warning: include(./includes/phpclass.inc.php) [function.include]: failed to open stream: No such file or directory in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 6 Warning: include() [function.include]: Failed opening './includes/phpclass.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 6 Warning: include(./includes/functions.php) [function.include]: failed to open stream: No such file or directory in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 7 Warning: include(./includes/functions.php) [function.include]: failed to open stream: No such file or directory in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 7 Warning: include() [function.include]: Failed opening './includes/functions.php' for inclusion (include_path='.:/usr/local/lib/php') in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 7 Fatal error: Class 'PHP_fun' not found in /content/HostingPlus/t/r/travelservicesworldwide.net/web/logindetail.php on line 8
-
$find = ($_POST['formfield']); if (($_POST['$searching']) =="yes") { Missing the $ before _POST