ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
so, you just want that whoever goes to test.domain.com is being referred to alex2008.com? if ($_SERVER['HTTP_HOST'] !== 'alex2008.com') { header("Location: http://www.alex2008.com"); }
-
save the css from this page into a file called reset.css and include it in your html page http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/ -- dutch --------------- als je wil kan ik je verder helpen in het nederlands als dat wat makkelijker is voor je
-
date("d-m-Y", mktime($hour, $minute, $second, $day, $year, $month)); mktime() reference: http://be.php.net/manual/en/function.mktime.php date() reference: http://be.php.net/manual/en/function.date.php
-
can you post both websites?
-
your db link is your db connection, probably when passed it uses that one instead of creating a new one
-
have you tried using print_r() on the posted data, to see if a value is set for it? did you try to echo both variables, and see that they contain a value before being written to database (echo at the latest possible moment, just before everything is written to the database)?
-
why not just use a row object? the memory usage will be significantly lower when only using a row object, instead of a cell object, you have much more cells then you have rows
-
you just need to keep track of which ad a user clicked and when clicked_ads ------------- user_id ad_id clicked_time return_time something like this, but with some better names for the fields
-
mostly you can rip this from a site <select name="state" id="state"> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH" selected>Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select>
-
SELECT substr('field', 0, 50) intro FROM table All string related mysql functions can be found here: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
-
Headers are sent from the server to the client, so both know what they received and how they should handle it, for example when you typed in phpfreaks.com you made a request, to get the contents from the server, the server made a response something like this: Content-Type: text/html; charset=ISO-8859-1 <html> <head> <title>b.. </head> </html> to get a better understanding i suggest you go to gmail login into your gmail account open an e-mail and press the down arrow on the right of the e-mail, you will get a dropdown and in that you select "display original" that way you can see what server and client sent to each other, the server did not send you this graphical user interface it was rendered this way by your browser you're browser received this long text and passed it through his render engine Gecko if u are using Opera or firefox, that way you get what we call a user interface, which makes it possible for you to communicate with the server
-
your query most presumably failed try: $query = mysql_query("SELECT file FROM datadb WHERE file='".$purl."' LIMIT 0,1"); if (false !== $query) { if (0 !== mysql_num_rows($query)) { // .. } }
-
Ho to check record existence and write if not exist?
ignace replied to coder9's topic in PHP Coding Help
why not just use: REPLACE INTO? -
lol, reminds of the times i was in class and had to do this horrible job in Java, VB.NET, C++, bweh :S for ($i = 1; $i <= 41; $i++) { for ($j = 0; $j < $i; $j++) { echo '*'; } echo '<br />'; } this will give you something like: * ** *** .. to get something like this: * ** *** you will most presumably need a table, as in php you don't have something like: drawer.pos(x, y)
-
why are you using bit operators? if you want to have another background color for every row i suggest you use something like $row_iterator = 1; while($rowtrack = mysql_fetch_array($resulttrack)){ echo "<tr" . (($row_iterator % 2) ? '' : ' class="odd"') . ">"; // before the end of the loop, you put $row_iterator++; }
-
well, this actually depends on your application logic you can use up and down arrows to increase or decrease your quantity or a text field to type the quantity and then update their cart, and those containing the value zero, are removed from the cart. using the arrows you could use a link with the a query like: <a href="updatecart.php?customer=56&item=3&quantity=3">increase quantity</a> <a href="updatecart.php?customer=56&item=3&quantity=1">decrease quantity</a> updatecart.php would then validate, filter the input and execute a query along the lines of: update cart set quantity = '$quantity' where item = '$item' and customer = '$customer' something along these lines or with the text field: <input type="hidden" name="customer" value="56" /> <input type="text" name="3" value="3" /> in your php: get all items for the customers cart, go over all items and see if the id exists in the $_POST variable, if so update the quantity set in value
-
select * from clients where (username = "foo" or domain = "foo") and password = "bar" something along these lines then?
-
you mean polymorphism
-
in oop you also get design patterns like PFMaBiSmAd said, he was referring to the singleton pattern
-
your problem can be solved using the abstract factory pattern abstract class Security { abstract public function authenticateUser($username, $password); public static function factory($username, $password, $auth) { if ($auth == "http") { $class = new HttpAuth(); /** * this is why you need it to be an abstract factory, so you can be sure that the class will have a authenticateUser() method * in addition you can do, after initiation: if (is_a($class, 'Security')) to be sure the class will have a authenticateUser() method */ $class->authenticateUser($username, $password); } ... } } class HttpAuth extends Security { public function authenticateUser($username, $password) {/* authentication method 1 */} } class FormAuth extends Security { public function authenticateUser($username, $password) {/* authentication method 2 */} } in your script then: $authentication_method = ... Security::factory($username, $password, $authentication_method); // depending on $authentication_method HttpAuth or FormAuth will be initiated
-
if ($HTTP_POST_VARS['user'] != '' || $HTTP_POST_VARS['domain'] != '') { $user = $HTTP_POST_VARS['user'] ? $HTTP_POST_VARS['user'] : $HTTP_POST_VARS['domain']; $sentry->checkLogin($user, $HTTP_POST_VARS['..
-
Getting my feet wet with MVC... I want to pass a mysqli result set
ignace replied to oljoha's topic in PHP Coding Help
what you need are called helpers, view helpers in more particular, they help your view parse difficult content class View { protected $_vars; protected static $_helpers; public function __set($var, $value) {} public function __get($var) {} public function __call($helper, $args) { // check if helper exists, if so load it and store it (static variable $helpers for example) return $helper->$helper($args); // something along these lines.. } } class View_ListHelper { // because a constructor can not return anything, you need a custom method, list() for example public function list($data) {} } in your controller: $this->view->data = $model->getData(); then in your view, assuming your script is included within your view object: <div class="my_list"> <?php echo $this->list($this->data); /* loads the View_ListHelper and executes the list() method which returns a html list */ ?> </div> -
nope, your getting out of memory_limit if you are allowed to adjust php settings, do: ini_set("memory_limit", "32M");
-
yeah and johnny is missing a ( if (isset($_GET['deleten']) { $get = $_GET['deleten']; echo "File deleted at: <a href=\"http://".$_SERVER["HTTP_HOST"].$get."\">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; }