Home     Articles & Projects     Products & Web Services     Forum

Forum

Not sure if I have done this right

What I want to do is hide a modal if the modal is not needed.
However with my PHP script I am using the following, what I know will happen. Is that the story will not sure if the modal is hidden, due to for e.g if modal 2 is hidden which $story[2] shows then story[2] will get skiped.

Here is my code

<?php
if((isset($a)) && (!$a==""))
{
   
$sqlid = "select id from pages WHERE urltitle = '$t'";
   
$resultid = mysql_query($sqlid) or die ("Error Searching");
   
$rowid = mysql_fetch_assoc($resultid);
   
extract ($rowid);
   
   
$id=$id;
   
   
   
$stories = array();
   
       
$sql = "select * from items ORDER BY modNumb ASC LIMIT 7";
       
$result = mysql_query($sql) or die ("Sorry we can't find that post");
   
        while (
$row = mysql_fetch_assoc($result))
        {
       
$i++;
       
           
       
$stories[$i] = array('html'=>$row["HTML"]);
        }
}
elseif(
$t=="" || $t=="index" )
{

       
$id=1;
   
       
$stories = array();
   
       
$sql = "select * from items ORDER BY modNumb ASC LIMIT 7";
       
$result = mysql_query($sql) or die ("Sorry we can't find that post");
   
        while (
$row = mysql_fetch_assoc($result))
        {
       
$i++;
       
           
       
$stories[$i] = array('html'=>$row["HTML"]);
        }
}
?>

my modals

<!--- START OF MODUAL 1 --->
<?
if ($row["modNumb"] != 2)
<div id="one">
<?
print $stories[1]['html'];
?>
</div>
<!--- END OF MODUAL 1 --->

<!--- START OF MODUAL 2 --->
<div id="two">
<?
print $stories[2]['html'];
?>
</div>
<!--- END OF MODUAL 2 --->
</div>

<!--- START OF MODUAL 3 --->
<div id="three">
<?
print $stories[3]['html'];
?>
</div>
<!--- END OF MODUAL 3 --->

<!--- START OF MODUAL 4 --->
<div id="four">
<?
print $stories[4]['html'];
?>
</div>
<!--- END OF MODUAL 4 --->

<!--- START OF MODUAL 5 --->
<div id="five">
<?
print $stories[5]['html'];
?>
</div>
<!--- END OF MODUAL 5 --->

<!--- START OF MODUAL 6 --->
<div id="six">
<?
print $stories[6]['html'];
?>
</div>
<!--- END OF MODUAL 6 --->

<!--- START OF MODUAL 7 --->
<div id="seven">
<?
print $stories[7]['html'];
?>
</div>
<!--- END OF MODUAL 7 --->

PHP pipe email to MySQL

Hi,
I am wondering if someone would be able to help me, I am having a big issue finding information and an example, of a PHP pipe email to MYSQL,

I have made the email web interface, and all MYSQL tables etc, but I can't figure out who to pipe all emails to a PHP script.

I would also like to know how would I allow users IMAP of their email account?

Thanks
Russell H.

PHP image uploader base64

Hi I am wondering is it possible to upload a picture (jpg) and convert it to base64?
Also is base64 quicker to load then just an image in a db?

jQuery SEO friendly

Hi Guys, just wondering if anyone would be able to help me,
I am looking for away to make my site SEO friendly after I use jQuery to make the site ajax, now what I would like to do is make it so if someone goes to

http://www.mysite.com/medals/2010

instead of it showing the page that has no style or links etc...
It shows the what they would of seen if they where navigating from the home page.

Paypal IPN

Hi I have the following script which was working, but now, it is not adding the payments to the database, while paypal says success the script just does not add the payment to the database.

I was wondering if there is an error, that you would notice. I have changed to a VPN server, and made sure that 443 port is open which it is, but still not working...

<?
require('./config/db.php');
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
$invoice = $_POST['invoice'];


if (!$fp) {
print "ERROR";
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {

mysql_query("INSERT INTO paypal (pid, amount, status, currency, payeremail) VALUES ('$invoice','$payment_amount','$payment_status','$payment_currency','$payer_email')");

// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment


}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>

.htaccess Rewrite problems

Hi David,

I am having some problems with url rewriting and wonder if you could point out my errors please?

The .htaccess file looks like this

Options -MultiViews
RewriteEngine On
RewriteBase /

#add www subdomain
RewriteCond %{HTTP_HOST} ^pricescompare.co.uk [NC]
RewriteRule ^(.*)$ http://www.pricescompare.co.uk/$1 [L,R=301]

# index.php to /
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.pricescompare.co.uk/$1 [R=301,L]

# Category rewrites
RewriteRule ^(.*)/$ category.php?category_name=$1 [L]

# Page rewrites
RewriteRule ^privacy/$ privacy.php
RewriteRule ^about-us/$ about-us.php
RewriteRule ^register/$ register.php
RewriteRule ^login/$ login.php
RewriteRule ^logout/$ logout.php

It was all working fine until I added this line
RewriteRule ^(.*)/$ category.php?category_name=$1 [L]

It doesn't seem to differentiate between the category rewrite and the page rewrites and directs all traffic to the category rewrite.

Here is a url that should go to the registration page but instead goes to the category page => http://www.pricescompare.co.uk/register/

Thanks in advance,
Simon

random unique 10 digit string

I need to come up with a way to make a user 10 digit unique ID string.
The ID must not already be in the DB, if you know how please help.

Displaying adsense when a criteria is met

Hi,

I run a directory site which has both free and paid for listings. I am trying to get the details page of the site to display adsene only if the listing is a free. I use a field called rank to do this

<?php
if ($row_ful_site['Rank']='9') {
echo
"ADSENSE TO GO HERE ";
}
?>

I can get it to show the text but when i try and use the google adsense code, things go horribly wrong.

Please could you suggest how i can get this code to show if the listing is ranked at 9

Many thanks

Simon

Trying to get the following info

Hi Guys, I am trying to get some data from this page but not quite sure how to go about it,
The URL is {link saved}
Info I am trying to get is the data that looks like this (Might be a bit different)
But the Update, Surf, Wind and Weather stays the same just the parts after :

Updated: Fri Jan 1st, 7:03am
Surf: clean 0.5-1ft
Wind: light
Weather: partly cloudy

I also want to get the following data (you will have to look in the source code for this info)

{code saved}

I need to then strip all of the data after .swf?
If you can help that would be great.

Thanks

Wont run

Hi, I am having an issue with this simple script but when I remove the randstring it works the randstring is a var(40)

<?php
mysql_query
("INSERT INTO tbl_radio_station
(radio_station_name, radio_station_description, radio_station_homepage, radio_station_keywords, radio_station_low_stream, type, radio_station_high_stream, type_high, radio_stream_type_high, randstring)
VALUES ('$name', '$about', '$stationurl', '$stationkeywords', '$lowstream', '$low_stream_type', '$highstream', '$high_stream_type', '3', '4545')"
;
?>

Syndicate content