Link to home
Start Free TrialLog in
Avatar of M-ezzat
M-ezzat

asked on

PHP/MYSQL Inserting Multiple to textarea

this A Full code about my problem

i want make Insert multi data to my textarea


exmple :

if post

https://www.experts-exchange.com/m-ezzat/
https://www.experts-exchange.com//m-ezzat1/
https://www.experts-exchange.com//m-ezzat2/
https://www.experts-exchange.com//m-ezzat3/
https://www.experts-exchange.com//m-ezzat4/

the result must be

MyDomain like domain.com

http://www.domain.com.com/1/
http://wwwdomain.com//2/
http://www.domain.com//3/
http://www.domain.com//4/
http://wwwdomain.com//5/

My idea talk about Protection links

but i want insert every url to line in database

Inserting Multiple
Step 1
 
 
 
<form action="MultiDone/" method="post">
<table width="100%" border=0>
  <tbody>
  <tr>
    <td >File link:<br />
    <textarea rows="14" name="multiurls"  class="input"  cols="59"></textarea><br /></td></tr></tbody></table></td></tr><tr><td colspan="3" 
height="1%" width="738">
<p style="TEXT-AliGN: center" align=center><input class=submit type=submit value="Protect link &amp; Make It Short!" name=send></td> 
</form>
 
 
Step2
 
 
<?php
 
include_once("./includes/config.php") ;
 
$url   = $_POST['multiurls'];
 
 
if (!isset($url)) {
	print "please full all fields";
	
}
else {
$insert = "INSERT INTO `data` (`id` ,`url`) values (NulL ,'$url')";
$query  = mysql_query($insert);
if (!$query) die(mysql_error());
}
 
$select = "SELECT `id` FROM `data` WHERE `URL` = '$url'";
$amr = mysql_query($select);
if (!$amr) die(mysql_error());
list($url2) = mysql_fetch_array($amr);
 
 
 
$select1 = "SELECT `siteurl` FROM `config`";
$amr1 = mysql_query($select1);
if (!$amr1) die(mysql_error());
list($siteurl) = mysql_fetch_array($amr1);
 
 
 
?>
 
Result
 
 
<textarea  class="input" rows="14" name="multi" cols="59"><?php echo $siteurl; ?>/<? echo $url2 ?></textarea>

Open in new window

Avatar of NerdsOfTech
NerdsOfTech
Flag of United States of America image

I think can help you with this.

Are you saying that you would like to enter URLS in the TEXTAREA and then insert every URL in separate row?

Please clarify and describe what you want your form to do more clearly.

Thanks
Avatar of M-ezzat
M-ezzat

ASKER

Yes

i want send more than url in textarea




and separate the Results and add each url in line to SQL
<textarea  class="input" rows="14" name="multi" cols="59">
SendUrl1
SendUrl2
SendUrl3
SendUrl4
SendUrl5
SendUrl6
SendUrl7
SendUrl8
SendUrl9
SendUrl10
</textarea>
 
<textarea  class="input" rows="14" name="multi" cols="59">
Result1
Result2
Result3
Result4
Result5
Result6
Result7
Result8
Result9
Result10
</textarea>

Open in new window

How would you like the result URLs be derived?

Say I type in:

www.google.com
www.yahoo.com/somepage/
www.google.com/search/

What would the result URLs look for example?

Thanks
Avatar of M-ezzat

ASKER


look this script like TinyURL.com

but i want make multi links

You said

www.google.com
www.yahoo.com/somepage/
www.google.com/search/


I want the result

MySiteName.Com/tiny/ID1
MySiteName.Com/tiny/ID2
MySiteName.Com/tiny/ID3

that mean every site will insert to my db as line
Avatar of M-ezzat

ASKER

Anyone can help?
I can. Are you saying that in this example:

Input:
www.google.com
www.yahoo.com/somepage/
www.google.com/search/


Output:

tblURL
ID    Real URL
==================================
1     www.google.com
2     www.yahoo.com/somepage/
3     www.google.com/search/

So that when someone goes to:

