Jump to content

rlb1

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by rlb1

  1. How do I fix this For Each statement when used with preg match? //Cat_ID & Category Name preg_match_all('%<a[^href=]*href=\"\/cats\.asp\?cat_id=(.*?)\" title="(.*?)">%',$data,$matches1,PREG_SET_ORDER); // works fine preg_match_all('%/60/(.*?).jpg"%s',$data,$matches2,PREG_SET_ORDER); // works fine preg_match_all('%h3><p>(.*?)<\/p>%s',$data,$matches3,PREG_SET_ORDER); // works fine foreach ($matches1 as $val) { //need help here $subcat_id=$val[0][1]; $subcat=$val[0][2]; $cat_image=$val[1][1]; $cat_desc=$val[2][1]; Thanks for your help!!!
  2. I would like to put a redirect on the following line shown below in the code if registration is successful: <h1>Registered</h1> <p>Thank you, you have registered - you may now login</a>.</p> //NEED HELP HERE Please see full code below: <?php // Connects to your Database mysql_connect("**********", "*********", "**********") or die(mysql_error()); mysql_select_db("********") or die(mysql_error()); //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { die('You did not complete all of the required fields'); } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { die('Sorry, the username '.$_POST['username'].' is already in use.'); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match.'); } // here we encrypt the password and add slashes if needed $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } // now we insert it into the database $insert = "INSERT INTO users (username, password) VALUES ('".$_POST['username']."', '".$_POST['pass']."')"; $add_member = mysql_query($insert); ?> <h1>Registered</h1> <p>Thank you, you have registered - you may now login</a>.</p> //NEED HELP HERE ***** <?php } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0"> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="60"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="10"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="pass2" maxlength="10"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table> </form> <?php } ?>
  3. Line 399 is where the Parse error is as noted //PARSE ERROR HERE
  4. I cannot get this parse error figured out. Please check error below. Thank you for your help!! // imgsize.php script installed (see parse error below) <?php header ("Content-type: image/jpeg"); /* JPEG / PNG Image Resizer Parameters (passed via URL): img = path / url of jpeg or png image file percent = if this is defined, image is resized by it's value in percent (i.e. 50 to divide by 50 percent) w = image width h = image height constrain = if this is parameter is passed and w and h are set to a size value then the size of the resulting image is constrained by whichever dimension is smaller Requires the PHP GD Extension Outputs the resulting image in JPEG Format By: Michael John G. Lopez - www.sydel.net Filename : imgsize.php */ $img = $_GET['img']; $percent = $_GET['percent']; $constrain = $_GET['constrain']; $w = $_GET['w']; $h = $_GET['h']; // get image size of img $x = @getimagesize($img); // image width $sw = $x[0]; // image height $sh = $x[1]; if ($percent > 0) { // calculate resized height and width if percent is defined $percent = $percent * 0.01; $w = $sw * $percent; $h = $sh * $percent; } else { if (isset ($w) AND !isset ($h)) { // autocompute height if only width is set $h = (100 / ($sw / $w)) * .01; $h = @round ($sh * $h); } elseif (isset ($h) AND !isset ($w)) { // autocompute width if only height is set $w = (100 / ($sh / $h)) * .01; $w = @round ($sw * $w); } elseif (isset ($h) AND isset ($w) AND isset ($constrain)) { // get the smaller resulting image dimension if both height // and width are set and $constrain is also set $hx = (100 / ($sw / $w)) * .01; $hx = @round ($sh * $hx); $wx = (100 / ($sh / $h)) * .01; $wx = @round ($sw * $wx); if ($hx < $h) { $h = (100 / ($sw / $w)) * .01; $h = @round ($sh * $h); } else { $w = (100 / ($sh / $h)) * .01; $w = @round ($sw * $w); } } } $im = @ImageCreateFromJPEG ($img) or // Read JPEG Image $im = @ImageCreateFromPNG ($img) or // or PNG Image $im = @ImageCreateFromGIF ($img) or // or GIF Image $im = false; // If image is not JPEG, PNG, or GIF if (!$im) { // We get errors from PHP's ImageCreate functions... // So let's echo back the contents of the actual image. readfile ($img); } else { // Create the resized image destination $thumb = @ImageCreateTrueColor ($w, $h); // Copy from image source, resize it, and paste to image destination @ImageCopyResampled ($thumb, $im, 0, 0, 0, 0, $w, $h, $sw, $sh); // Output resized image @ImageJPEG ($thumb); } ?> // Script on main page - Parse error on line 399 as shown below Print "<TABLE cellSpacing=0 cellPadding=2 width=765>"; while($rowy = mysql_fetch_array( $resulty )) { Print "<TBODY>"; Print "<tr>"; Print "<TD class=listings>"; Print "<TABLE cellSpacing=0 cellPadding=2>"; Print "<TBODY>"; Print "<TR>"; Print "<TD width=100>"; Print "<img src=spacer.gif height=12><BR>"; Print "<DIV class=image>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "<img src=/imgsize.php?h=75&img="{$rowy['URL_Image_Large']}" "; //PARSE ERROR HERE Print "border=0></td> "; Print "<TD vAlign=top align=left>"; Print "<TABLE cellSpacing=0 cellPadding=2 width=600>"; Print "<TBODY>"; Print "<TR>"; Print "<TD height=30 width=600>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "".$rowy['Name'] . "[/url]</TD>"; Print "<TD vAlign=top align=right width=100 rowSpan=3>"; Print "<DIV class=text_price>$".$rowy['Price'] . "</DIV></TD>"; Print "</TR>"; Print "<TR>"; Print "<TD height=25>"; Print "".$rowy['Description'] . " "; Print "<A title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "more...[/url]"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; } Print "</TD>"; Print "</TR>"; Print "</TABLE>"; ?>
  5. OK, GD is installed and working on my server per my hosting company. I am still getting this: Fatal error: Call to undefined function: open_image() in /home/champion/public_html/directforless/watch.php on line 384 Thanks!
  6. What is GD Library and where do I find it... I am relatively new to PHP, but I am picking it up fast! Thanks for your help!!
  7. Please assist me with this error. I have tried several things to no avail: "{$row['Manufacturer']}" '$row['Manufacturer']}' {$row['Manufacturer']} Fatal error: Call to undefined function: open_image() in /home/champion/public_html/directforless/watch.php on line 384 // Load image $image = open_image($row['URL_Image_Large']); // ERROR HERE ON LINE 384 if ($image === false) { die ('Unable to open image'); } // Get original width and height $width = imagesx($image); $height = imagesy($image); // New width and height $new_width = 75; $new_height = 75; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image header('Content-type: image/jpeg'); imagejpeg($image_resized); die(); Print "<TABLE cellSpacing=0 cellPadding=2 width=765>"; while($rowy = mysql_fetch_array( $resulty )) { Print "<TBODY>"; Print "<tr>"; Print "<TD class=listings>"; Print "<TABLE cellSpacing=0 cellPadding=2>"; Print "<TBODY>"; Print "<TR>"; Print "<TD width=100>"; Print "<img src=spacer.gif height=12><BR>"; Print "<DIV class=image>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "<img src=\"$image_resized\" border=0></A></td> "; Print "<TD vAlign=top align=left>"; Print "<TABLE cellSpacing=0 cellPadding=2 width=600>"; Print "<TBODY>"; Print "<TR>"; Print "<TD height=30 width=600>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "".$rowy['Name'] . "</A></TD>"; Print "<TD vAlign=top align=right width=100 rowSpan=3>"; Print "<DIV class=text_price>$".$rowy['Price'] . "</DIV></TD>"; Print "</TR>"; Print "<TR>"; Print "<TD height=25>"; Print "".$rowy['Description'] . " "; Print "<A title=".$rowy['Name'] . " href=/watch.php?id=".$rowy['id'] . " target=_top>"; Print "<b><i>more...</i></b></A>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; } Print "</TD>"; Print "</TR>"; Print "</TABLE>"; ?>
  8. I am getting an error with both reccomendations... How do I fix? Warning: Cannot modify header information - headers already sent by (output started at /home/champion/public_html/directforless/page.php:2) in /home/champion/public_html/directforless/page.php on line 29 <? # GRAB THE VARIABLES FROM THE URL $id = $_GET['idurl']; $name = $_GET['name']; // Otherwise we connect to our Database mysql_connect("*********", "*********", "*********") or die(mysql_error()); mysql_select_db("champion_merchants") or die(mysql_error()); // Retrieve all the data from the "example" table $result = mysql_query("SELECT * FROM zzounds WHERE id='$idurl'") or die(mysql_error()); // store the record of the "example" table into $row $row = mysql_fetch_array( $result ); $redirect = $row['URL_Product']; header ('Location: $redirect'); // ERROR HERE ON LINE 29
  9. Please help me with this. This redirect is not working. Thanks!!! <? # GRAB THE VARIABLES FROM THE URL $id = $_GET['idurl']; $name = $_GET['name']; // Otherwise we connect to our Database mysql_connect("*******", "*******", "*******") or die(mysql_error()); mysql_select_db("champion_merchants") or die(mysql_error()); // Retrieve all the data from the "example" table $result = mysql_query("SELECT * FROM zzounds WHERE id='$idurl'") or die(mysql_error()); // store the record of the "example" table into $row $row = mysql_fetch_array( $result ); // Trying to redirect to URL - I have tried "{$row['Manufacturer']}" {$row['URL_Product']} .$row['URL_Product'] header( 'Location: {$row['URL_Product']}' ) ; // Need help here echo " ".$row['URL_Product']; //This works great!! ?>
  10. Please provide some assistance with this array. Thanks for your help!! // Please note: $row['URL_Product']} = http://www.zzounds.com/item--BEHBXL3000 -- I am trying to hide the link with: <?php $path = array( 'getrecord' => "{$row['URL_Product']}", ); if (array_key_exists($_GET['id'],$path)) header('Location:'.$path[$_GET['id']]); Print "<TABLE>"; Print "<TBODY>"; Print "<TD width=100 align=right>"; Print "<A href=http:www.domain.com/loc=getrecord>Browse Store</A>"; Print "</TD>"; Print "</TR>"; Print "</FORM>"; Print "</TBODY>"; Print "</TABLE>"; ?>
  11. The code is not working... I am thinking that their is something wrong with the array key?? I would like to have the "$path = array" code on the same page if possible? If I put it on a different page, will the "{$row['URL_Product']}", variable carry over? Thanks for your help!! $path = array( 'Product' => "{$row['URL_Product']}", ); if (array_key_exists($_GET['id'],$path)) header('Location:'.$path[$_GET['id']]); Print " <DIV align=left> "; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$path['Product']; Print " target=_blank> "; Print " <H1> "; echo " ".$row['Name']; Print " </H1></A>"; Print " <TABLE cellSpacing=5 cellPadding=0 width=100% border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD vAlign=top align=middle width=300> "; Print " <DIV align=center> "; Print " <A title="; echo " ".$row['Name']; Print " href="; Print "domain.com/music.php?id=Product"; // Here is the link Print " target=_blank> "; Print " <IMG src="; echo " ".$row['URL_Image_Large']; Print " alt= "; echo " ".$row['Name']; Print " border=0></A> "; Print " <BR> "; Print " <SPAN class=text_9px>Retailer is responsible for this image.</SPAN> "; Print " </BR> "; Print " </DIV></TD> "; Print " <TD vAlign=top height=200> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% align=left border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD> "; Print " <DIV class=text_11px style=PADDING-LEFT: 15px> "; Print " <A title="; echo " ".$row['Name']; Print " href="; Print "domain.com/music.php?id=Product"; // Here is the link Print " target=_blank> "; Print " <H4>"; Print " SKU: "; echo " ".$row['SKU']; Print " </H4></A>"; Print " <A title="; echo " ".$row['Name']; Print " href="; Print "domain.com/music.php?id=Product"; // Here is the link Print " target=_blank> "; Print " <H4>"; Print " Manufacturer: "; echo " ".$row['Manufacturer']; Print " </H4></A>"; Print " <DIV class=text_11px style=PADDING-BOTTOM: 5px> "; echo " ".$row['Description']; Print " </DIV><BR> "; Print " <DIV style=PADDING-BOTTOM: 5px; PADDING-TOP: 5px>"; Print " </DIV> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% border=0> "; Print " <TBODY> ";
  12. I am attempting to 'hide' a URL with the following code. I have done this with this code being on another PHP page, but I would like to have the code on the same page if possible. // Here is my attempt: $path = array( 'Product' => '{$row['Manufacturer']}', ); if (array_key_exists($_GET['Product'],$path)) header('Location:'.$path[$_GET['Product']]); print " " http://www.domain.com/id=Product ; // Here is the one that worked (installed on another page) <?php $path = array( 'apparel' => 'http://www.amazon.com/b?%....', 'cameras' => 'http://www.amazon.com/b?%....', 'computers' => 'http://www.amazon.com/b?%....', 'electronics' => 'http://www.amazon.com/b?%....', 'jewelry' => 'http://www.amazon.com/b?%....', 'watches' => 'http://www.amazon.com/b?%....', 'toys' => 'http://www.amazon.com/b?%....', 'musicalinst' => 'http://www.amazon.com/b?%....', ); if (array_key_exists($_GET['product'],$path)) header('Location:'.$path[$_GET['product']]); ?> // Here is the full page code Print " <DIV align=left> "; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$row['URL_Product']; // This shows the URL of the 'actual' store, would like to hide this Print " target=_blank> "; Print " <H1> "; echo " ".$row['Name']; Print " </H1></A>"; Print " <TABLE cellSpacing=5 cellPadding=0 width=100% border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD vAlign=top align=middle width=300> "; Print " <DIV align=center> "; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$row['URL_Product']; Print " target=_blank> "; Print " <IMG src="; echo " ".$row['URL_Image_Large']; Print " alt= "; echo " ".$row['Name']; Print " border=0></A> "; Print " <BR> "; Print " <SPAN class=text_9px>Retailer is responsible for this image.</SPAN> "; Print " </BR> "; Print " </DIV></TD> "; Print " <TD vAlign=top height=200> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% align=left border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD> "; Print " <DIV class=text_11px style=PADDING-LEFT: 15px> "; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$row['URL_Product']; Print " target=_blank> "; Print " <H4>"; Print " SKU: "; echo " ".$row['SKU']; Print " </H4></A>"; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$row['URL_Product']; Print " target=_blank> "; Print " <H4>"; Print " Manufacturer: "; echo " ".$row['Manufacturer']; Print " </H4></A>"; Print " <DIV class=text_11px style=PADDING-BOTTOM: 5px> "; echo " ".$row['Description']; Print " </DIV><BR> "; Print " <DIV style=PADDING-BOTTOM: 5px; PADDING-TOP: 5px>"; Print " </DIV> "; Print " <TABLE cellSpacing=0 cellPadding=0 width=100% border=0> "; Print " <TBODY> "; Print " <TR> "; Print " <TD> "; Print " <DIV><span class=textprice><STRONG>Price:</STRONG></span> "; Print " <span class=textpricered><STRONG> $"; echo " ".$row['Price']; Print " </STRONG> "; Print " </SPAN></DIV><BR></TD></TR><TR> "; Print " <TD vAlign=center align=left> "; Print " <A title="; echo " ".$row['Name']; Print " href="; echo " ".$row['URL_Product']; Print " target=_blank> "; Print " <IMG src=addtocartbutton.gif align=bottom border=0></A> "; Print " </TD></TR> "; Print " <TR> "; Print " <TD><BR> "; Print " <DIV class=text_11px><STRONG>Tell a Friend</STRONG></DIV> "; Print " </TD></TR><TR><TD><BR> "; Print " <DIV class=text_11px><STRONG>Bookmark this Page</STRONG></DIV> "; Print " </TD></TR> "; Print " </TBODY></TABLE></DIV> "; Print " </TD></TR></TBODY></TABLE> "; Print " </TD></TR></TBODY></TABLE> "; Print " </TD></TR></TBODY></TABLE> "; Print " </DIV> "; Print " <!-- end content --><!-- start footer --> "; Print " <BR><BR> "; Print " <HR> "; Print " <DIV class=text_12px align=left>"; Print "<B>More Popular Products from"; echo " ".$row['Manufacturer']; Print " </B> "; Print " </DIV> "; Print " <BR> ";
  13. I have a variable: $row['Manufacturer']; that I need to include in a Select Statement: $resulty = mysql_query("select * from database WHERE Manufacturer order by rand() LIMIT 1,10") or die(mysql_error()); (If you echo the variable -- echo " ".$row['Manufacturer']; -- it produces the name of the Manufacturer.) How do I include a variable like .$row['Manufacturer']; in the select statement? Thanks for your help!! ALL of the code $resulty = mysql_query("select * from database WHERE Manufacturer order by rand() LIMIT 1,10") or die(mysql_error()); Print "<TABLE cellSpacing=0 cellPadding=2 width=765>"; while($rowy = mysql_fetch_array( $resulty )) { $pic = $rowy['URL_Image_Small']; Print "<TBODY>"; Print "<tr>"; Print "<TD class=listings>"; Print "<TABLE cellSpacing=0 cellPadding=2>"; Print "<TBODY>"; Print "<TR>"; Print "<TD>"; Print "<TD width=100><DIV class=image>"; Print "<img src=\"$pic\"></td> "; Print "<TD vAlign=top align=left>"; Print "<TABLE cellSpacing=0 cellPadding=2 width=600>"; Print "<TBODY>"; Print "<TR>"; Print "<TD height=30 width=600>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/domain.com/stuff?id=".$rowy['id'] . " target=_top>"; Print "".$rowy['Name'] . "</A></TD>"; Print "<TD vAlign=top align=right width=100 rowSpan=3>"; Print "<DIV class=text_price>$".$rowy['Price'] . "</DIV></TD>"; Print "</TR>"; Print "<TR>"; Print "<TD height=25>"; Print "<SMALL>".$rowy['Description'] . "</SMALL> "; Print "<A title=".$rowy['Name'] . " href=domain.com/stuff?id=".$rowy['id'] . " target=_top>"; Print "<SMALL><i>more info</i></SMALL></A>..."; Print "</SMALL>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.