premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Potentially, but if you use javascript it would potentially duplicate the data. IMO the best way is to use sessions to set the previous_page and then use that for the header location. This will not duplicate data, but wipe it out unless you store the data in session and use that to re-populate the form.
-
[SOLVED] stripping the ' character after a POST
premiso replied to jeff5656's topic in PHP Coding Help
$string = "dx1 = '" . mysql_real_escape_string($_POST['dx1']) . "', dx2 = '" . mysql_real_escape_string($_POST['dx2']) . "', dx3 = '" . mysql_real_escape_string($_POST['dx3']) . "'"; That is how you would formulate if I gathered your question right. -
<?php $ctx = stream_context_create(array( 'http' => array( 'timeout' => 1 ) ) ); file_get_contents("http://example.com/", 0, $ctx); ?> Found that at file_get_contents in the user's remarks. Not sure if that will work, but yea.
-
INNER JOIN causing odd problem, PHP Problem I think!
premiso replied to Lamez's topic in PHP Coding Help
If you have access to mysql command line or phpMyAdmin copy that query and test it out there. Are you sure it is called "user" and not "users" ? -
Did you change the column and table name to be what they should be? If you do not have a table named "table" and a column inside table named "title" that will not work.
-
[SOLVED] switch() - deafult case: break;
premiso replied to soycharliente's topic in PHP Coding Help
As far as the break, no you do not have to use it. The break is under each case where you want it to stop executing without it it just runs. But since the default should be your last case or part of a case it is not necessary. A few examples: <?php $page = 'index.html'; switch ($page) { case 'blue.html': //this will execute if blue or yellow. case 'yellow.html': break; default: // this will execute if no data is passed in or index.html case 'index.html': break; } That is a valid switch statement, since the default is associated with the index it will run; <?php $page = 'index.html'; switch ($page) { case 'index.html': break; case 'yellow.html': break; default: } Is also valid incase you wanted a special circumstance for the no page <?php $page = 'index.html'; switch ($page) { case 'index.html': break; case 'blue.html': // extra coding if it is blue case 'yellow.html': // coding if yellow break; default: break; } Is also valid but the last break is unnecessary. That is valid with the blue and yellow so if they both have the primary principles but you want to do something different if the case is blue as appose to yellow it will allow you to. Anyhow hope that helps ya out. -
INNER JOIN causing odd problem, PHP Problem I think!
premiso replied to Lamez's topic in PHP Coding Help
Are you sure $u contains what it should? -
Look at what ProjectFear wrote. Use the Absolute Paths not Relative. If you want it to still be dynamic, $siteURL = "http://" . $_SERVER['HTTP_HOST'] . "/"; gives you the full path to the initial folder and use that instead of ../ it would be echo '<link href="' . $siteURL . 'css/style.css" />'; Or you can place the $siteURL in the base HTML tag path and remove any ../ in the code. An absolute path
-
You have to send it as an HTML email. Read up on how to do that at mail() Example #4 They should have examples etc.
-
You do realize that if you print < > that to a screen without html_entities that string, you have to view the source to see the full tag. Chances are the header tag is fine, but since you are using HTML open and close <> without entiting them you will not see it cause it takes it as an html tag. View the source and you will see what I mean.
-
I would highly not recommend that and recommend you fix the code. Register_globals is off for security reasons.
-
$result=mysql_query("INSERT INTO uploads (description, data,filename,filesize,filetype) ". "VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')") OR DIE(mysql_error()); $id= mysql_insert_id(); Change that part and report back the mysql_error.
-
Why do you need to check if a port is open? Sounds like you want to try and hack anyone who comes to your site with that port open if you ask me.
-
Register_globals is probably turned off on the new hours. Chances are you need to re-do your code and code for that.
-
[SOLVED] Adding to MultiDimensional Arrays - Frustrating.
premiso replied to UpcomingPhpDev's topic in PHP Coding Help
<table cellspacing="0"> <form method="POST"> <tr> <td><input value="Ny" name="City[Ny][]" /></td> <td><textarea name="City[][]"></textarea></td> </tr> <tr> <td><input value="Ca" name="Country[Ca][]" /></td> <td><textarea name="City[][]"></textarea></td> </tr> <input type="submit" /> </form> </table> <?php $City = $_POST['City']; print "<PRE>"; print_r($City); print "</PRE>"; $No = 0; foreach($City as $key => $CityId) { if (!is_array($CityId)) { $CityId = explode("\n", $CityId); $New[$key] = $CityId; } //$New = implode("\n",$CityId); //$New = explode("\n",$New); //$Count = count($New); //echo $Count; print "<PRE>" . print_r($New,1) . "</PRE>"; } ?> Give that a try. -
[SOLVED] Adding to MultiDimensional Arrays - Frustrating.
premiso replied to UpcomingPhpDev's topic in PHP Coding Help
Alright man. Your problem is you need a delimieter to know how line 1 is different than line 2. Either an enter break "\n" or something like this is line1 | this is line 2 In order to do it how you want it is virtually impossible unless you know how many words are allowed or there is a specific word you want. The line break would be the easiest. So when you enter in the text box it looks like: this is line 1 this is line 2 Then you can easily explode that by "\n" in to an array and put that into the "ny" section. -
Should work in both. If it does not chances are it is something with your code or you are not posting the variables right. PHP knows nothing about the browser. It could be a missed tag in your HTML somewhere, and FF parses it right, but IE likes to make a fuss.
-
Find getGenRef function and see what that does with $agreementName. It is most likely coming from a DB.
-
Is it coming from $_GET or $_POST, and register_globals is turned on? It is hard to tell you where it is without the code, but my pet is it is posting from a form or get data and register_globals is turned on thus it is not defined, only used.
-
Yea, make sure it is outside of any if statements, or else it will not get defined where it needs to be.
-
Keep getting errors when tryng to apply CSS
premiso replied to renegade44's topic in PHP Coding Help
Look up PHP Proper Syntax please. These are really basic errors you should be able to solve yourself. <?php if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $url = 'comments.php?id='.$row['id']; echo "<div class='title_class'>" . $row['title'] . "</div> " . $row['sd'] . "<br /> Posted by : <b>" . $row['author'] . "</b><br /> " . $row['post'] . "<br /> <a href=\"javascript:openComments('" . $url . "')\">Add new comment or view posted comments</a></p>"; } } else { echo 'There are no news posts to display'; } ?> </body> </html> How you were going in and out the echo statement and mixing and matching all different types of " and ' was causing the error. Above should be formatted properly -
<?php $siteaddress ="http://www.yourdomain.com"; $sitename = "yourdomain.com"; $adminaddress = $sitename . " <email@yourdomain.com>"; //No need to change anything below ... // Gets the date and time from your server $date = date("m/d/Y H:i:s"); // Gets the IP Address if ($_SERVER['REMOTE_ADDR'] == "") $ip = "no ip"; // before assumed register_globals was on. else $ip = getHostByAddr($_SERVER['REMOTE_ADDR']); // Gets the POST Headers - the Flash variables $sender = $_POST['sender'] ; $subject = $_POST['subject'] ; $message = $_POST['message'] ; // $HTTP_POST_VARS is depreciated. //Process the form data! // and send the information collected in the Flash form to Your nominated email address mail ("$adminaddress","$subject", "A visitor at $sitename has left the following information\n Email: $sender\n The visitor commented: ------------------------------ $message Logged Info : ------------------------------ Using: {$_SERVER['HTTP_USER_AGENT']} Hostname: $ip IP address: {$_SERVER['REMOTE_ADDR']} Date/Time: $date","FROM: $adminaddress" ) ; //This sends a confirmation to your visitor mail ("$sender","Thank You for visiting $sitename", "Hi $sender,\n Thank you for contacting $sitename!\n Your message was received. Respectfully, Webmaster@$sitename $siteaddress") ; ?>
-
Note at the end of the code before ?>: function orderMyArray($array, $orderby) { sort($array); $cnt = count($orderby); for ($i=0; $i<$cnt;$i++) { $newArray[$orderby[$i]] = $array[$orderby[$i]]; } return $newArray; } Must be there, or else you get that error.