http://MySiteName.com/tiny/ID1

they are redirected to www.google.com?

Thanks
Avatar of M-ezzat

ASKER

when someone goes to:

http://MySiteName.com/tiny/ID1

Will redirected to My second page to tell him
wait 5 sc then the vistor will click to go to www.google.com?


example:

4share-forex.us/1
You would have to have apache and rewrite ON and create a .htmaccesss file in the public directory...

You would then need a processing page such as tiny.php - which would access the database entry for matched ID (such as 1) from the query string (corresponds to www.google.com in the above example) and outputs the result as a link or a redirect.

Hope this helps.

=NerdsOfTech

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^tiny/ID([0-9]+)/$ /tiny.php?id=$1 [L]

Open in new window

I mean .htmaccess
I am available for hire if you need this job done for you as this is a multi-step process.

=NerdsOfTech
Avatar of M-ezzat

ASKER

i'm already done this step i talk about Multi insert

Like

http://lenkawy.com/index.php5?op=large

Or

http://www.any-services.com/demo/short/multi.php


in form write any url like that

http://www.google.com
http://www.google.co.uk
http://www.google.us
http://www.googles.com

And click Go Or Protect Links

Will see the result

that what i mean
Okay. Post your database table you want the information to go into
Avatar of M-ezzat

ASKER

i'll post the the script

http://www.4share-forex.us/url.zip

all files + db

what i need in multi.php and MultiDone.php


NerdsOfTech Thanks for ur help
backup and replace:
MultiDone

:
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here
$url =  $_POST['multiurls'];
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= (NULL ,'$value')";
 }
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT MAX(id) FROM `data` WHERE `URL` IN ()";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
list($url2)=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
list($siteurl) =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link: 
	<input size="40" onclick="highlight(this);" name="link" value="<?php echo $siteurl; ?>/<? echo $url2 ?>">
      <br />
      <br />
      <a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	<a href="<? echo $url2 ?>">Test your link</a>
      
      <br /></td>
    </tr></tbody></table></td></tr><tr><td colspan="3" 
height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
 
</td> 
&nbsp;</p></div>
	</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

Oops wait don't use that. Be right back with correct code
Fixed.

<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here
$url =  $_POST['multiurls'];
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT MAX(id) FROM `data` WHERE `URL` IN ()";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
list($url2)=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
list($siteurl) =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link: 
	<input size="40" onclick="highlight(this);" name="link" value="<?php echo $siteurl; ?>/<? echo $url2 ?>">
      <br />
      <br />
      <a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	<a href="<? echo $url2 ?>">Test your link</a>
      
      <br /></td>
    </tr></tbody></table></td></tr><tr><td colspan="3" 
height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
 
</td> 
&nbsp;</p></div>
	</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

That should fixed the insert and select functionality. However I think you should output the links in a similar way with foreach.

=NerdsOfTech
Avatar of M-ezzat

ASKER

Errors And Please Protection the Process

please full all fields

Warning: Invalid argument supplied for foreach() in G:\AppServ\www\url\MultiDone.php on line 57
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1

Fix error in SELECT.

Test #2
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here
$url =  $_POST['multiurls'];
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT MAX(id) FROM `data` WHERE `URL` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
list($url2)=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
list($siteurl) =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link: 
	<input size="40" onclick="highlight(this);" name="link" value="<?php echo $siteurl; ?>/<? echo $url2 ?>">
      <br />
      <br />
      <a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	<a href="<? echo $url2 ?>">Test your link</a>
      
      <br /></td>
    </tr></tbody></table></td></tr><tr><td colspan="3" 
height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
 
</td> 
&nbsp;</p></div>
	</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

Avatar of M-ezzat

ASKER

Yes it's working now no errors

but the result get 1 query but i put many sites in text area

what about

Result
 
How get the protected link every line like

http://www.any-services.com/demo/short/multi.php
<textarea  class="input" rows="14" name="multi" cols="59"><?php echo $siteurl; ?>/<? echo $url2 ?></textarea>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of NerdsOfTech
NerdsOfTech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of M-ezzat

