-
Posts
84 -
Joined
-
Last visited
Posts posted by PHPTOM
-
-
If you want to do something on an hourly basis why not use crons?
-
Put all the IPs into seperate rows.
Then:
<?php $myQuery = mysql_query("SELECT `banip` FROM `banedIPS`"); if(!$myQuery) { die("Database table Selection Failed: " . mysql_error()); } while ($row = mysql_fetch_assoc($myQuery)) { if($row['banip'] == $_SERVER['REMOTE_ADDR']){ if(!isset($_POST['submit'])){ echo "<form method=\"post\">"; echo "Are you a human?<br />"; echo "<select name=\"humancheck\">"; echo "<option value=\"no\">No</option>"; echo "<option valu=\"yes\">Yes</option>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />"; echo "</select></form>"; }else{ $check = $_POST['humancheck']; if($check == "no"){ header("Location: http://www.google.com"); }elseif($check == "yes"){ mysql_query("DELETE FROM `banip` WHERE `banip` = '".$_GET['REMOTE_ADDR']."'"); header("Location: http://www.yoursite.com"); } } } ?>
----------------
Now playing: 2pac - Changes
via FoxyTunes
-
Fatal error: Class 'mysqli' not found in /home/mysite/public_html/city/inc/db.php on line 6
Looks like I need to enable mysqli extension?
-
Yes I use OOP that's why I though MySQL would be better. Can I just stick a while on that then? like the same way I can do with mysql_fetch_array()?
while($row = $result->fetch_array(MYSQLI_ASSOC)){ echo $row[username]; //for example }
----------------
Now playing: Deep Purple - Smoke On The Water
via FoxyTunes
-
Hi,
I have always used MySQL, but I might switch to MySQLi. I'm planning a new application I am making but I don't know whether to use MySQLi or MySQL. How do you do things like mysql_fetch_array with mysqli? Is this how you do a query? :
$query = $mysqli->query("SELECT * FROM `table`");
I do understand some of it, like $mysqli would have to be a
$mysqli = new Mysqli;
something like that.
Thanks a lot
----------------
Now playing: Chris Brown - Forever
via FoxyTunes
-
Maybe not the best but using a cron job so at midnight it fetches a new picture or whatever out of an array and maybe if you don't have a database put it into a flat file. Not the way I would do it, but certainly possible.
-
Wouldn't this be a bit better coding?
if (!is_numeric($pkills)) { die ($pkills." is an improper value for kills"); }
-
THanks for all the responses. Basically I had a range from 1-80, then I had to do a while from the database to remove certain numbers. So then I could select a random number what hasn't already been chosen. Unset works fine, because I shuffle it afterwords. Thanks again!
-
-
Say I have
<?PHP $ar = array("test", "php", "freak"); ?>
How could I remove the test element from it? So then its only
<?PHP $ar = array("php", "freak"); ?>
Thanks :)
----------------
Now playing: Linkin Park - With You
via FoxyTunes
-
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ echo "not valid"; }
PHP 5 only
----------------
Now playing: Linkin Park - Papercut
via FoxyTunes
-
Personally wouldn't now, but in the past frames have been good to display inline content without the whole page refreshing. It sucks for SEO big style.
----------------
Now playing: Linkin Park - ptsremix
via FoxyTunes
-
-
For example. If you have used mysql_fetch_array assigned to $info
You do:
echo nl2br($info[field]);
Whever you echo it, wrap it in nl2br
----------------
Now playing: Linkin Park - Hands Held High
via FoxyTunes
-
Yes it is possible. There are many webmail clients in PHP. You'd have to check for mail via SMTP. You could use Pear mail or something for that
----------------
Now playing: Linkin Park - Numb
via FoxyTunes
-
Good to hear. Mark this thread as solved.
----------------
Now playing: Linkin Park - P5hng me A*wy
via FoxyTunes
-
-
$to = $_POST['email']; $subject = "You have registered"; $body = " <html> <head> <title>Account Activation</title> </head> <body> <p>email here <br /> <br /> -----------------------------<br /> This is an automated email, please don't try and reply.' </body> </html>"; $headers = 'From: website.com <noreply@website.com>'; mail($to, $subject, $body, $headers);
What happens if you do that?
----------------
Now playing: Linkin Park - Crawling Demo
via FoxyTunes
-
Nope you can't. http://usphp.com/manual/en/security.magicquotes.disabling.php
----------------
Now playing: Linkin Park - Carousel Demo
via FoxyTunes
-
<td background='$config[cellbgx2]' valign='top' align='center'>
-
<?php error_reporting(E_ALL); session_start( ); // if username and password are set and not empty then proceed with the rest of the process if( isset( $_POST[ 'username' ] ) && isset( $_POST[ 'company' ] ) && $_POST[ 'username' ] != '' && $_POST[ 'company' ] != '' ) { $link = mysql_connect( 'host', 'username', 'password' ); $db_selected = mysql_select_db('dbname', $link); $username = mysql_real_escape_string($_POST['username'], $link); $company = mysql_real_escape_string($_POST['company'], $link); if (!$db_selected) { echo"Connection to the database failed. Please try again later." ; exit; } //checks for username and password in db table. $results = mysql_query("select * from access where username='" . $username . "' and company = '" . $company . "'" ,$link ) or die(mysql_error()); $num_rows = mysql_num_rows($results); //greater than zero if( $num_rows > 0 ) { $_SESSION['username'] = $username; $_SESSION['company'] = $company; //redirect $data = mysql_fetch_array($results); header("Location: {$data['company']}.php"); } } ?>
<div id="center_column"> <?php if (isset($_SESSION['username']) && $_SESSION['company'] == "thecompany") { echo'<br /><br /><br />'; echo '<p>You are logged in as '.$_SESSION['username'].'</p>'; echo'<a href="#nogo">Project</a><br><br>'; echo'<a href="#nogo">Links</a><br><br>'; echo'<a href="#nogo">Will</a><br><br>'; echo'<a href="#nogo">Go</a><br><br>'; echo'<a href="#nogo">Here</a><br><br><br><br>'; } else { echo '<p>You are not logged in.</p>'; echo '<p>Only logged in members may visit these pages.</p>'; echo '<p><a href="login_access.php">Client login Page</a><br /><br /></p>'; } ?> </div>
-
at start of the document put
ob_start();
then
echo $_COOKIE['cookiename'];
----------------
Now playing: Sugarland - Stay
via FoxyTunes
-
Yeah that would be enough. But if you don't want people to know your code to copy it in the first place, encrypt it.
----------------
Now playing: Jay-Z And Linkin Park - Izzo/In The End
via FoxyTunes
-
You'd need set up a MySQL database and get the information from there.
Example:
$query = mysql_query("SELECT * FROM `products`"); while($a = mysql_fetch_array($query)){ echo"<form method=\"POST\" action=\"https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/*********\" accept-charset=\"utf-8\"> <input type=\"hidden\" name=\"$a[product_title]\" value=\"Product Title\"/> <input type=\"hidden\" name=\"$a[p_model]\" value=\"Product Model Number.\"/> <input type=\"hidden\" name=\"$a[quantity]\" value=\"Quantity\"/> <input type=\"hidden\" name=\"$a[price]\" value=\"Price\"/> <input type=\"hidden\" name=\"USPS Priority\" value=\"UPS Ground\"/> <input type=\"hidden\" name=\"$a[shipping]\" value=\"Shipping\"/> <input type=\"hidden\" name=\"_charset_\"/> <input type=\"image\" name=\"Google Checkout\" alt=\"Fast checkout through Google\" src=\"http://checkout.google.com/buttons/checkout.gif?merchant_id=*******&w=180&h=46&style=white&variant=text&loc=en_US\" height=\"36\" width=\"100\"/> </form>"; }
Of course you would need to setup a database. If you want me to help you with that and your host has PHPMYadmin I will help you. Email me tlomas [at] gmail [dot] com
----------------
Now playing: Jay-Z And Linkin Park - Numb/Encore
via FoxyTunes
----------------
Now playing: Jay-Z And Linkin Park - Numb/Encore
via FoxyTunes
How does the google ads script work?
in PHP Coding Help
Posted
You call an external JS file. So then it just document.write's the ads? The external file isn't a JS file. It's a PHP file or another language but then dubbed via MOD_rewrite or something similar to be a .js.
It will have the header text/javascript I believe