ASKER

Not working yet.

when send the values from multi.php
manysites like that

http://localhost/link.php
http://localhost/link2.php
http://localhost/link3.php

to multidone.php

as the same values

like that

<a href="61">$value</a>
 
<a href="61">$value</a>

Avatar of M-ezzat

ASKER

Not working cuz

when i'm add

http://localhost/url/multi.php
http://localhost/url/multi.php
http://localhost/url/multi.php
http://localhost/url/multi.php

the query add all like in 1 line in data table

not like what i want

i want every insert every site to db

id 1 http://localhost/url/multi.php
id 2 http://localhost/url/multi.php
id 3 http://localhost/url/multi.php
id 4 http://localhost/url/multi.php

and i tryed new func

<textarea rows="14" name="multiurls"  class="input"  cols="59">
<?php foreach ($url2 as $value)
{
?>
<? echo nl2br($value); ?><?php }?>
</textarea>
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here = DONE
$url =  mysql_real_escape_string($_POST['multiurls']);
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT id FROM `data` WHERE `url` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
$url2=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
list($siteurl) =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link:
		
      <input size="40" onclick="highlight(this);" name="link" value="">
      <br />
      <br />
      <a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
<br/>
Test your link(s):
<br/>
<br/>
<textarea rows="14" name="multiurls"  class="input"  cols="59">
<?php foreach ($url2 as $value)
{
?> 
<? echo nl2br($value); ?><?php }?>
</textarea>     
      <br /></td>
    </tr></tbody></table></td></tr><tr><td colspan="3" 
height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
 
</td> 
&nbsp;</p></div>
	</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

what were the results from your alteration?
Avatar of M-ezzat

ASKER

Now url multidone.php add every site in line to db but

the result

Not correct

Go to this page

http://www.4share-forex.us/url/multi.php

and copy all sites and past it in the form

http://localhost/url/multi.php
http://localhost/url/multi.php
http://localhost/url/multi.php
http://localhost/url/multi.php



you will understand what i say

and i want send you private data to my site to see everything

Avatar of M-ezzat

ASKER

I think the problem here

$amr=new mysqlQueryClass();
$select = "SELECT MAX(id) FROM `data` WHERE `URL` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";


becuase this query get Max id in data only

not all values
Thanks!
$amr=new mysqlQueryClass();
$select = "SELECT id FROM `data` WHERE `URL` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";

Open in new window

Never mind, I didn't see MAX anywhere?

I fixed the problem I think on the one we were working on:
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here = DONE
$url =  mysql_real_escape_string($_POST['multiurls']);
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT id FROM `data` WHERE `url` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
$url2=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
$siteurl =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link:
 
<?php 
 foreach ($url2 as $value)
 {
?>	
 <input size="40" onclick="highlight(this);" name="link" value="$value"> 
 <a href="value">Test Link</a>
 <br />
<?php
 }
?>
 
<a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<br /> 
</td>
</tr></tbody></table></td></tr>
<tr><td colspan="3" height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
</td> 
&nbsp;</p></div>
</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

typo

use this instead:
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1 ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here = DONE
$url =  mysql_real_escape_string($_POST['multiurls']);
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT id FROM `data` WHERE `url` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
$url2=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
$siteurl =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link:
 
<?php 
 foreach ($url2 as $value)
 {
?>	
 <input size="40" onclick="highlight(this);" name="link" value="<?php echo $value ?>"> 
 <a href="<?php echo $value ?>">Test Link</a>
 <br />
<?php
 }
?>
 
<a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<br /> 
</td>
</tr></tbody></table></td></tr>
<tr><td colspan="3" height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
</td> 
&nbsp;</p></div>
</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

Typo #2 fixed use this instead:
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1; ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here = DONE
$url =  mysql_real_escape_string($_POST['multiurls']);
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT id FROM `data` WHERE `url` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
$amr->mysqlQuery($select);
$url2=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
$siteurl =$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename; ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link:
 
<?php 
 foreach ($url2 as $value)
 {
?>	
 <input size="40" onclick="highlight(this);" name="link" value="<?php echo $value; ?>"> 
 <a href="<?php echo $value; ?>">Test Link</a>
 <br />
<?php
 }
?>
 
<a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<br /> 
</td>
</tr></tbody></table></td></tr>
<tr><td colspan="3" height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
</td> 
&nbsp;</p></div>
</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

Avatar of M-ezzat

ASKER

same problem

http://4share-forex.us/url/multi.php

the script given me same id in result

check the site
Test, upload, and link
<?php
include_once("./includes/Global.php");
?>
 
<!DOCTYpE HTML pUBliC "-//W3C//Dtd hTML 4.01 transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<TITLE><? echo _SITE_TITLE_;?></TITLE>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<meta content="<? echo _KEYWORKDS_;?>" name=keywords>
<meta content="<? echo _DESCRIPTION_;?>" name=description>
<link href="<? echo _SITE_URL_;?>/style/default.css" type=text/css rel=stylesheet>
 
<script type="text/javascript">
 
function highlight(field)
{
        field.focus();
        field.select();
}
</script>
</head>
 
<body>
<? echo $Notices1; ?>
 
<?php
 
include_once("./includes/Global.php");
//$array = array();
 
 
//// I reccomend you do some anti-sql-injection code here = DONE
$url =  mysql_real_escape_string($_POST['multiurls']);
 
 
 
if (!isset($url))
{
	print "please full all fields";
}
else
{
 $aurl = explode("\n", $url);
 $insert= new mysqlQueryClass();
 $insert = "INSERT INTO `data` (`id`, `url`) values ";
 foreach ($aurl as $value){
  $insert .= "(NULL ,'$value'),";
 }
 $insert = rtrim($insert, ",");
 $mysqlQuery->mysqlQueryUpdate($insert);
 if (!$mysqlQuery) die(mysql_error());
}
 
$amr=new mysqlQueryClass();
$select = "SELECT `id` FROM `data` WHERE `url` IN (";
foreach ($aurl as $value){
 $select .= "'$value',";
}
$select = rtrim($select, ","); // remove last comma in list
$select .= ");";
 
////DEBUG select
echo $select; 
 
$amr->mysqlQuery($select);
$url2=$amr->result;
 
$amr1=new mysqlQueryClass();
$select1 = "SELECT `siteurl` FROM `config`";
$amr1->mysqlQuery($select1);
list($siteurl)=$amr1->result;
 
?>
 
<div id=outer>
<div id=inner>
<div id=header>
<h1><? echo $sitename; ?></h1>
			<h2>Sharing is just getting better!</h2></div>
<div id=menu>
<ul>
  <li class=first><a href="<? echo _SITE_URL_;?>/">home</a>
  <li><a href="<? echo _SITE_URL_;?>/Upload/">Upload</a>
  <li><a href="<? echo _SITE_URL_;?>/">protect</a>
  <li><a href="<? echo _SITE_URL_;?>/Tos/">Tos</a>
  <li><a href="<? echo _SITE_URL_;?>/ContactUs/">Contact us</a>
  </ul>
  </div>
<div id=primarycontent><!-- primary content start -->
<div class=post>
<div class=header>
<H3>Get Short &amp; protected link for your big files links:</H3></div>
<div class=content>
<table width="100%" border=0>
  <tbody>
  <tr>
    <td align=middle>
	<div id="outer0">
		<div id="inner0">
			<div id="primarycontent0">
				<div class="post">
					<div class="content">
						<p align="center"><b><font color="#006600">Your File was 
						successfully added :</font></b></div>
				</div>
			</div>
		</div>
	</div>
	<p>link:
 
<?php 
 foreach ($url2 as $value)
 {
?>	
 <input size="40" onclick="highlight(this);" name="link" value="<?php echo $siteurl . '\' . $value; ?>"> 
 <a href="<?php echo $siteurl . '\' . $value; ?>">Test Link</a>
 <br />
<?php
 }
?>
 
<a href="/index.php">protect another link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<br /> 
</td>
</tr></tbody></table></td></tr>
<tr><td colspan="3" height="12%" width="738"></td></tr><tr><td colspan="3" height="0%" width="738">
<p style="text-align: center" align=center>
</td> 
&nbsp;</p></div>
</div></div>
<? echo $Footer; ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Open in new window

Also, output the debug for the select query I put in the code... thanks.
Avatar of M-ezzat

ASKER

Error when use mysql_real_escape_string

when remove all errors is gone


but the same error

http://www.4share-forex.us/url/24
http://www.4share-forex.us/url/24
use code in #24792435

upload and post message.

I want to see the select SQL be printed out
Avatar of M-ezzat

ASKER

oki

Go to

http://4share-forex.us/url/multi.php

And wirte many sites and you will see the result
yeah the select SQL looks perfect. However I think you need to add some sort of tranasction reference to the table so the select doesn't pickup other's URL entries that are similar.
However, there are some problems in your processing gateway page you need to fix.

=NerdsOfTech
Please post the structure of your tables here.

Thanks!
Avatar of M-ezzat

ASKER

DROP TABLE IF EXISTS `admins`;
CREATE TABLE IF NOT EXISTS `admins` (
  `Admin_ID` int(11) NOT NULL auto_increment,
  `Admin_UserName` varchar(255) NOT NULL default '',
  `Admin_Password` varchar(255) NOT NULL default '',
  `Admin_Level` int(11) NOT NULL default '0',
  `Admin_LastVisit` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`Admin_ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

DROP TABLE IF EXISTS `config`;
CREATE TABLE IF NOT EXISTS `config` (
  `id` int(2) NOT NULL auto_increment,
  `sitename` varchar(225) NOT NULL default '',
  `siteurl` varchar(225) NOT NULL default '',
  `adminemail` varchar(50) NOT NULL default '',
  `keywords` text NOT NULL,
  `description` text NOT NULL,
  `notes` text NOT NULL,
  `visits` int(20) NOT NULL default '0',
  `google1` text NOT NULL,
  `google2` text NOT NULL,
  `count` int(255) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

DROP TABLE IF EXISTS `data`;
CREATE TABLE IF NOT EXISTS `data` (
  `id` int(255) NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL default '',
  `url` text collate latin1_general_ci NOT NULL,
  `size` int(255) NOT NULL default '0',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=35 ;
Can you give a few examples of data rows from config and data

Thanks!
Avatar of M-ezzat

ASKER

You can download the script and see what you want


or i can give my Cpanel to see everything :)
Thanks.

Now after the website gets the input and inserts into db

lets say for example:

CREATE TABLE `config` (
  `id` int(2) NOT NULL auto_increment,
  `sitename` varchar(225) NOT NULL default '',
  `siteurl` varchar(225) NOT NULL default '',
  `adminemail` varchar(50) NOT NULL,
  `keywords` text NOT NULL,
  `description` text NOT NULL,
  `notes` text NOT NULL,
  `visits` int(20) NOT NULL default '0',
  `google1` text NOT NULL,
  `google2` text NOT NULL,
  `count` int(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;




1, "Google", "www.google.com", "admin@google.com", etc.

Is there a particular URL you will give this entry?
Like:
http://www.4share-forex.us/url/1

?

thanks for the upload.
Avatar of M-ezzat

ASKER

CREATE TABLE IF NOT EXISTS `data` (
  `id` int(255) NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL default '',
  `url` text collate latin1_general_ci NOT NULL,
  `size` int(255) NOT NULL default '0',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;


(1, 'MyProblem', 'https://www.experts-exchange.com/questions/24541635/How-many-site-chatrooms-are-there.html, 99, 'll3okl_elgnll@yahoo.com')

this page will get the url from database and give it to me.

http://www.4share-forex.us/url/1
Sorry request the mod to post an alert on this Q I wont be able to help further. Good luck.
Avatar of M-ezzat

ASKER

Any way you will award the points

Thanks for ur help i'll try to end what ur started it